From nobody Thu Sep 4 01:51:52 2025 X-Original-To: dev-commits-src-main@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 4cHMsj1QZlz66YgZ; Thu, 04 Sep 2025 01:51:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cHMsj0qtTz3FDZ; Thu, 04 Sep 2025 01:51:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756950713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wMDsq9ui9BuHcmlxmXyE7Ge2Nt11ndV0LVKMU+nsDuI=; b=SiqZJPXTy67xa5yvZgSWzo/jfVa1ayTp9SZTOMQCn20hPgS3DIXCnZq3lUgeJuUbr6vVzO kABeHrwSwUXPcOEN1o2UPtzebGR8b33QyusBeb9AwoiqyiNl8j9DxkpbcgkeWgF292yfEZ 1kHmOr6X7/kvvWTKZxe1GGyYoSU7dafO29pc88B4RLcWdbGQx/8ZLxou4zCu9rcQ6Xq1rT a/EwlaNHw8tkjj8cqXoDjNGNzuNN/Tj21ocI7kQTal4atgfwdsKqUpdUrag5wLaYDFY9Wi dxJ7WIR1VZr1ZKsU444M0PiTv4/UZqu81l9U8+ceCt7OLTGAABPcG31z1sY+/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756950713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wMDsq9ui9BuHcmlxmXyE7Ge2Nt11ndV0LVKMU+nsDuI=; b=tzYK19QjltHNAVXEnila9ykvM80NZHGyvhrHlXp+QaDWAPDVkI3D2f+AjebhLua3ILY6o5 6MC1n/2cbqefNn5Zi1Nwdcxr3qDH0S8pMlCrM9z8I6tk3iPHhxOkVS0bLWUXkwJnlcCVPK gfIMGiWFkn+/xImQhtohi9caRR2elD8mL7nskR2Ra4D0RqPv52trmuL4if1U/fyBTeTIEm VeV4/k9NCSWb2m0mkmNXFcNFb8c4ig7Imnf1NBC0TOSmBXRY3tNhPOAA7uuCPcCymjS58s XiBFfKcFGtbG7S7JxyPmvJnGcxF/8ISc6Z6mCC0D/uQNlIVmO12s4pocfI90jA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1756950713; a=rsa-sha256; cv=none; b=hj7y4ez8kGutECOFSKswKsz/wa7pcdzvVSr6BDRxs82cWhg4Zrg+IXRUsY2YkAwvmv2OCn BDSYxvOMszSHG47KBFRqdJvQfVdtQKmEGMttfFHsMFTZoWIaI6ca+hXbaf0x4VpGAQV5vp +/5gjhj+dmDfYKuKMDDVYh0PZrzcSnj/cGC+yn+w5qwqyX2G49FGXzEIK0HTbTD1hMYRm9 5H0LgLF3waD4yypq1XYXSv+OwdJHqA3OvTD78YyIcKRzQD21K/oHnSoJVKObA0uMm3ee3t ERqswXBXblXyNM9mQrnjSbig0yLo8qyHl16dpT1Dk93k9z2T9CLWcOYIbqPjhA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cHMsj09QLzhn4; Thu, 04 Sep 2025 01:51:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5841pq7h084933; Thu, 4 Sep 2025 01:51:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5841pqCo084930; Thu, 4 Sep 2025 01:51:52 GMT (envelope-from git) Date: Thu, 4 Sep 2025 01:51:52 GMT Message-Id: <202509040151.5841pqCo084930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 1c52d525f064 - main - nfsd: Fix the NFSv4 Readdir operation for an empty ZFS dir List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c52d525f06411726d7755081f904de64749eb9b Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=1c52d525f06411726d7755081f904de64749eb9b commit 1c52d525f06411726d7755081f904de64749eb9b Author: Rick Macklem AuthorDate: 2025-09-04 01:48:52 +0000 Commit: Rick Macklem CommitDate: 2025-09-04 01:48:52 +0000 nfsd: Fix the NFSv4 Readdir operation for an empty ZFS dir Commit 9a3edc8 modified the behaviour of ZFS's VOP_READDIR() such that it will reply EINVAL for an offset past EOF on the directory. This exposed a latent bug in the NFSv4 Readdir code, which would attempt a Readdir with an offset beyond EOF for a directory that consists of only "." and "..". This happened because NFSv4 does not reply "." or ".." to the client and, after skipping over them, attempted another VOP_READDIR(). This patch fixes the problem by checking the eofflag for the case where all entries have been skipped over. Reviewed by: kib MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D52370 --- sys/fs/nfsserver/nfs_nfsdport.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index b2966934f9b7..7040c4afb797 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -2607,6 +2607,7 @@ again: * rpc reply */ if (siz == 0) { +ateof: vput(vp); if (nd->nd_flag & ND_NFSV3) nfsrv_postopattr(nd, getret, &at); @@ -2648,6 +2649,8 @@ again: ncookies--; } if (cpos >= cend || ncookies == 0) { + if (eofflag != 0) + goto ateof; siz = fullsiz; toff = off; goto again;