From nobody Sun Sep 7 01:33:46 2025 X-Original-To: dev-commits-src-all@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 4cKCKQ2GfCz65xfq; Sun, 07 Sep 2025 01:33:46 +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 4cKCKQ1jtYz3bnH; Sun, 07 Sep 2025 01:33:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757208826; 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=UynZx6amBSv+d4dw1owwLaRu6YbESc77GXueJL4klB8=; b=mT+yZI5Rm13YjF4iv+NsJ8t5Jx0j/QNoFNpgvbloZXItfU2J0B9Xn2De4qbwQ3FP7rKl7E 8V2fRN9FD9ck59Dd5c0ukh0vDIHmIzLNzBeDfEG/dqq+Uy1beiyLO6AK5JU/ghc044CnVP E5Ms8qGZC6FcYXtQMjWhC/NrDOvoyENY52sIYDa8XtUt+o0S0NYA4jNsVPaxYHGQQhYK2y qjvFTh+pk1deLl47N66ty+KTJTAVTWEqu1b7cBZAoH7ZY32pEUuNBjfQDELjqU5Gwdvreb 0cdzTPjO1Us5jNxZ2mITuFoY/D3gR/2vXrWrwF9XF/yYndmrjEZpTFYRoZmCAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757208826; 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=UynZx6amBSv+d4dw1owwLaRu6YbESc77GXueJL4klB8=; b=cFOWFD4rh7gHVrmsyG2N1LPF/RMfXEMBjaBs61wwKmomfF0LF0qpDX7Z8oce4j+8TGdwML dMLKZ1tYFxb+gF6xylmMrVpg3RCAuCHOv8vVcx0DvFlCY2+DCRRJFp8kW6LAX51GPmNSf3 S14l5OwqPQ4jMLqbj5gm4OGvKO3ZwZGtVXwD7zPnpuZ+klI9edTdKujMoYU9MTGHD1CZUm g9ptMF2zJ5hyPxL3xD4cPrBSz+y4qKD5+gWGo4veWsmeNJT/mdsjh6zc1ASbUWzeooM+XC OCmdHRzLoJiqj424dApPSPQawm5ZycCgLac6OVhiy/LbaUWQHwInKp37GA3q1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757208826; a=rsa-sha256; cv=none; b=WaIq2QK8Foc7yoQu4bwcLEIFK8yHbAS5dcMSWy4hiZjj4FbriJGmzK1YpeXsUImU3QRxsE MMKqNZz+0PwyteZIRn1cD4N7lOjJUcMPc6+EKhG/1KpgZjvjyik611uvMMVg3PRTQ15QDh WY+I5IWym1+rXMSc+ox0VrwFQSrcyJIA0Gi50rk/qq87PIS4ONQKq2hXLsdMwGSo4sTZbe lrEWjukpwKjL4R6sFK5HG35M9fpGEGgMA1bEeOXRjp7VWMTEksL/MFiL87Xz3nlh7oRY2p 1akD7qLd2adMHawrFXupaLJYfjnk0jBTwcPOBh5VIrVzzD3e4zKhtUsIELW9Uw== 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 4cKCKQ1Gnpzyp1; Sun, 07 Sep 2025 01:33:46 +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 5871XkQX074325; Sun, 7 Sep 2025 01:33:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5871XkGJ074322; Sun, 7 Sep 2025 01:33:46 GMT (envelope-from git) Date: Sun, 7 Sep 2025 01:33:46 GMT Message-Id: <202509070133.5871XkGJ074322@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: b84156e7f136 - stable/14 - nfsd: Fix the NFSv4 Readdir operation for an empty ZFS dir List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: b84156e7f136792d3a34f5338635e5b41b256b4f Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b84156e7f136792d3a34f5338635e5b41b256b4f commit b84156e7f136792d3a34f5338635e5b41b256b4f Author: Rick Macklem AuthorDate: 2025-09-04 01:48:52 +0000 Commit: Rick Macklem CommitDate: 2025-09-07 01:31:05 +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 (cherry picked from commit 1c52d525f06411726d7755081f904de64749eb9b) --- 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 c22d06ef0aeb..58107029c8c3 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -2496,6 +2496,7 @@ again: * rpc reply */ if (siz == 0) { +ateof: vput(vp); if (nd->nd_flag & ND_NFSV3) nfsrv_postopattr(nd, getret, &at); @@ -2537,6 +2538,8 @@ again: ncookies--; } if (cpos >= cend || ncookies == 0) { + if (eofflag != 0) + goto ateof; siz = fullsiz; toff = off; goto again;