diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2020-08-26 12:54:18 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2020-08-26 12:54:18 +0000 |
commit | 1e9a0b391d88e0f9a9cb5b1d49aba61f80ae97f5 (patch) | |
tree | f919bd00bcab30604880cb3e9a5dc87f8623c621 | |
parent | 075f58f2319688420d8c4a70e333dd5d8e3c6816 (diff) | |
download | src-1e9a0b391d88e0f9a9cb5b1d49aba61f80ae97f5.tar.gz src-1e9a0b391d88e0f9a9cb5b1d49aba61f80ae97f5.zip |
cache: relock on failure in cache_zap_locked_vnode
This gets rid of bogus scheme of yielding in hopes the blocking thread will
make progress.
Notes
Notes:
svn path=/head/; revision=364816
-rw-r--r-- | sys/kern/vfs_cache.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 5ac88c0b2774..2c20065c8ba0 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -1134,8 +1134,15 @@ cache_zap_locked_vnode(struct namecache *ncp, struct vnode *vp) to_unlock = vlp2; } else { if (!mtx_trylock(vlp1)) { - error = EAGAIN; - goto out; + /* + * TODO: Very wasteful but rare. + */ + mtx_unlock(pvlp); + mtx_lock(vlp1); + mtx_lock(vlp2); + mtx_unlock(vlp2); + mtx_unlock(vlp1); + return (EAGAIN); } to_unlock = vlp1; } @@ -1377,7 +1384,6 @@ negative_success: error = cache_zap_locked_vnode(ncp, dvp); if (__predict_false(error != 0)) { zap_and_exit_bucket_fail2++; - cache_maybe_yield(); goto retry; } cache_free(ncp); @@ -1465,7 +1471,6 @@ retry: error = cache_zap_locked_bucket(ncp, cnp, hash, blp); if (__predict_false(error != 0)) { zap_and_exit_bucket_fail++; - cache_maybe_yield(); goto retry; } counter_u64_add(numposzaps, 1); @@ -1584,7 +1589,6 @@ negative_success: error = cache_zap_locked_vnode(ncp, dvp); if (__predict_false(error != 0)) { zap_and_exit_bucket_fail2++; - cache_maybe_yield(); goto retry; } cache_free(ncp); |