Patch "f2fs: truncate page cache before clearing flags when aborting atomic write" has been added to the 6.8-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: truncate page cache before clearing flags when aborting atomic write

to the 6.8-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-truncate-page-cache-before-clearing-flags-when-.patch
and it can be found in the queue-6.8 subdirectory.

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



commit 8722e469c369dc90e0b890076b91a6456a2c45cf
Author: Sunmin Jeong <s_min.jeong@xxxxxxxxxxx>
Date:   Wed Mar 13 20:26:20 2024 +0900

    f2fs: truncate page cache before clearing flags when aborting atomic write
    
    [ Upstream commit 74b0ebcbdde4c7fe23c979e4cfc2fdbf349c39a3 ]
    
    In f2fs_do_write_data_page, FI_ATOMIC_FILE flag selects the target inode
    between the original inode and COW inode. When aborting atomic write and
    writeback occur simultaneously, invalid data can be written to original
    inode if the FI_ATOMIC_FILE flag is cleared meanwhile.
    
    To prevent the problem, let's truncate all pages before clearing the flag
    
    Atomic write thread              Writeback thread
      f2fs_abort_atomic_write
        clear_inode_flag(inode, FI_ATOMIC_FILE)
                                      __writeback_single_inode
                                        do_writepages
                                          f2fs_do_write_data_page
                                            - use dn of original inode
        truncate_inode_pages_final
    
    Fixes: 3db1de0e582c ("f2fs: change the current atomic write way")
    Cc: stable@xxxxxxxxxxxxxxx #v5.19+
    Reviewed-by: Sungjong Seo <sj1557.seo@xxxxxxxxxxx>
    Reviewed-by: Yeongjin Gil <youngjin.gil@xxxxxxxxxxx>
    Signed-off-by: Sunmin Jeong <s_min.jeong@xxxxxxxxxxx>
    Reviewed-by: Daeho Jeong <daehojeong@xxxxxxxxxx>
    Reviewed-by: Chao Yu <chao@xxxxxxxxxx>
    Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 60531f50f37fe..6d5774093452f 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -192,6 +192,9 @@ void f2fs_abort_atomic_write(struct inode *inode, bool clean)
 	if (!f2fs_is_atomic_file(inode))
 		return;
 
+	if (clean)
+		truncate_inode_pages_final(inode->i_mapping);
+
 	release_atomic_write_cnt(inode);
 	clear_inode_flag(inode, FI_ATOMIC_COMMITTED);
 	clear_inode_flag(inode, FI_ATOMIC_REPLACE);
@@ -201,7 +204,6 @@ void f2fs_abort_atomic_write(struct inode *inode, bool clean)
 	F2FS_I(inode)->atomic_write_task = NULL;
 
 	if (clean) {
-		truncate_inode_pages_final(inode->i_mapping);
 		f2fs_i_size_write(inode, fi->original_i_size);
 		fi->original_i_size = 0;
 	}




[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