gconfd-lock-fix-20040602
authorChas Williams <chas@cmf.nrl.navy.mil>
Wed, 2 Jun 2004 20:40:34 +0000 (20:40 +0000)
committerDerrick Brashear <shadow@dementia.org>
Wed, 2 Jun 2004 20:40:34 +0000 (20:40 +0000)
FIXES 4905

"i believe i have managed to track this down to a missing
lock_kernel() in the dentry (lookup) revalidate routine.
this missing lock was already fixed in the 1.3 tree when
i submitted the 2.6 support patches (although its not quite
right i think -- the shrink_dcace_parent() should happen
under the BKL)"

src/afs/LINUX/osi_vnodeops.c

index d10e3c3..b113282 100644 (file)
@@ -852,13 +852,15 @@ afs_linux_dentry_revalidate(struct dentry *dp)
     struct vcache *lookupvcp = NULL;
     int code, bad_dentry = 1;
     struct sysname_info sysState;
-    struct vcache *vcp = ITOAFS(dp->d_inode);
-    struct vcache *parentvcp = ITOAFS(dp->d_parent->d_inode);
+    struct vcache *vcp, *parentvcp;
+
+    sysState.allocked = 0;
 
     AFS_GLOCK();
     lock_kernel();
 
-    sysState.allocked = 0;
+    vcp = ITOAFS(dp->d_inode);
+    parentvcp = ITOAFS(dp->d_parent->d_inode);
 
     /* If it's a negative dentry, then there's nothing to do. */
     if (!vcp || !parentvcp)
@@ -909,14 +911,14 @@ afs_linux_dentry_revalidate(struct dentry *dp)
     if (sysState.allocked)
        osi_FreeLargeSpace(name);
 
-    AFS_GUNLOCK();
-    crfree(credp);
-
     if (bad_dentry) {
        shrink_dcache_parent(dp);
        d_drop(dp);
     }
+
     unlock_kernel();
+    AFS_GUNLOCK();
+    crfree(credp);
 
     return !bad_dentry;
 }