[Bug 266236] ZFS NFS : .zfs/snapshot : Stale file handle

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 06 Oct 2022 15:57:12 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266236

--- Comment #12 from Mark Johnston <markj@FreeBSD.org> ---
I can reproduce this with a loopback NFSv3 mount of a dataset containing a
snapshot.  Some dtracing shows the ESTALE comes from nfs_access(), the RPC is
returning the error because it can't translate the file handle to a vnode.  In
particular, I can see zfs_fhtovp() is returning EINVAL when dealing with a
"long" FID, used for files under .zfs/snapshot.

  1  70351                 zfs_fhtovp:entry fid_t {
    u_short fid_len = 0x12 <-- LONG_FID_LEN
    u_short fid_data0 = 0x22
    char [16] fid_data = [ "" ]
}
  1  70352                zfs_fhtovp:return nfsd 22
              kernel`nfsvno_fhtovp+0x3d
              kernel`nfsrvd_dorpc+0x120
              kernel`nfssvc_program+0x68c
              kernel`svc_run_internal+0xb4f
              kernel`svc_thread_start+0xb
              kernel`fork_exit+0x7e
              kernel`0xffffffff8107803e

With DTrace I can see that vfs_hash_get() and VOP_LOOKUP are not getting called
from zfs_fhtovp(), which means the error is probably coming from a recently
added check:

1821         if (fidp->fid_len == LONG_FID_LEN && (fid_gen > 1 || setgen != 0))
{
1822                 dprintf("snapdir fid: fid_gen (%llu) and setgen (%llu)\n",
1823                     (u_longlong_t)fid_gen, (u_longlong_t)setgen);
1824                 return (SET_ERROR(EINVAL));
1825         }

That came in with https://github.com/openzfs/zfs/pull/12905 but let me see
first if that really is the source of the error.

-- 
You are receiving this mail because:
You are the assignee for the bug.