Patch "f2fs: fix to wait on block writeback for post_read case" has been added to the 6.6-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 block writeback for post_read case

to the 6.6-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-block-writeback-for-post_read-ca.patch
and it can be found in the queue-6.6 subdirectory.

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



commit 0260baca5953e1f5fd90c86a733c066376ed0b79
Author: Chao Yu <chao@xxxxxxxxxx>
Date:   Sun Dec 10 19:35:43 2023 +0800

    f2fs: fix to wait on block writeback for post_read case
    
    [ Upstream commit 55fdc1c24a1d6229fe0ecf31335fb9a2eceaaa00 ]
    
    If inode is compressed, but not encrypted, it missed to call
    f2fs_wait_on_block_writeback() to wait for GCed page writeback
    in IPU write path.
    
    Thread A                                GC-Thread
                                            - f2fs_gc
                                             - do_garbage_collect
                                              - gc_data_segment
                                               - move_data_block
                                                - f2fs_submit_page_write
                                                 migrate normal cluster's block via
                                                 meta_inode's page cache
    - f2fs_write_single_data_page
     - f2fs_do_write_data_page
      - f2fs_inplace_write_data
       - f2fs_submit_page_bio
    
    IRQ
    - f2fs_read_end_io
                                            IRQ
                                            old data overrides new data due to
                                            out-of-order GC and common IO.
                                            - f2fs_read_end_io
    
    Fixes: 4c8ff7095bef ("f2fs: support data compression")
    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/data.c b/fs/f2fs/data.c
index 1ac34eb49a0e..f5f33926acf8 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2568,9 +2568,6 @@ int f2fs_encrypt_one_page(struct f2fs_io_info *fio)
 
 	page = fio->compressed_page ? fio->compressed_page : fio->page;
 
-	/* wait for GCed page writeback via META_MAPPING */
-	f2fs_wait_on_block_writeback(inode, fio->old_blkaddr);
-
 	if (fscrypt_inode_uses_inline_crypto(inode))
 		return 0;
 
@@ -2752,6 +2749,10 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)
 		goto out_writepage;
 	}
 
+	/* wait for GCed page writeback via META_MAPPING */
+	if (fio->post_read)
+		f2fs_wait_on_block_writeback(inode, fio->old_blkaddr);
+
 	/*
 	 * If current allocation needs SSR,
 	 * it had better in-place writes for updated data.




[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