aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-08-18 11:14:42 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-08-27 15:39:45 +0000
commitf19063ab029b067e1763780aebca4bd620453110 (patch)
treebe315dcc41be7d4c15a537c8f005802410ab8649
parent7c1e4aab7934933f0669c2b922976b30ed628a3f (diff)
vfs_hash_rehash(): require the vnode to be exclusively locked
Rehash updates v_hash. Also, rehash moves the vnode to different hash bucket, which should be noticed in vfs_hash_get() after sleeping for the vnode lock. Reviewed by: mckusick, rmacklem Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31464
-rw-r--r--sys/kern/vfs_hash.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/kern/vfs_hash.c b/sys/kern/vfs_hash.c
index c5d67c8b2b33..2e446e69a314 100644
--- a/sys/kern/vfs_hash.c
+++ b/sys/kern/vfs_hash.c
@@ -196,6 +196,7 @@ vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td,
void
vfs_hash_rehash(struct vnode *vp, u_int hash)
{
+ ASSERT_VOP_ELOCKED(vp, "rehash requires excl lock");
rw_wlock(&vfs_hash_lock);
LIST_REMOVE(vp, v_hashlist);