Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs Set "mnt_stat.f_f...



details:   https://anonhg.NetBSD.org/src/rev/1f40b86f62e5
branches:  trunk
changeset: 449725:1f40b86f62e5
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Mar 18 09:20:58 2019 +0000

description:
Set "mnt_stat.f_fsid" and "mnt_stat.f_fsidx" from the objset guid
like FreeBSD and Illumos do.

Use "f_fsid" for "va_fsid" and cheat NFSD to export snapshots under
".zfs" by setting these snaphots "f_fsidx" to the parents "f_fsidx".

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c |  6 ++++--
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c |  9 +++++----
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c  |  2 +-
 3 files changed, 10 insertions(+), 7 deletions(-)

diffs (68 lines):

diff -r dabfc4381c15 -r 1f40b86f62e5 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c   Mon Mar 18 09:20:15 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c   Mon Mar 18 09:20:58 2019 +0000
@@ -1335,7 +1335,9 @@
        if (error)
                goto out;
 
-       vfs_getnewfsid(vfsp);
+       /* Set f_fsidx from parent to cheat NFSD. */
+       vfsp->mnt_stat.f_fsidx = vp->v_vfsp->mnt_stat.f_fsidx;
+
        strlcpy(vfsp->mnt_stat.f_mntfromname, osname,
            sizeof(vfsp->mnt_stat.f_mntfromname));
        set_statvfs_info(path, UIO_SYSSPACE, vfsp->mnt_stat.f_mntfromname,
@@ -1622,7 +1624,7 @@
        vap->va_nlink = 2;
        vap->va_uid = 0;
        vap->va_gid = 0;
-       vap->va_fsid = vp->v_vfsp->mnt_stat.f_fsidx.__fsid_val[0];
+       vap->va_fsid = vp->v_vfsp->mnt_stat.f_fsid;
        vap->va_fileid = node->sn_id;
        vap->va_size = 0;
        vap->va_blocksize = 0;
diff -r dabfc4381c15 -r 1f40b86f62e5 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c   Mon Mar 18 09:20:15 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c   Mon Mar 18 09:20:58 2019 +0000
@@ -1374,7 +1374,9 @@
 #endif
 #ifdef __NetBSD__
        vfsp->mnt_stat.f_fsidx.__fsid_val[0] = fsid_guid;
-       vfsp->mnt_stat.f_fsidx.__fsid_val[1] = fsid_guid >> 32;
+       vfsp->mnt_stat.f_fsidx.__fsid_val[1] = ((fsid_guid>>32) << 8) |
+           makefstype(vfsp->mnt_op->vfs_name) & 0xFF;
+       vfsp->mnt_stat.f_fsid = fsid_guid;
 #endif
 
        /*
@@ -1962,8 +1964,6 @@
 #endif
 
 #ifdef __NetBSD__
-       vfs_getnewfsid(vfsp);
-
        /* setup zfs mount info */
        strlcpy(vfsp->mnt_stat.f_mntfromname, osname,
            sizeof(vfsp->mnt_stat.f_mntfromname));
@@ -2036,7 +2036,8 @@
        statp->f_fsid = d32;
 #endif
 #ifdef __NetBSD__
-       statp->f_fsid = vfsp->mnt_stat.f_fsidx.__fsid_val[0];
+       statp->f_fsid = vfsp->mnt_stat.f_fsid;
+       statp->f_fsidx = vfsp->mnt_stat.f_fsidx;
 #endif
 
        /*
diff -r dabfc4381c15 -r 1f40b86f62e5 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Mon Mar 18 09:20:15 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Mon Mar 18 09:20:58 2019 +0000
@@ -3073,7 +3073,7 @@
        vap->va_nodeid = zp->z_id;
 #endif
 #ifdef __NetBSD__
-       vap->va_fsid = vp->v_mount->mnt_stat.f_fsidx.__fsid_val[0];
+       vap->va_fsid = vp->v_mount->mnt_stat.f_fsid;
        vap->va_nodeid = zp->z_id;
        /*
         * If we are a snapshot mounted under .zfs, return



Home | Main Index | Thread Index | Old Index