summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorMark Johnston <[email protected]>2022-10-11 15:29:55 -0400
committerBrian Behlendorf <[email protected]>2022-10-26 14:59:25 -0700
commit4e3fecbdfd54e8fbd4b591e5a975b5a99a366bcf (patch)
tree4e3c0189589c0f87c44f6ec9552fcf34af6beb8a /module
parentfc1c0053f9c6fd8e894c3378b489fa817f5d0330 (diff)
FreeBSD: Fix a pair of bugs in zfs_fhtovp()
- 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. Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Andriy Gapon <[email protected]> Signed-off-by: Mark Johnston <[email protected]> Fixes: 43dbf8817808 ("FreeBSD: vfsops: use setgen for error case") Closes #14001 Closes #13974 (cherry picked from commit ed566bf1cd0bdbf85e8c63c1c119e3d2ef5db1f6)
Diffstat (limited to 'module')
-rw-r--r--module/os/freebsd/zfs/zfs_vfsops.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/module/os/freebsd/zfs/zfs_vfsops.c b/module/os/freebsd/zfs/zfs_vfsops.c
index cdd762dcb..05d41d4e3 100644
--- a/module/os/freebsd/zfs/zfs_vfsops.c
+++ b/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));