Patch "f2fs: fix to wait page writeback before setting gcing flag" has been added to the 6.1-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

    f2fs: fix to wait page writeback before setting gcing flag

to the 6.1-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:
     f2fs-fix-to-wait-page-writeback-before-setting-gcing.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 294c1767687ed0a14e55066197303ee8a5f8ea17
Author: Chao Yu <chao@xxxxxxxxxx>
Date:   Mon Aug 12 22:12:42 2024 +0800

    f2fs: fix to wait page writeback before setting gcing flag
    
    [ Upstream commit a4d7f2b3238fd5f76b9e6434a0bd5d2e29049cff ]
    
    Soft IRQ                                Thread
    - f2fs_write_end_io
                                            - f2fs_defragment_range
                                             - set_page_private_gcing
     - type = WB_DATA_TYPE(page, false);
     : assign type w/ F2FS_WB_CP_DATA
     due to page_private_gcing() is true
      - dec_page_count() w/ wrong type
      - end_page_writeback()
    
    Value of F2FS_WB_CP_DATA reference count may become negative under above
    race condition, the root cause is we missed to wait page writeback before
    setting gcing page private flag, let's fix it.
    
    Fixes: 2d1fe8a86bf5 ("f2fs: fix to tag gcing flag on page during file defragment")
    Fixes: 4961acdd65c9 ("f2fs: fix to tag gcing flag on page during block migration")
    Signed-off-by: Chao Yu <chao@xxxxxxxxxx>
    Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index f03320c47c823..c9f0bb8f8b210 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2749,6 +2749,8 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
 				goto clear_out;
 			}
 
+			f2fs_wait_on_page_writeback(page, DATA, true, true);
+
 			set_page_dirty(page);
 			set_page_private_gcing(page);
 			f2fs_put_page(page, 1);
@@ -4108,6 +4110,8 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)
 		/* It will never fail, when page has pinned above */
 		f2fs_bug_on(F2FS_I_SB(inode), !page);
 
+		f2fs_wait_on_page_writeback(page, DATA, true, true);
+
 		set_page_dirty(page);
 		set_page_private_gcing(page);
 		f2fs_put_page(page, 1);




[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