aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2022-10-24 15:55:48 +0000
committerMark Johnston <markj@FreeBSD.org>2022-10-24 16:05:17 +0000
commit6fe0a6c80a1aff14236924eb33e4013aa8c14f91 (patch)
tree87a3701ac230b555576912cabb2f46df4049cdd6 /sys
parentba23f762ece54a86f64b8ef62bbfc9c73c98762c (diff)
downloadsrc-6fe0a6c80a1aff14236924eb33e4013aa8c14f91.tar.gz
src-6fe0a6c80a1aff14236924eb33e4013aa8c14f91.zip
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. PR: 266236 MFC after: 3 days
Diffstat (limited to 'sys')
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c3
1 files changed, 2 insertions, 1 deletions
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 c65be4c134d5..4cb7f63b5230 100644
--- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c
+++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c
@@ -1818,7 +1818,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, FTAG);
dprintf("snapdir fid: fid_gen (%llu) and setgen (%llu)\n",
(u_longlong_t)fid_gen, (u_longlong_t)setgen);
return (SET_ERROR(EINVAL));