From 338abe59511494b33351b9c22a7a77b6aab607ca Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 2 Nov 2010 10:15:21 -0700 Subject: [PATCH] Don't attempt stop if module unloading is disabled * In the openafs-client init script, don't attempt to stop or restart the AFS client if module loading is disabled. Stopping afsd without unloading the module would leave the system in an inconsistent state. --- debian/changelog | 8 ++++++++ debian/openafs-client.init | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/debian/changelog b/debian/changelog index 7072f2d48..b6eda6cc8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +openafs (1.5.77-3) UNRELEASED; urgency=low + + * In the openafs-client init script, don't attempt to stop or restart + the AFS client if module loading is disabled. Stopping afsd without + unloading the module would leave the system in an inconsistent state. + + -- Russ Allbery Tue, 02 Nov 2010 10:15:15 -0700 + openafs (1.5.77-2) experimental; urgency=low * Apply upstream deltas: diff --git a/debian/openafs-client.init b/debian/openafs-client.init index 94360e640..40e5b91c8 100755 --- a/debian/openafs-client.init +++ b/debian/openafs-client.init @@ -49,6 +49,17 @@ is_on() { fi } +# Determine if kernel module loading is disabled. If it's not, don't attempt +# to stop or restart AFS, since we'll end up in a bad inconsistent state. +is_loading_disabled() { + disabled=`cat /proc/sys/kernel/modules_disabled` + if [ "$loading" == 1 ] ; then + return 1 + else + return 0 + fi +} + # Load the AFS client module if it's not already loaded. Set $MODULEDIR and # $LIBAFS to override the default location and module name. Also check before # loading whether the module is listed in the module dependencies so that we @@ -204,6 +215,10 @@ force-start) ;; stop|force-stop) + if is_loading_disabled ; then + echo "Module loading disabled, cannot stop AFS" >&2 + exit 1 + fi $AFS_PRE_SHUTDOWN echo -n "Stopping AFS services:" if grep -q '^AFS ' /etc/mtab ; then -- 2.39.5