Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 May 2021 17:59:28 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4fe925b81e75 - main - fdescfs: allow shared locking of root vnode
Message-ID:  <202105191759.14JHxSOv021658@gitrepo.freebsd.org>

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

URL: https://cgit.FreeBSD.org/src/commit/?id=4fe925b81e75b5885ec6d504c6217f848439164a

commit 4fe925b81e75b5885ec6d504c6217f848439164a
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-05-19 15:59:20 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-05-19 17:58:54 +0000

    fdescfs: allow shared locking of root vnode
    
    Eliminates fdescfs from lock profile when running poudriere.
---
 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?202105191759.14JHxSOv021658>