Patch "pipe: wakeup wr_wait after setting max_usage" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    pipe: wakeup wr_wait after setting max_usage

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pipe-wakeup-wr_wait-after-setting-max_usage.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 83c5b2c0278624b50c7080a2a3601d84f0f73716
Author: Lukas Schauer <lukas@xxxxxxxxxxx>
Date:   Fri Dec 1 11:11:28 2023 +0100

    pipe: wakeup wr_wait after setting max_usage
    
    [ Upstream commit e95aada4cb93d42e25c30a0ef9eb2923d9711d4a ]
    
    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 <dhowells@xxxxxxxxxx>
    Cc: <stable@xxxxxxxxxxxxxxx>
    Signed-off-by: Lukas Schauer <lukas@xxxxxxxxxxx>
    [Christian Brauner <brauner@xxxxxxxxxx>: rewrite to account for watch queues]
    Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/pipe.c b/fs/pipe.c
index 7b3e94baba21..588fe37d8d95 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1300,6 +1300,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 */
@@ -1351,8 +1356,6 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long 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:




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux