]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
f2fs: compress: fix to cover f2fs_disable_compressed_file() w/ i_sem
authorChao Yu <chao@kernel.org>
Mon, 22 Jan 2024 02:23:13 +0000 (10:23 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:20:00 +0000 (18:20 -0400)
commit5e59e199f3a617a4e3340df642313d8a3664d654
tree6fc1d1689a6b3e41e6f9531bfcc0ddf5e6ecb930
parent8e2ea8b04cb8d976110c4568509e67d6a39b2889
f2fs: compress: fix to cover f2fs_disable_compressed_file() w/ i_sem

[ Upstream commit 2f9420d3a94aeebd92db88f00f4f2f1a3bd3f6cf ]

- f2fs_disable_compressed_file
  - check inode_has_data
- f2fs_file_mmap
- mkwrite
 - f2fs_get_block_locked
 : update metadata in compressed
   inode's disk layout
  - fi->i_flags &= ~F2FS_COMPR_FL
  - clear_inode_flag(inode, FI_COMPRESSED_FILE);

we should use i_sem lock to prevent above race case.

Fixes: 4c8ff7095bef ("f2fs: support data compression")
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/f2fs.h