]> git.proxmox.com Git - mirror_ubuntu-kernels.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)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 31 Jan 2023 18:48:13 +0000 (10:48 -0800)
commitae267fc1cfe9f941afcb90dc963ee6448dae73cf
treebe01a351cab1bc7607dcc75073ae19edc85ee5af
parente6261beb0c629403dc58997294dd521bd23664af
f2fs: fix to abort atomic write only during do_exist()

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>
fs/f2fs/file.c