Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 May 2021 18:24:02 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 8a0ec6bd40e8 - stable/13 - fdescfs: allow shared locking of root vnode
Message-ID:  <202105221824.14MIO2wx005991@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=8a0ec6bd40e8f2c451de025d55b1637dde77d982

commit 8a0ec6bd40e8f2c451de025d55b1637dde77d982
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-05-19 15:59:20 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-05-22 18:22:39 +0000

    fdescfs: allow shared locking of root vnode
    
    Eliminates fdescfs from lock profile when running poudriere.
    
    (cherry picked from commit 4fe925b81e75b5885ec6d504c6217f848439164a)
---
 sys/fs/fdescfs/fdesc_vfsops.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c
index e7878f115ac2..64f8d28bdcfd 100644
--- a/sys/fs/fdescfs/fdesc_vfsops.c
+++ b/sys/fs/fdescfs/fdesc_vfsops.c
@@ -107,12 +107,23 @@ fdesc_mount(struct mount *mp)
 		mp->mnt_data = NULL;
 		return (error);
 	}
+	VN_LOCK_ASHARE(rvp);
 	rvp->v_type = VDIR;
 	rvp->v_vflag |= VV_ROOT;
 	fmp->f_root = rvp;
 	VOP_UNLOCK(rvp);
+
+	MNT_ILOCK(mp);
 	/* XXX -- don't mark as local to work around fts() problems */
 	/*mp->mnt_flag |= MNT_LOCAL;*/
+	/*
+	 * Enable shared locking so that there is no contention on the root
+	 * vnode. Note only root vnode enables shared locking for itself,
+	 * so this end up being a nop for the rest.
+	 */
+	mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED;
+	MNT_IUNLOCK(mp);
+
 	vfs_getnewfsid(mp);
 
 	vfs_mountedfrom(mp, "fdescfs");
@@ -163,7 +174,7 @@ fdesc_root(struct mount *mp, int flags, struct vnode **vpp)
 	 * Return locked reference to root.
 	 */
 	vp = VFSTOFDESC(mp)->f_root;
-	vget(vp, LK_EXCLUSIVE | LK_RETRY);
+	vget(vp, flags | LK_RETRY);
 	*vpp = vp;
 	return (0);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105221824.14MIO2wx005991>