From nobody Fri Nov 17 22:35:04 2023 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SXBYX6QVPz51SFQ for ; Fri, 17 Nov 2023 22:35:12 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (tunnel82308-pt.tunnel.tserv4.nyc4.ipv6.he.net [IPv6:2001:470:1f06:ccb::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "garrett.wollman.name", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SXBYX47Dxz4Hcq for ; Fri, 17 Nov 2023 22:35:12 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Authentication-Results: mx1.freebsd.org; none Received: from hergotha.csail.mit.edu (localhost [127.0.0.1]) by hergotha.csail.mit.edu (8.17.1/8.17.1) with ESMTPS id 3AHMZ7NY095960 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 17 Nov 2023 17:35:10 -0500 (EST) (envelope-from wollman@hergotha.csail.mit.edu) Received: (from wollman@localhost) by hergotha.csail.mit.edu (8.17.1/8.17.1/Submit) id 3AHMZ7c9095959; Fri, 17 Nov 2023 17:35:07 -0500 (EST) (envelope-from wollman) List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <25943.60056.880614.452966@hergotha.csail.mit.edu> Date: Fri, 17 Nov 2023 17:35:04 -0500 From: Garrett Wollman To: Mike Karels Cc: freebsd-stable@freebsd.org Subject: Re: NFS exports of ZFS snapshots broken In-Reply-To: References: <25943.54632.572766.121032@hergotha.csail.mit.edu> X-Mailer: VM 8.2.0b under 28.2 (amd64-portbld-freebsd13.2) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.4 (hergotha.csail.mit.edu [0.0.0.0]); Fri, 17 Nov 2023 17:35:10 -0500 (EST) X-Spam-Status: No, score=-4.9 required=5.0 tests=ALL_TRUSTED, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on hergotha.csail.mit.edu X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Queue-Id: 4SXBYX47Dxz4Hcq < said: > I have not run into this, so I tried it just now. I had no problem. > The server is 13.2, fully patched, the client is up-to-date -current, > and the mount is v4. On my 13.2 client and 13-stable server, I see: 25034 ls CALL open(0x237d32f9a000,0x120004) 25034 ls NAMI "/mnt/tools/.zfs/snapshot/weekly-2023-45" 25034 ls RET open 4 25034 ls CALL fcntl(0x4,F_ISUNIONSTACK,0x0) 25034 ls RET fcntl 0 25034 ls CALL getdirentries(0x4,0x237d32faa000,0x1000,0x237d32fa7028) 25034 ls RET getdirentries -1 errno 5 Input/output error 25034 ls CALL close(0x4) 25034 ls RET close 0 25034 ls CALL exit(0) Certainly a libc bug here that getdirentries(2) returning [EIO] results in ls(1) returning EXIT_SUCCESS, but the [EIO] error is consistent across both FreeBSD and Linux clients. Looking at this from the RPC side: (PUTFH, GETATTR, LOOKUP(snapshotname), GETFH, GETATTR) [NFS4_OK for all ops] (PUTFH, GETATTR) [NFS4_OK, NFS4_OK] (PUTFH, ACCESS(0x3f), GETATTR) [NFS4_OK, NFS4_OK, rights = 0x03, NFS4_OK] (PUTFH, GETATTR, LOOKUPP, GETFH, GETATTR) [NFS4_OK, NFS4_OK, NFS4ERR_NOFILEHANDLE] and at this point the [EIO] is returned. It seems that clients always do a LOOKUPP before calling READDIR, and this is failing when the subject file handle is the snapshot. The client is perfectly able to *traverse into* the snapshot: if I try to list a subdirectory I know exists in the snapshot, the client is able to LOOKUP(dirname) just fine, but LOOKUPP still fails with NFS4ERR_NOFILEHANDLE *on the subndirectory*. -GAWollman