From nobody Sun Nov 15 17:28:33 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 4jSHyp14Zlz70k4F for ; Sun, 15 Nov 2026 17:28:34 +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 4jSHyn6mWSz4bR8 for ; Sun, 15 Nov 2026 17:28:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794763714; 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=KYsTRkXxp/tCKK5c14fk26/7LEKaMlpvTW4IxRSAiSs=; b=ad+SFlokWt36Iyzmnf+LZjKuWL1XXOFxqU1fjmVpGsLpJxUA7Jez3MkSFOlwS4qbT8J+pZ aOeSIPWG/3NEt+lPIy3UvdD9OppSWh4B1gEpwD05yPBR7m2sfnqOW95z0aO+/PuTZgW16r g1habtu4Q1NwB0qkCECruFspxP6hFhUkkihAq1Jb8me0MqBjgOihPPyH9DTDcK4AeJ+cBe 0kSyXaANodr4QHlDQFAFyMIDvsbM5O9hDQmdd4zSb2QAbyn91iUTjHlue3caioErVbaVee Wz2Q3keoL7jpX9SzjXO6OeVfPaFTlaKU05J3/PaS8QcCQ8mRm/Um+W2gj8I8Og== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794763714; b=DBs3hhLBEZ2rD8VG3KLO6v2KTVFKeXFPoFwbM8AHJrJMOPQlx865ClWomthSzj2qC2L8Rh cLLWxPHp0ccwTkd9ArDgUmYRUARJggzGa579cWW3qdg616qjr84+sxJEa3mLNcDV+70nwi m/Lk5psG1xikOWzYauvNdShER3Gye4jnKH0YmAPdnEmNcSKepQhyeQtGuhieqW1j6u7CM/ EAjxCBwi45MvfgVa7fUPnBMl3jX8Sng+ZZ/1TZnlpJjqmakx2KbG5ZEukSCtrERrQZ06JX rNdh1GvWWtTZLiSXxkhf+gZb3wwbP8IVeiu5VVaZqTF9GtiB5HAVHA66MF9Inw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794763714; 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=KYsTRkXxp/tCKK5c14fk26/7LEKaMlpvTW4IxRSAiSs=; b=ZgGylMBPvh9pebb70o5A8rT+Z24KBPqbqyj9Ndpc1/UbOVNsSnPeLpZ3SzigNYLKeCKt6H iVjRcM4aUbgVgD08AzJDuXq9cR1iDK0UbmEtVXkPIRytnc7FAJ42eAtd32KIPhERZK/Yqh QUCHWcdde12/x7rXMHQwpETRf+EfgEXfKSaZnW54C2UcZHB53Xjzm8qTe4W/ax6UrrWlT2 NqocvOq9f2Li1pOWQKydlcAnHVJMLd9C5tNwvwD6V4FUrYi4dOzihG6t9DVJbpmFMt3AqX 8HdNwgjPHiVKHOoyb/P6qy3ilZvq3PU3GntzcT/elHuBpfLz0xcbSU2GV1BHsg== 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 4jSHyn685xzGTB for ; Sun, 15 Nov 2026 17:28:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id ab39 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 15 Nov 2026 17:28:33 +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: ea44ef6f5f33 - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: ea44ef6f5f33c4ca0e399c2f5b741232e7832702 Auto-Submitted: auto-generated Date: Sun, 15 Nov 2026 17:28:33 +0000 Message-Id: <6af9ebc1.ab39.2e61b2d8@gitrepo.freebsd.org> The branch stable/15 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=ea44ef6f5f33c4ca0e399c2f5b741232e7832702 commit ea44ef6f5f33c4ca0e399c2f5b741232e7832702 Author: Dag-Erling Smørgrav AuthorDate: 2026-11-05 21:11:30 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-11-14 15:49:21 +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 9e64f3492939..320e690724fa 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -2006,19 +2006,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 @@ -2031,7 +2043,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)) { /*