f2fs: use meta inode for GC of COW file
authorSunmin Jeong <s_min.jeong@samsung.com>
Wed, 10 Jul 2024 11:51:43 +0000 (20:51 +0900)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 10 Jul 2024 22:48:20 +0000 (22:48 +0000)
commitf18d0076933689775fe7faeeb10ee93ff01be6ab
tree5cef6a03f5a56e2b3643dea90aba6da4829c2577
parentb40a2b00370931b0c50148681dd7364573e52e6b
f2fs: use meta inode for GC of COW file

In case of the COW file, new updates and GC writes are already
separated to page caches of the atomic file and COW file. As some cases
that use the meta inode for GC, there are some race issues between a
foreground thread and GC thread.

To handle them, we need to take care when to invalidate and wait
writeback of GC pages in COW files as the case of using the meta inode.
Also, a pointer from the COW inode to the original inode is required to
check the state of original pages.

For the former, we can solve the problem by using the meta inode for GC
of COW files. Then let's get a page from the original inode in
move_data_block when GCing the COW file to avoid race condition.

Fixes: 3db1de0e582c ("f2fs: change the current atomic write way")
Cc: stable@vger.kernel.org #v5.19+
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Reviewed-by: Yeongjin Gil <youngjin.gil@samsung.com>
Signed-off-by: Sunmin Jeong <s_min.jeong@samsung.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/gc.c
fs/f2fs/inline.c
fs/f2fs/inode.c