Skip to content

Commit 846a335

Browse files
Jing Xiajankara
authored andcommitted
writeback: Avoid skipping inode writeback
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 <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> CC: [email protected] Fixes: 0ae45f6 ("vfs: add support for a lazytime mount option") Signed-off-by: Jing Xia <[email protected]> Signed-off-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ceaf69f commit 846a335

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/fs-writeback.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,6 +1712,10 @@ static int writeback_single_inode(struct inode *inode,
17121712
*/
17131713
if (!(inode->i_state & I_DIRTY_ALL))
17141714
inode_cgwb_move_to_attached(inode, wb);
1715+
else if (!(inode->i_state & I_SYNC_QUEUED) &&
1716+
(inode->i_state & I_DIRTY))
1717+
redirty_tail_locked(inode, wb);
1718+
17151719
spin_unlock(&wb->list_lock);
17161720
inode_sync_complete(inode);
17171721
out:

0 commit comments

Comments
 (0)