git: 6b69465efb48 - main - vfs_domount(): ensure that v_mountedhere and VIRF_MOUNTPOINT are set under the vnode lock
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 29 Oct 2022 11:30:31 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=6b69465efb48029e617282dcea5aac3e51e5e3d4
commit 6b69465efb48029e617282dcea5aac3e51e5e3d4
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-10-27 20:22:43 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-10-29 11:29:55 +0000
vfs_domount(): ensure that v_mountedhere and VIRF_MOUNTPOINT are set under the vnode lock
Fixes: f7833196bd6ba9bfc060a41b353422b15d6aa95b
Reported and tested by: pho
Reviewed by: jah, markj (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37198
---
sys/kern/vfs_mount.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 31566f521d22..f49312ed4f57 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1201,10 +1201,16 @@ vfs_domount_first(
mp->mnt_kern_flag &= ~MNTK_ASYNC;
MNT_IUNLOCK(mp);
+ /*
+ * VIRF_MOUNTPOINT and v_mountedhere need to be set under the
+ * vp lock to satisfy vfs_lookup() requirements.
+ */
+ VOP_LOCK(vp, LK_EXCLUSIVE | LK_RETRY);
VI_LOCK(vp);
vn_irflag_set_locked(vp, VIRF_MOUNTPOINT);
vp->v_mountedhere = mp;
VI_UNLOCK(vp);
+ VOP_UNLOCK(vp);
cache_purge(vp);
/*