libafs: fix lock leak during shutdown
authorMichael Meffie <mmeffie@sinenomine.net>
Thu, 24 Apr 2014 17:40:06 +0000 (13:40 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 8 May 2014 13:14:25 +0000 (09:14 -0400)
afs_getattr returns EIO when afs is in the process of shutting
down.  Be sure to unlock the locks taken before returning.
The bozon lock leak has been present since IBM AFS.

Change-Id: Id3e330c458996abf1519de6364060cc0b8828e6a
Reviewed-on: http://gerrit.openafs.org/11096
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/afs/VNOPS/afs_vnop_attrs.c

index 854f4ee..c25e90d 100644 (file)
@@ -239,8 +239,13 @@ afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, afs_ucred_t *acred)
     afs_BozonLock(&avc->pvnLock, avc);
 #endif
 
-    if (afs_shuttingdown)
+    if (afs_shuttingdown) {
+#ifdef AFS_BOZONLOCK_ENV
+       afs_BozonUnlock(&avc->pvnLock, avc);
+#endif
+       AFS_DISCON_UNLOCK();
        return EIO;
+    }
 
     if (!(avc->f.states & CStatd)) {
        if (!(code = afs_InitReq(&treq, acred))) {