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 <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
code = afs_CreateReq(&treq, credp);
if (code == 0) {
- code = afs_VerifyVCache2(avc, treq);
+ code = afs_VerifyVCache(avc, treq);
afs_DestroyReq(treq);
}
/* 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;
if (!(avc->f.states & CStatd)) {
if (!(code = afs_CreateReq(&treq, acred))) {
- code = afs_VerifyVCache2(avc, treq);
+ code = afs_VerifyVCache(avc, treq);
inited = 1;
}
} else