From: Andrew Deason Date: Thu, 13 Jul 2017 22:40:21 +0000 (-0500) Subject: afs: Change VerifyVCache2 calls to VerifyVCache X-Git-Tag: openafs-devel-1_9_0~49 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=a05d5b7503e466e18f5157006c1de2a2f7d019f7 afs: Change VerifyVCache2 calls to VerifyVCache afs_VerifyVCache is a macro that (on most platforms) effectively expands to: if ((avc->f.states & CStatd)) { return 0; } else { return afs_VerifyVCache2(...); } Some callers call afs_VerifyVCache2 directly, since they already check for CStatd for other reasons. A few callers currently call afs_VerifyVCache2, but without guaranteeing that CStatd is not set. Specifically, in afs_getattr and afs_linux_VerifyVCache, CStatd could be set while afs_CreateReq drops GLOCK. And in afs_linux_readdir, CStatd could be cleared at multiple different points before the VerifyVCache call. This can result in afs_VerifyVCache2 acquiring a write-lock on the vcache, even when CStatd is already set, which is an unnecessary performance hit. To avoid this, change these call sites to use afs_VerifyVCache instead of calling afs_VerifyVCache2 directly, which skips the write lock when CStatd is already set. Change-Id: I7b75c9755af147b42a48160fa90c9849f2f03ddb Reviewed-on: https://gerrit.openafs.org/12655 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 48c25aa..5017ef4 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -171,7 +171,7 @@ afs_linux_VerifyVCache(struct vcache *avc, cred_t **retcred) { code = afs_CreateReq(&treq, credp); if (code == 0) { - code = afs_VerifyVCache2(avc, treq); + code = afs_VerifyVCache(avc, treq); afs_DestroyReq(treq); } @@ -413,7 +413,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) /* update the cache entry */ tagain: - code = afs_convert_code(afs_VerifyVCache2(avc, treq)); + code = afs_convert_code(afs_VerifyVCache(avc, treq)); if (code) goto out; diff --git a/src/afs/VNOPS/afs_vnop_attrs.c b/src/afs/VNOPS/afs_vnop_attrs.c index a22331a..7166bf3 100644 --- a/src/afs/VNOPS/afs_vnop_attrs.c +++ b/src/afs/VNOPS/afs_vnop_attrs.c @@ -248,7 +248,7 @@ afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, afs_ucred_t *acred) if (!(avc->f.states & CStatd)) { if (!(code = afs_CreateReq(&treq, acred))) { - code = afs_VerifyVCache2(avc, treq); + code = afs_VerifyVCache(avc, treq); inited = 1; } } else