diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2020-10-16 00:55:57 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2020-10-16 00:55:57 +0000 |
commit | 571bc3d1af2c25f7bd931fc77fe0e3dfd1a0580e (patch) | |
tree | 0646da450f8f416d96fc05cf3c33ac759ec4a265 /sys/kern/vfs_cache.c | |
parent | 640e6162ee80e33d90155b3bb22ab2607da6e160 (diff) | |
download | src-571bc3d1af2c25f7bd931fc77fe0e3dfd1a0580e.tar.gz src-571bc3d1af2c25f7bd931fc77fe0e3dfd1a0580e.zip |
cache: elide vhold/vdrop around promoting negative entry
Notes
Notes:
svn path=/head/; revision=366742
Diffstat (limited to 'sys/kern/vfs_cache.c')
-rw-r--r-- | sys/kern/vfs_cache.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index bf9ddc9bf22c..d402f7757ca8 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3394,9 +3394,6 @@ cache_fplookup_negative_promote(struct cache_fpl *fpl, struct namecache *oncp, cnp = fpl->cnp; dvp = fpl->dvp; - if (!vhold_smr(dvp)) - return (cache_fpl_aborted(fpl)); - nl = NCP2NEGLIST(oncp); cache_fpl_smr_exit(fpl); @@ -3409,6 +3406,10 @@ cache_fplookup_negative_promote(struct cache_fpl *fpl, struct namecache *oncp, /* * Avoid all surprises by only succeeding if we got the same entry and * bailing completely otherwise. + * XXX There are no provisions to keep the vnode around, meaning we may + * end up promoting a negative entry for a *new* vnode and returning + * ENOENT on its account. This is the error we want to return anyway + * and promotion is harmless. * * In particular at this point there can be a new ncp which matches the * search but hashes to a different neglist. @@ -3451,12 +3452,10 @@ cache_fplookup_negative_promote(struct cache_fpl *fpl, struct namecache *oncp, counter_u64_add(numneghits, 1); cache_fpl_smr_exit(fpl); mtx_unlock(&nl->nl_lock); - vdrop(dvp); return (cache_fpl_handled(fpl, ENOENT)); out_abort: cache_fpl_smr_exit(fpl); mtx_unlock(&nl->nl_lock); - vdrop(dvp); return (cache_fpl_aborted(fpl)); } |