]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Don't attempt stop if module unloading is disabled
authorRuss Allbery <rra@debian.org>
Tue, 2 Nov 2010 17:15:21 +0000 (10:15 -0700)
committerRuss Allbery <rra@debian.org>
Tue, 2 Nov 2010 17:15:21 +0000 (10:15 -0700)
* 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
debian/openafs-client.init

index 7072f2d487bfd09f4d7db3bdc19cb92a32dd5fef..b6eda6cc8ce6cea2e3ae537c7ad12788eb388387 100644 (file)
@@ -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 <rra@debian.org>  Tue, 02 Nov 2010 10:15:15 -0700
+
 openafs (1.5.77-2) experimental; urgency=low
 
   * Apply upstream deltas:
index 94360e640f1c34d83a242e9dd113c6c78168b411..40e5b91c8c85f2632fb457fbe2a41cf4891cac33 100755 (executable)
@@ -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