Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Nov 2022 20:33:38 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 7ab877cb3f9d - releng/13.1 - zfs: Fix a pair of bugs in zfs_fhtovp()
Message-ID:  <202211012033.2A1KXcot026205@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch releng/13.1 has been updated by markj:

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

commit 7ab877cb3f9d55a394e43a2c1a1e2711df12226d
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-10-24 15:55:48 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-11-01 13:28:11 +0000

    zfs: Fix a pair of bugs in zfs_fhtovp()
    
    This cherry-picks upstream ed566bf1cd0bdbf85e8c63c1c119e3d2ef5db1f6
    
        - Add a zfs_exit() call in an error path, otherwise a lock is
          leaked.
        - Remove the fid_gen > 1 check.  That appears to be Linux-specific:
          zfsctl_snapdir_fid() sets fid_gen to 0 or 1 depending on whether
          the snapshot directory is mounted.  On FreeBSD it fails, making
          snapshot dirs inaccessible via NFS.
    
    Approved by:    so
    PR:             266236
    Security:       FreeBSD-EN-22:24.zfs
    
    (cherry picked from commit 6fe0a6c80a1aff14236924eb33e4013aa8c14f91)
    (cherry picked from commit 562c9ac58c7678b13f52b0bfe63148e40d7bf63d)
---
 sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c
index cdd762dcbcbf..05d41d4e3b2a 100644
--- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c
+++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c
@@ -1845,7 +1845,8 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int flags, vnode_t **vpp)
 		return (SET_ERROR(EINVAL));
 	}
 
-	if (fidp->fid_len == LONG_FID_LEN && (fid_gen > 1 || setgen != 0)) {
+	if (fidp->fid_len == LONG_FID_LEN && setgen != 0) {
+		ZFS_EXIT(zfsvfs);
 		dprintf("snapdir fid: fid_gen (%llu) and setgen (%llu)\n",
 		    (u_longlong_t)fid_gen, (u_longlong_t)setgen);
 		return (SET_ERROR(EINVAL));



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