diff options
author | Mark Johnston <[email protected]> | 2022-10-11 15:29:55 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2022-10-11 12:29:55 -0700 |
commit | ed566bf1cd0bdbf85e8c63c1c119e3d2ef5db1f6 (patch) | |
tree | ce535da84e88c31b85308abc14fce37f9bdfa9c5 /module/os/freebsd | |
parent | 4dcc2bde9c8347fd7969871b69e72cba0b6d4ef7 (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
Diffstat (limited to 'module/os/freebsd')
-rw-r--r-- | module/os/freebsd/zfs/zfs_vfsops.c | 3 |
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 c65be4c13..4cb7f63b5 100644 --- a/module/os/freebsd/zfs/zfs_vfsops.c +++ b/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)); |