Patch "f2fs: fix to abort atomic write only during do_exist()" has been added to the 6.2-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 abort atomic write only during do_exist()

to the 6.2-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-abort-atomic-write-only-during-do_exist.patch
and it can be found in the queue-6.2 subdirectory.

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



commit 5627a015071580c7296acfe5ee6ee4905f2e043e
Author: Chao Yu <chao@xxxxxxxxxx>
Date:   Mon Jan 9 11:44:51 2023 +0800

    f2fs: fix to abort atomic write only during do_exist()
    
    [ Upstream commit ae267fc1cfe9f941afcb90dc963ee6448dae73cf ]
    
    Commit 7a10f0177e11 ("f2fs: don't give partially written atomic data
    from process crash") attempted to drop atomic write data after process
    crash, however, f2fs_abort_atomic_write() may be called from noncrash
    case, fix it by adding missed PF_EXITING check condition
    f2fs_file_flush().
    
    - application crashs
     - do_exit
      - exit_signals -- sets PF_EXITING
      - exit_files
       - put_files_struct
        - close_files
         - filp_close
          - flush (f2fs_file_flush)
           - check atomic_write_task && PF_EXITING
           - f2fs_abort_atomic_write
    
    Fixes: 7a10f0177e11 ("f2fs: don't give partially written atomic data from process crash")
    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 78e6015ce3a6f..1aa21160a0614 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1880,7 +1880,8 @@ static int f2fs_file_flush(struct file *file, fl_owner_t id)
 	 * until all the writers close its file. Since this should be done
 	 * before dropping file lock, it needs to do in ->flush.
 	 */
-	if (F2FS_I(inode)->atomic_write_task == current)
+	if (F2FS_I(inode)->atomic_write_task == current &&
+				(current->flags & PF_EXITING))
 		f2fs_abort_atomic_write(inode, true);
 	return 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