From nobody Sun Nov 15 17:28:44 2026 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 4jSHz12Hwrz70k1w for ; Sun, 15 Nov 2026 17:28:45 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jSHz10qk6z4bXR for ; Sun, 15 Nov 2026 17:28:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794763725; 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=GDBJI8X88m27FtOB8IuUlA414s35TbkOvD7xkB8E/OA=; b=BLXCdZRh/AMflFgJB046msbL/P/x8bBzPaFgvXPgiGEEDSrD71sh9/jLS5p/X+xH0uY9tk anh1/A74h4aeRK3mP8sD9crZx0/BBQGojKGtiJiXa2ZJzJOU/JNI19K/5GyczBSO0DfNMI 7AO5bgJ5VpO6ryReo/GCd9TIm4cJs8TaUC7o3M6xEBx66JYo+DOSCNQ+7wcZBcceiZ6wMx aKzH89SuyjKJf1bnl1Md+NcNhCRFEkFsdeqVsqC3SaEzVsA5QuSxs2uR4h2riiP9PS86la 8l4zIvxot2ODrWAzdUcl/Yro8J02F87IE+55c0py/Bn2a4jZt1noZByOp8HUMQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794763725; b=eIWN1pO9eiWW1ZP3U6bDfM4rHuuVIf1oW5b6ktRcgZMVihNDNu+E3w3EOd+IjELRunRZL9 TIyxZcU6R6uph0G1AJ+e757H4PGShbroMkILWyQze1eWo+ehvLq4oJW27jLgLqAdIzj9Dz 0/QGNbt+zxNuxaqevDaxszFRePIhKKKATCWlzKk4vuKh8wA5zV5/n8KFzddMQHdVT4Xx3O rVlERNWHM02MYYaU6utzNC+UoWuqwJ3lhhNSq5tvZhN2/9n4gDBck2O0kg/Me8jMvusGKU x6+W5hP8vbjHeh172lx92ymZhESRFesJPdLzaJ2zbsbPa16j90e1txLeI0SNJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794763725; 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=GDBJI8X88m27FtOB8IuUlA414s35TbkOvD7xkB8E/OA=; b=Xvevb0Ddhl1UujoGJI2FiBwAujUgwD/WR7MNpVZnb+b/JEjjfOd7vgD+a37sLQohDw98Xc uNu+ii4SS8gSVbdMJu2cTY0030GO/PVhh4gmgNLKPSFDquGzcMWN4CAh5yOGx/GewICGtO GheWQhqfT5xdkI3eFW9y7OwyiDbGac5nQ8RlS4dIHZ8BmSALqYEv1rltcqTOChkd2xZgug /LUcPpWYO5MTSdF3iCgTnvTnrH3aVtl4m9AskchxcJDngqiOdfuPlKljzozrFnchTmfqjZ bAM/P8kGpQrx9aMXVZYtesyLZt5VN8Zg+3B7yw/nDO+M/AkLDQ/LPZ2F8Sk0QA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jSHz06YnKzGwy for ; Sun, 15 Nov 2026 17:28:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id c363 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 15 Nov 2026 17:28:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 7acddb73c1cb - stable/14 - nfsserver: Do not increment seqid on BADSEQID List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 7acddb73c1cbcca010a7f3f635c96c8547158c53 Auto-Submitted: auto-generated Date: Sun, 15 Nov 2026 17:28:44 +0000 Message-Id: <6af9ebcc.c363.390af99f@gitrepo.freebsd.org> The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=7acddb73c1cbcca010a7f3f635c96c8547158c53 commit 7acddb73c1cbcca010a7f3f635c96c8547158c53 Author: Dag-Erling Smørgrav AuthorDate: 2026-11-05 21:11:30 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-11-14 15:49:23 +0000 nfsserver: Do not increment seqid on BADSEQID When returning NFSERR_BADSEQID, the server should not have incremented the sequence ID, yet the call to nfsrv_checkseqid() a few lines above does precisely that. Instead, check for a legitimate retransmission of the original successful request, and reject otherwise, before the ticket is used and sequence ID incremented. MFC after: 1 week Fixes: ff45b9fc1a8c ("Bjorn reported a problem...") Sponsored by: Klara, Inc. Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D61156 (cherry picked from commit 878084c774c6d68fcdb65e00ba8f74726dda0999) --- sys/fs/nfsserver/nfs_nfsdstate.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 8b4bb7e0249e..e7ca9598955e 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -2001,19 +2001,31 @@ tryagain: if (error == 0) { if (new_stp->ls_flags & NFSLCK_OPENTOLOCK) { + if (stp->ls_flags & NFSLCK_OPEN) + nfsrv_getowner(&stp->ls_open, new_stp, &lckstp); /* * If haslock set, we've already checked the seqid. */ if (!haslock) { - if (stp->ls_flags & NFSLCK_OPEN) - error = nfsrv_checkseqid(nd, new_stp->ls_seq, - stp->ls_openowner, new_stp->ls_op); - else + if (stp->ls_flags & NFSLCK_OPEN) { + /* + * A new NFSv4.0 request cannot reuse a lock + * owner. Reject it before checkseqid consumes + * the open seqid and replaces the cached reply. + * The current seqid may be a retransmission of + * the original LOCK; let checkseqid validate it. + */ + if (lckstp != NULL && + (nd->nd_flag & ND_NFSV41) == 0 && + new_stp->ls_seq != stp->ls_openowner->ls_seq) + error = NFSERR_BADSEQID; + else + error = nfsrv_checkseqid(nd, new_stp->ls_seq, + stp->ls_openowner, new_stp->ls_op); + } else error = NFSERR_BADSTATEID; } - if (!error) - nfsrv_getowner(&stp->ls_open, new_stp, &lckstp); - if (lckstp) { + if (!error && lckstp) { /* * For NFSv4.1 and NFSv4.2 allow an * open_to_lock_owner when the lock_owner already @@ -2026,7 +2038,7 @@ tryagain: new_stp->ls_flags &= ~NFSLCK_OPENTOLOCK; else error = NFSERR_BADSEQID; - } else + } else if (lckstp == NULL) lckstp = new_stp; } else if (new_stp->ls_flags&(NFSLCK_LOCK|NFSLCK_UNLOCK)) { /*