Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6A7EC3B1A9 for ; Fri, 26 Jan 2024 22:40:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706308809; cv=none; b=XFM1iejOmWnXWD8Zx6spYoH1H2yy/8nwRIOu069DseAM9OeKxXriRI2so8PmhFvrsdHpSgZRXzFnzZ+8E/CDmR5UP7ElsAXdKUICFP6asEc78btLmI9E+5VkAnAdWRbq5y1Qk7uPiczbQpDM8os2X44+xPKa2vFAOLnw7f3X//o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706308809; c=relaxed/simple; bh=UdahtYI4pCt1coWf5OMk/R3Z9jjcwDwIM0wwjAi3LDw=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=giNwYERQ6mk4SPbzzI6/uRDvllopKcCGV8e2syLjW+NYI5FHFE+mCXLofmAKvl7oXYaOBYHp+RRWnIPTvmwW3P/iZrjNLTuy2bgoZubIhWJT1coaZikfTEn0zqUHG1+z0wyHulQEkV5rqPe4KkmoZ1odCKS7jmsvBQDeC4PvP5s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ox9fAfjf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ox9fAfjf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC30BC433C7; Fri, 26 Jan 2024 22:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1706308808; bh=UdahtYI4pCt1coWf5OMk/R3Z9jjcwDwIM0wwjAi3LDw=; h=Subject:To:Cc:From:Date:From; b=ox9fAfjfNrqg+wq44047o8JMhQzVIUrfEkTIj1lCNBYRs+Otz3/jTXJBTC25EQDDj 0Zgy7TY2kmMoaL4YhRTUewXKXEWXIXmnHxwURDzyaP1ofr6LKzWvx8OWQ/6gp0gOuJ h+B0wgVZx8N2+6CrEeOOaw6Vn4RjVNJveL1wBqCI= Subject: FAILED: patch "[PATCH] pipe: wakeup wr_wait after setting max_usage" failed to apply to 6.1-stable tree To: lukas@schauer.dev,brauner@kernel.org,dhowells@redhat.com,stable@vger.kernel.org Cc: From: Date: Fri, 26 Jan 2024 14:40:07 -0800 Message-ID: <2024012607-thorn-catty-17f8@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x e95aada4cb93d42e25c30a0ef9eb2923d9711d4a # git commit -s git send-email --to '' --in-reply-to '2024012607-thorn-catty-17f8@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: e95aada4cb93 ("pipe: wakeup wr_wait after setting max_usage") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From e95aada4cb93d42e25c30a0ef9eb2923d9711d4a Mon Sep 17 00:00:00 2001 From: Lukas Schauer Date: Fri, 1 Dec 2023 11:11:28 +0100 Subject: [PATCH] pipe: wakeup wr_wait after setting max_usage Commit c73be61cede5 ("pipe: Add general notification queue support") a regression was introduced that would lock up resized pipes under certain conditions. See the reproducer in [1]. The commit resizing the pipe ring size was moved to a different function, doing that moved the wakeup for pipe->wr_wait before actually raising pipe->max_usage. If a pipe was full before the resize occured it would result in the wakeup never actually triggering pipe_write. Set @max_usage and @nr_accounted before waking writers if this isn't a watch queue. Link: https://bugzilla.kernel.org/show_bug.cgi?id=212295 [1] Link: https://lore.kernel.org/r/20231201-orchideen-modewelt-e009de4562c6@brauner Fixes: c73be61cede5 ("pipe: Add general notification queue support") Reviewed-by: David Howells Cc: Signed-off-by: Lukas Schauer [Christian Brauner : rewrite to account for watch queues] Signed-off-by: Christian Brauner diff --git a/fs/pipe.c b/fs/pipe.c index 226e7f66b590..8d9286a1f2e8 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -1324,6 +1324,11 @@ int pipe_resize_ring(struct pipe_inode_info *pipe, unsigned int nr_slots) pipe->tail = tail; pipe->head = head; + if (!pipe_has_watch_queue(pipe)) { + pipe->max_usage = nr_slots; + pipe->nr_accounted = nr_slots; + } + spin_unlock_irq(&pipe->rd_wait.lock); /* This might have made more room for writers */ @@ -1375,8 +1380,6 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned int arg) if (ret < 0) goto out_revert_acct; - pipe->max_usage = nr_slots; - pipe->nr_accounted = nr_slots; return pipe->max_usage * PAGE_SIZE; out_revert_acct: