From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385376; b=t36DB9O6tpCdMQ7S/TXRWQk7TYWkSGIAmYzkH6GG6lfc/3PkvP9XzrrzSt8ev2ZBJCg1 8pE5t87n7DCyDwFjEuVL4rzRYOlihO6r60UU2OwljpzrkPkKhk/0yKBXViy7zIiuNxA8e OIsLVVupPRo+vK1WGPRSiOyGwVoTJLQpPzNDjvEOSh6aL5hcDN1NLRqsGRtc7BzuXHCjK Ca8PSTKnpS+rVuDvVoVizaTb5f1bgFGxTRkggZs4ShPVCLjieWPzwnZmeFtIhcJoUSErC qAvKhurmnYDdp8+iOJWoAIsWs5lWt3VGknytbtPxAxy0XOD4xNadqfsa+wOUGXyl60A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385376; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=WJDVo6vUrfQhFE5b/R7iNIVn1rDyK/NdKAW9o8pZ9tc=; b=hNnJY8mJ9d/NFWN7LqKGjdPSOA1fP1I/pkzLEor7KTOr1fEfbfRfd3ljtwAsIPai+zie Xfohw7/ewBdeqKiQvbfABS9b2HN03tKECedAskIuLKTSzgfIJEAmjTzdNT83+CMRqFrgL vP99wGAi4SSu/svjOnjOQ4irA2eHM7qBzJMSq+zaLKuLdREYApPU5QiSPKcviartQi3iJ 5uxu3eU9kBubABxfZTgsXhmjJu0j9SJJTZRkTSInU+9y6HZsoqjVb4rHvTWRK+WFQWu7Y P0MLsOzDtGyxomW6H+q/4EM0xw7W5BabXN1jyO2k1ae95+kWEK+OA1J1qfYy6JmyX/g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Uy53kSYu; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E3EA606A32C; Fri, 4 Dec 2026 11:56:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Uy53kSYu Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77DF21F000CE; Fri, 4 Dec 2026 11:56:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385375; bh=WJDVo6vUrfQhFE5b/R7iNIVn1rDyK/NdKAW9o8pZ9tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Uy53kSYuEtklbt+8idxrHG6XIg93wOBHO2IkKlNcd9os+c/Ob0pq4cgEI+gm+hiaG gUZSbeMcVGZJL8tbn47hMYvK3DIWiBsDbkwXp45mvEEKiHQzHFg/P15TLjEZ1EM0N+ H2xtbFlWtffsXM8X/It3DhlEtJDtD2rZKpM4gjCg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tim Menninger , Anna Schumaker Subject: [PATCH 6.6 0530/1167] NFSv4: Prevent indefinite waits for out-of-order OPEN stateids Date: Fri, 4 Dec 2026 18:59:17 +0900 Message-ID: <20261204100715.860080355@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tim Menninger commit 151d95a1e696979a7d54b23c96338754be2fcc1f upstream. When processing an out-of-order OPEN stateid on an NFSv4.1 or later mount, nfs_set_open_stateid_locked() waits for stateid updates to be processed in order. A five-second timeout is intended to prevent indefinite waits when preceding updates never arrive. However, each iteration calls schedule_timeout() with a fresh five-second timeout. An update to the shared open state can wake the caller without satisfying its ordering check. The remaining timeout is then discarded, and the next iteration starts another full wait. Under sustained concurrent OPEN/CLOSE activity on the same open state, repeated wakeups can prevent the timeout from ever expiring. Some tasks can remain stuck in update_open_stateid() while others continue making progress. Compute a single deadline on entry and pass only the remaining time to schedule_timeout(). Once the deadline expires, take the existing timeout path rather than starting another wait. This prevents wakeups from extending the wait indefinitely. Observed on Linux 6.8.0 and reproduced on 7.3.0 with 96 concurrent O_RDWR|O_TRUNC open/close loops on one NFSv4.1/TCP file (nconnect=16). Ten workers made no progress for over 300 seconds while others ran. With the fix, all workers resumed after transient stalls. Fixes: c9399f21c215 ("NFSv4: Fix OPEN / CLOSE race") Cc: stable@vger.kernel.org Signed-off-by: Tim Menninger Signed-off-by: Anna Schumaker Signed-off-by: Greg Kroah-Hartman --- fs/nfs/nfs4proc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1695,6 +1695,8 @@ static void nfs_set_open_stateid_locked( { DEFINE_WAIT(wait); int status = 0; + unsigned long deadline = jiffies + 5 * HZ; + signed long remaining; for (;;) { if (nfs_stateid_is_sequential(state, stateid)) @@ -1729,7 +1731,8 @@ static void nfs_set_open_stateid_locked( if (!fatal_signal_pending(current) && !nfs_current_task_exiting()) { - if (schedule_timeout(5*HZ) == 0) + remaining = (long)(deadline - jiffies); + if (remaining <= 0 || schedule_timeout(remaining) == 0) status = -EAGAIN; else status = 0;