Patch "writeback: Avoid skipping inode writeback" 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

    writeback: Avoid skipping inode writeback

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:
     writeback-avoid-skipping-inode-writeback.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 c48b354b20bb7b07b2e92f5e3a77a4a22cec038e
Author: Jing Xia <jing.xia@xxxxxxxxxx>
Date:   Tue May 10 10:35:14 2022 +0800

    writeback: Avoid skipping inode writeback
    
    [ Upstream commit 846a3351ddfe4a86eede4bb26a205c3f38ef84d3 ]
    
    We have run into an issue that a task gets stuck in
    balance_dirty_pages_ratelimited() when perform I/O stress testing.
    The reason we observed is that an I_DIRTY_PAGES inode with lots
    of dirty pages is in b_dirty_time list and standard background
    writeback cannot writeback the inode.
    After studing the relevant code, the following scenario may lead
    to the issue:
    
    task1                                   task2
    -----                                   -----
    fuse_flush
     write_inode_now //in b_dirty_time
      writeback_single_inode
       __writeback_single_inode
                                     fuse_write_end
                                      filemap_dirty_folio
                                       __xa_set_mark:PAGECACHE_TAG_DIRTY
        lock inode->i_lock
        if mapping tagged PAGECACHE_TAG_DIRTY
        inode->i_state |= I_DIRTY_PAGES
        unlock inode->i_lock
                                       __mark_inode_dirty:I_DIRTY_PAGES
                                          lock inode->i_lock
                                          -was dirty,inode stays in
                                          -b_dirty_time
                                          unlock inode->i_lock
    
       if(!(inode->i_state & I_DIRTY_All))
          -not true,so nothing done
    
    This patch moves the dirty inode to b_dirty list when the inode
    currently is not queued in b_io or b_more_io list at the end of
    writeback_single_inode.
    
    Reviewed-by: Jan Kara <jack@xxxxxxx>
    Reviewed-by: Christoph Hellwig <hch@xxxxxx>
    CC: stable@xxxxxxxxxxxxxxx
    Fixes: 0ae45f63d4ef ("vfs: add support for a lazytime mount option")
    Signed-off-by: Jing Xia <jing.xia@xxxxxxxxxx>
    Signed-off-by: Jan Kara <jack@xxxxxxx>
    Link: https://lore.kernel.org/r/20220510023514.27399-1-jing.xia@xxxxxxxxxx
    Stable-dep-of: cbfecb927f42 ("fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 489514bcd7e1..645e3f6ffe44 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1612,6 +1612,10 @@ static int writeback_single_inode(struct inode *inode,
 	 */
 	if (!(inode->i_state & I_DIRTY_ALL))
 		inode_cgwb_move_to_attached(inode, wb);
+	else if (!(inode->i_state & I_SYNC_QUEUED) &&
+		 (inode->i_state & I_DIRTY))
+		redirty_tail_locked(inode, wb);
+
 	spin_unlock(&wb->list_lock);
 	inode_sync_complete(inode);
 out:



[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