]> www.infradead.org Git - users/jedix/linux-maple.git/commit
f2fs: fix to abort atomic write only during do_exist()
authorChao Yu <chao@kernel.org>
Mon, 9 Jan 2023 03:44:51 +0000 (11:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 12:55:19 +0000 (13:55 +0100)
commit14e8bd4cfae3ffc921c64130777cdd1c7a2267c3
tree3cf166f23e3788c47ceda5085d35a69cb4d7a693
parente11707d5f86fe1b507b1c2d70258df7c2661454e
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@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/file.c