macos: lock module against unload during shutdown
authorDerrick Brashear <shadow@dementix.org>
Wed, 18 Apr 2012 15:58:03 +0000 (11:58 -0400)
committerDerrick Brashear <shadow@dementix.org>
Mon, 23 Apr 2012 01:49:11 +0000 (18:49 -0700)
during shutdown, once umount finished, it was possible to
unload the module before shutdown completed. fix that.

Change-Id: I7eae5210ec9553fa862d96148f963dcdfee79c4b
Reviewed-on: http://gerrit.openafs.org/7245
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

src/afs/DARWIN/osi_module.c

index 020518b..f254ccf 100644 (file)
@@ -115,6 +115,8 @@ afs_modunload(struct kmod_info * kmod_info, void *data)
 {
     if (afs_globalVFS)
        return KERN_FAILURE;
+    if ((afs_initState != 0) || (afs_shuttingdown))
+       return KERN_FAILURE;
 #ifdef AFS_DARWIN80_ENV
     if (vfs_fsremove(afs_vfstable))
        return KERN_FAILURE;