Date: Fri, 3 Sep 2021 01:09:05 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: ae322395284d - stable/13 - vfs_hash_insert: ensure that predicate is true Message-ID: <202109030109.183195Ee004856@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ae322395284dc666e41b92beb862ea0c743fcff1 commit ae322395284dc666e41b92beb862ea0c743fcff1 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-08-17 13:47:25 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-09-03 01:08:36 +0000 vfs_hash_insert: ensure that predicate is true (cherry picked from commit 7c1e4aab7934933f0669c2b922976b30ed628a3f) --- sys/kern/vfs_hash.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_hash.c b/sys/kern/vfs_hash.c index e10e9b57e316..c5d67c8b2b33 100644 --- a/sys/kern/vfs_hash.c +++ b/sys/kern/vfs_hash.c @@ -93,8 +93,14 @@ vfs_hash_get(const struct mount *mp, u_int hash, int flags, struct thread *td, error = vget_finish(vp, flags, vs); if (error == ENOENT && (flags & LK_NOWAIT) == 0) break; - if (error) + if (error != 0) return (error); + if (vp->v_hash != hash || + (fn != NULL && fn(vp, arg))) { + vput(vp); + /* Restart the bucket walk. */ + break; + } *vpp = vp; return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109030109.183195Ee004856>