From: Andrew Deason Date: Mon, 25 Aug 2014 04:01:16 +0000 (-0500) Subject: LINUX: Restore negative dentry caching X-Git-Tag: upstream/1.8.0_pre1^2~257 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=2e9dcc069904aaa434787eec53c6f9821911cbab;p=packages%2Fo%2Fopenafs.git LINUX: Restore negative dentry caching One of the changes in commit 652f3bd9cb7a5d7833a760ba50ef7c2c67214bba effectively disabled negative caching for dentries, by always invalidating a negative dentry in afs_linux_dentry_revalidate. This was because various temporary errors could result in ENOENT errors being returned to afs_lookup, which created incorrect negative dentry cache entries. These incorrect ENOENT errors were rectified in change Ib01e4309e44b532f843d53c8de2eae613e397bf6 . So, negative dentry cache entries should work now, so remove the code to unconditionally invalidate these negative entries. Change-Id: Ic027147fd1f733beaa0fafbbabfa8c09f5656d34 Reviewed-on: http://gerrit.openafs.org/11789 Reviewed-by: Benjamin Kaduk Reviewed-by: Daria Brashear Tested-by: BuildBot --- diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 4c8ae3587..36d00d4d2 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1299,23 +1299,21 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags) /* unlikely--the vcache entry hasn't changed */ dput(parent); + } else { -#ifdef notyet - /* If this code is ever enabled, we should use dget_parent to handle - * getting the parent, and dput() to dispose of it. See above for an - * example ... */ - pvcp = VTOAFS(dp->d_parent->d_inode); - if (hgetlo(pvcp->f.m.DataVersion) > dp->d_time) - goto bad_dentry; -#endif - /* No change in parent's DataVersion so this negative - * lookup is still valid. BUT, if a server is down a - * negative lookup can result so there should be a - * liftime as well. For now, always expire. - */ + /* 'dp' represents a cached negative lookup. */ + + parent = dget_parent(dp); + pvcp = VTOAFS(parent->d_inode); + parent_dv = parent_vcache_dv(parent->d_inode, credp); + + if (parent_dv > dp->d_time || !(pvcp->f.states & CStatd)) { + dput(parent); + goto bad_dentry; + } - goto bad_dentry; + dput(parent); } good_dentry: