git: 4fe925b81e75 - main - fdescfs: allow shared locking of root vnode
Mateusz Guzik
mjg at FreeBSD.org
Wed May 19 17:59:29 UTC 2021
The branch main has been updated by mjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=4fe925b81e75b5885ec6d504c6217f848439164a
commit 4fe925b81e75b5885ec6d504c6217f848439164a
Author: Mateusz Guzik <mjg at FreeBSD.org>
AuthorDate: 2021-05-19 15:59:20 +0000
Commit: Mateusz Guzik <mjg at 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);
}
More information about the dev-commits-src-main
mailing list