Patch "f2fs: fix to wait on page writeback in __clone_blkaddrs()" 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

    f2fs: fix to wait on page writeback in __clone_blkaddrs()

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:
     f2fs-fix-to-wait-on-page-writeback-in-__clone_blkadd.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 82eb297061d598a9c8ae3ef977a83dd823b27db0
Author: Chao Yu <chao@xxxxxxxxxx>
Date:   Tue Mar 26 19:28:45 2024 +0800

    f2fs: fix to wait on page writeback in __clone_blkaddrs()
    
    [ Upstream commit d3876e34e7e789e2cbdd782360fef2a777391082 ]
    
    In below race condition, dst page may become writeback status
    in __clone_blkaddrs(), it needs to wait writeback before update,
    fix it.
    
    Thread A                                GC Thread
    - f2fs_move_file_range
      - filemap_write_and_wait_range(dst)
                                            - gc_data_segment
                                             - f2fs_down_write(dst)
                                             - move_data_page
                                              - set_page_writeback(dst_page)
                                              - f2fs_submit_page_write
                                             - f2fs_up_write(dst)
      - f2fs_down_write(dst)
      - __exchange_data_block
       - __clone_blkaddrs
        - f2fs_get_new_data_page
        - memcpy_page
    
    Fixes: 0a2aa8fbb969 ("f2fs: refactor __exchange_data_block for speed up")
    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 40e805014f719..678d72a870259 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1253,6 +1253,8 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode,
 				f2fs_put_page(psrc, 1);
 				return PTR_ERR(pdst);
 			}
+			f2fs_wait_on_page_writeback(pdst, DATA, true, true);
+
 			f2fs_copy_page(psrc, pdst);
 			set_page_dirty(pdst);
 			f2fs_put_page(pdst, 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