Skip to content

Commit

Permalink
FreeBSD: Fix a pair of bugs in zfs_fhtovp()
Browse files Browse the repository at this point in the history
- 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.

Fixes: 43dbf88 ("FreeBSD: vfsops: use setgen for error case")
Signed-off-by: Mark Johnston <[email protected]>
(cherry picked from commit ffea814)
  • Loading branch information
markjdb authored and Ryan Moeller committed Oct 11, 2022
1 parent 2a383a9 commit f81b9b9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion module/os/freebsd/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit f81b9b9

Please sign in to comment.