From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0F5836D9FA; Thu, 11 Jun 2026 20:01:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781208069; cv=none; b=S/OdEGzJfcMFl1Jz/AOOGy4fhEiqO+yj7hjJXBxueNeMZUXfpayqWPs1FOUclSmMN9O/cJOCrDzTSMDgdn4ItbBHstdX0TEHKjKjE2LG7xlaEW9w8dMQ+FyNG4it3RbLarHstctUK93JtPXCXK0LxElYG4oMIVfEJn4MQ4L1NpI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781208069; c=relaxed/simple; bh=CcG6OUziAhXqUtWJhTOO5mRk4TUJphs0RXifnfi5mtM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eJKh2u31J4tAtiiXityRnfD9PN2KL3o79sKJb4Kc0DH+2zjzKmtbkvlggS4InRzSAKSIwVAvChAR6wgdzIOx18uopPd/9hy/KSkmPnf3a1d9VenHF5+rA4yK2fBb/dDkmVQD5owpxh8dQfhtLlB30fOWtS9abpd4Ftb8SN0tsmg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=id8wcOA7; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="id8wcOA7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1D581F00A3A; Thu, 11 Jun 2026 20:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781208068; bh=mAEqiA37affUSLRyClOuNhJ6p7CdJTTrjpVPa02VrCg=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=id8wcOA78nqa0YvKvw+pwKUyPpVGEry6C4ObzXHXoN/49vr7FIH/S5c7+BOK6wwvs HtCnchKEO6kmkVabyp5NFO/EUJrgmA+lVtRGBZME5OzyhSZNVdb4LXz4V0ED7wWSE2 biKzF5r0ROKKNSbV0YIcSo32q7hflXWzv7KqyoiHfmbrNvFyNqaPXvThlOLTx7Fjtw cIPpAI1jHR70olYYLZ26K7KoOhslHz66l73yVftpNqR3rvCusXdqGeEiZwPxwObIbU NNtsz/7Pel6ueSUzt/BB6QqcISwontngiY9YnkRk2GDMlV8lxE7skkbLPJtSgASupl 5+Q20SEanlxxQ== From: Jeff Layton Date: Thu, 11 Jun 2026 16:00:45 -0400 Subject: [PATCH v2 02/21] nfsd: add missing read barrier to rpc_status_get dumpit seqcount retry Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260611-nfsd-testing-v2-2-5b90e276f2d9@kernel.org> References: <20260611-nfsd-testing-v2-0-5b90e276f2d9@kernel.org> In-Reply-To: <20260611-nfsd-testing-v2-0-5b90e276f2d9@kernel.org> To: Chuck Lever , NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: Chris Mason , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, Jeff Layton X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1600; i=jlayton@kernel.org; h=from:subject:message-id; bh=CcG6OUziAhXqUtWJhTOO5mRk4TUJphs0RXifnfi5mtM=; b=owEBbQKS/ZANAwAKAQAOaEEZVoIVAcsmYgBqKxP8EfYEkRICYfz9k+OJBE5sNBKEbqnlkSyOi ccCcj04T5+JAjMEAAEKAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCaisT/AAKCRAADmhBGVaC FSArD/wKy51MVStKB8MUeMof8vO1Ug2VgFG/ei7vwtdFFbf5LEp14lTxMYU+430q+PyBjEDCaGp iMrUQKcwYi36rjRpQcbETnIBd9bPZH8+phZGC58i3w2xjUuzd0Gqcpaxc0CHdPOAFkX8xwK0BXg anQUsAa1Ie0UBY/Xdm7X7b+OTEi/0PGbDQoV87ieeCWxy1obPm8GHxSfhp5sASUr4myU3UV2fji 8KKMm/E2XuEdZBIAA+rmli7rfrfrcW+p8d/Ux7OlT9STcj6qQ+0xlHg35ynlPVeShdSng1zvT2V TN++VA/uZuOVrSY20hM5nVCco5aX3s7cTgBXimVw5hupusAdhnMOOPBr8+7HYDs0Ms6M+b4TVIe 1kWnhA1W4Yye7o4IX3isFCNT4ibqzUz/aiT1dpzBwPaR+k8HMgjIsuHZpZt76yudCI8haQwL/I4 TueMhDI2/hEmCZU0GRhcKVUUt00FmlswNxzpNsNWflGiA4fhRpwXdEAEbWfETdjWaE04fGe5ujf CJlpB5PFbhj7K507LVvnlucEGhGoAxStAJ2GcBxYdRG+g2rgtul5OeVGOwkJUVD896pdIV1G+xx Zq+ys6NmR7R5Lj4/pPACPivNeYkVIGBt1ZbxazYy+SwurlmbZRVWwC6wsxTVfnsqH60cO/+yZqa WN6ZXu0gr3sA8sg== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 The hand-rolled seqcount-like protocol in nfsd_nl_rpc_status_get_dumpit() is missing a read memory barrier (smp_rmb) before its second counter check. The standard kernel read_seqcount_retry() includes smp_rmb() to ensure that all data reads complete before the counter is re-checked. Without this barrier, on weakly-ordered architectures (ARM, POWER), the CPU may reorder field reads past the second counter check, making the retry logic ineffective: it could observe a consistent counter pair while reading fields that have been concurrently modified by the writer. Add smp_rmb() before the second smp_load_acquire() to match the barrier semantics of the standard seqcount read-side. Fixes: ac18892ea3f7 ("NFSD: add rpc_status netlink support") Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Jeff Layton --- fs/nfsd/nfsctl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index c06d25c06f06..a4b5b1467fe2 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -1576,9 +1576,11 @@ int nfsd_nl_rpc_status_get_dumpit(struct sk_buff *skb, #endif /* CONFIG_NFSD_V4 */ /* - * Acquire rq_status_counter before reporting the rqst - * fields to the user. + * Ensure all field reads complete before re-checking + * the status counter. Pairs with the smp_store_release + * in nfsd_dispatch to form a seq-lock like protocol. */ + smp_rmb(); if (smp_load_acquire(&rqstp->rq_status_counter) != status_counter) continue; -- 2.54.0