Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Oct 2023 00:47:47 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: 321af2d24da0 - stable/13 - nmount(MNT_UPDATE): add optional generid fsid parameter
Message-ID:  <202310240047.39O0llqL005021@gitrepo.freebsd.org>

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

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

commit 321af2d24da0a54612f473afca2d3fec5820132f
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:47:19 +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 25c4adeaae62..a4a981603ab6 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1154,9 +1154,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__);
@@ -1219,10 +1220,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?202310240047.39O0llqL005021>