Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Oct 2023 00:46:30 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: be2333b68d71 - stable/14 - nmount(MNT_UPDATE): add optional generid fsid parameter
Message-ID:  <202310240046.39O0kU8X004336@gitrepo.freebsd.org>

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

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

commit be2333b68d71bea99768749db3057f4fd66f9d5d
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-09-29 18:42:50 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-10-24 00:46:01 +0000

    nmount(MNT_UPDATE): add optional generid fsid parameter
    
    (cherry picked from commit 9ef7a491a4236810e50f0a2ee8d52f5c4bb02c64)
---
 sys/kern/vfs_mount.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 8364081585f8..aa4642c0ba8c 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1313,9 +1313,10 @@ vfs_domount_update(
 	struct vnode *rootvp;
 	void *bufp;
 	struct mount *mp;
-	int error, export_error, i, len;
+	int error, export_error, i, len, fsid_up_len;
 	uint64_t flag;
 	gid_t *grps;
+	fsid_t *fsid_up;
 	bool vfs_suser_failed;
 
 	ASSERT_VOP_ELOCKED(vp, __func__);
@@ -1378,10 +1379,24 @@ vfs_domount_update(
 	VI_UNLOCK(vp);
 	VOP_UNLOCK(vp);
 
+	rootvp = NULL;
+
+	if (vfs_getopt(*optlist, "fsid", (void **)&fsid_up,
+	    &fsid_up_len) == 0) {
+		if (fsid_up_len != sizeof(*fsid_up)) {
+			error = EINVAL;
+			goto end;
+		}
+		if (fsidcmp(&fsid_up, &mp->mnt_stat.f_fsid) != 0) {
+			error = ENOENT;
+			goto end;
+		}
+		vfs_deleteopt(*optlist, "fsid");
+	}
+
 	vfs_op_enter(mp);
 	vn_seqc_write_begin(vp);
 
-	rootvp = NULL;
 	MNT_ILOCK(mp);
 	if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0) {
 		MNT_IUNLOCK(mp);



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