Date: Wed, 26 Aug 2020 12:54:18 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364816 - head/sys/kern Message-ID: <202008261254.07QCsIbx027944@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Wed Aug 26 12:54:18 2020 New Revision: 364816 URL: https://svnweb.freebsd.org/changeset/base/364816 Log: 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. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Wed Aug 26 12:53:16 2020 (r364815) +++ head/sys/kern/vfs_cache.c Wed Aug 26 12:54:18 2020 (r364816) @@ -1134,8 +1134,15 @@ cache_zap_locked_vnode(struct namecache *ncp, struct v 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008261254.07QCsIbx027944>