revert: "LINUX: Fix oops during negative dentry caching" 54/12354/3
authorMichael Meffie <mmeffie@sinenomine.net>
Tue, 2 Aug 2016 20:52:42 +0000 (16:52 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 15 Sep 2016 02:53:36 +0000 (22:53 -0400)
Commit fd23587a5dbc9a15e2b2e83160b947f045c92af1 was done to fix an oops
when parent_vcache_dv() was called without the GLOCK held.  Since the
lockless code paths have been removed, and parent_vcache_dv() is always
called with the GLOCK held, revert the extra locked flag argument and
the calls obtain and release the GLOCK within parent_vcache_dv().

Change-Id: I21c3272ec4ed5d4fa1a746a0f783cccfc14e0c22
Reviewed-on: https://gerrit.openafs.org/12354
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/afs/LINUX/osi_vnodeops.c

index 8889587..db3efab 100644 (file)
@@ -1089,7 +1089,7 @@ afs_linux_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *sta
 }
 
 static afs_uint32
-parent_vcache_dv(struct inode *inode, cred_t *credp, int locked)
+parent_vcache_dv(struct inode *inode, cred_t *credp)
 {
     int free_cred = 0;
     struct vcache *pvcp;
@@ -1104,9 +1104,6 @@ parent_vcache_dv(struct inode *inode, cred_t *credp, int locked)
        struct vrequest treq;
        struct afs_fakestat_state fakestate;
 
-       if (!locked) {
-           AFS_GLOCK();
-       }
        if (!credp) {
            credp = crref();
            free_cred = 1;
@@ -1117,9 +1114,6 @@ parent_vcache_dv(struct inode *inode, cred_t *credp, int locked)
        if (free_cred)
            crfree(credp);
        afs_PutFakeStat(&fakestate);
-       if (!locked) {
-           AFS_GUNLOCK();
-       }
     }
     return hgetlo(pvcp->f.m.DataVersion);
 }
@@ -1214,7 +1208,7 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
 
        parent = dget_parent(dp);
        pvcp = VTOAFS(parent->d_inode);
-       parent_dv = parent_vcache_dv(parent->d_inode, credp, 1);
+       parent_dv = parent_vcache_dv(parent->d_inode, credp);
 
        /* If the parent's DataVersion has changed or the vnode
         * is longer valid, we need to do a full lookup.  VerifyVCache
@@ -1298,7 +1292,7 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
 
        parent = dget_parent(dp);
        pvcp = VTOAFS(parent->d_inode);
-       parent_dv = parent_vcache_dv(parent->d_inode, credp, 1);
+       parent_dv = parent_vcache_dv(parent->d_inode, credp);
 
        if (parent_dv > dp->d_time || !(pvcp->f.states & CStatd)
            || afs_IsDynroot(pvcp)) {
@@ -1473,7 +1467,7 @@ afs_linux_create(struct inode *dip, struct dentry *dp, int mode)
 #if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP)
        dp->d_op = &afs_dentry_operations;
 #endif
-       dp->d_time = parent_vcache_dv(dip, credp, 1);
+       dp->d_time = parent_vcache_dv(dip, credp);
        d_instantiate(dp, ip);
     }
 
@@ -1541,7 +1535,7 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp)
 #if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP)
     dp->d_op = &afs_dentry_operations;
 #endif
-    dp->d_time = parent_vcache_dv(dip, credp, 1);
+    dp->d_time = parent_vcache_dv(dip, credp);
 
     AFS_GUNLOCK();
 
@@ -1770,7 +1764,7 @@ afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode)
 #if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP)
        dp->d_op = &afs_dentry_operations;
 #endif
-       dp->d_time = parent_vcache_dv(dip, credp, 1);
+       dp->d_time = parent_vcache_dv(dip, credp);
        d_instantiate(dp, ip);
     }
     afs_DestroyAttr(vattr);