git: 0d9e99ce3b10 - main - vfs: add the missing vnode interlock in vfs_mountroot_shuffle

Mateusz Guzik mjg at FreeBSD.org
Sat Sep 18 19:15:27 UTC 2021


The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=0d9e99ce3b1071c76ff5a2d9d4158341c0371c2f

commit 0d9e99ce3b1071c76ff5a2d9d4158341c0371c2f
Author:     Mateusz Guzik <mjg at FreeBSD.org>
AuthorDate: 2021-09-18 08:12:27 +0000
Commit:     Mateusz Guzik <mjg at FreeBSD.org>
CommitDate: 2021-09-18 19:13:51 +0000

    vfs: add the missing vnode interlock in vfs_mountroot_shuffle
    
    Around v_mountedhere assignment.
---
 sys/kern/vfs_mountroot.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c
index e2a687511e11..5cf222901420 100644
--- a/sys/kern/vfs_mountroot.c
+++ b/sys/kern/vfs_mountroot.c
@@ -367,10 +367,12 @@ vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs)
 				error = vinvalbuf(vp, V_SAVE, 0, 0);
 			if (!error) {
 				cache_purge(vp);
+				VI_LOCK(vp);
 				mporoot->mnt_vnodecovered = vp;
 				vp->v_mountedhere = mporoot;
 				strlcpy(mporoot->mnt_stat.f_mntonname,
 				    fspath, MNAMELEN);
+				VI_UNLOCK(vp);
 				VOP_UNLOCK(vp);
 			} else
 				vput(vp);


More information about the dev-commits-src-main mailing list