linux/fs/f2fs
Sunmin Jeong b40a2b0037 f2fs: use meta inode for GC of atomic file
The page cache of the atomic file keeps new data pages which will be
stored in the COW file. It can also keep old data pages when GCing the
atomic file. In this case, new data can be overwritten by old data if a
GC thread sets the old data page as dirty after new data page was
evicted.

Also, since all writes to the atomic file are redirected to COW inodes,
GC for the atomic file is not working well as below.

f2fs_gc(gc_type=FG_GC)
  - select A as a victim segment
  do_garbage_collect
    - iget atomic file's inode for block B
    move_data_page
      f2fs_do_write_data_page
        - use dn of cow inode
        - set fio->old_blkaddr from cow inode
    - seg_freed is 0 since block B is still valid
  - goto gc_more and A is selected as victim again

To solve the problem, let's separate GC writes and updates in the atomic
file by using the meta inode for GC writes.

Fixes: 3db1de0e58 ("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>
2024-07-10 22:48:04 +00:00
..
acl.c fs: port i_{g,u}id_into_vfs{g,u}id() to mnt_idmap 2023-01-19 09:24:29 +01:00
acl.h fs: port ->set_acl() to pass mnt_idmap 2023-01-19 09:24:27 +01:00
checkpoint.c f2fs: fix to update user block counts in block_operations() 2024-07-10 22:47:57 +00:00
compress.c f2fs: clean up set REQ_RAHEAD given rac 2024-06-18 02:31:48 +00:00
data.c f2fs: use meta inode for GC of atomic file 2024-07-10 22:48:04 +00:00
debug.c f2fs: introduce SEGS_TO_BLKS/BLKS_TO_SEGS for cleanup 2024-03-04 10:18:26 -08:00
dir.c f2fs: fix to create selinux label during whiteout initialization 2024-02-27 09:41:14 -08:00
extent_cache.c f2fs: fix to cover read extent cache access with lock 2024-06-12 15:46:03 +00:00
f2fs.h f2fs: use meta inode for GC of atomic file 2024-07-10 22:48:04 +00:00
file.c f2fs: fix to use mnt_{want,drop}_write_file replace file_{start,end}_wrtie 2024-06-18 02:32:18 +00:00
gc.c f2fs: use meta inode for GC of atomic file 2024-07-10 22:48:04 +00:00
gc.h f2fs: fix to limit gc_pin_file_threshold 2024-05-09 01:03:44 +00:00
hash.c f2fs: don't use casefolded comparison for "." and ".." 2022-05-17 11:19:23 -07:00
inline.c f2fs: fix return value of f2fs_convert_inline_inode() 2024-06-12 15:46:03 +00:00
inode.c f2fs: remove redundant sanity check in sanity_check_inode() 2024-06-24 17:50:21 +00:00
iostat.c f2fs: add async reset zone command support 2023-06-12 13:04:09 -07:00
iostat.h f2fs: use iostat_lat_type directly as a parameter in the iostat_update_and_unbind_ctx() 2023-02-07 10:39:28 -08:00
Kconfig fs: add CONFIG_BUFFER_HEAD 2023-08-02 09:13:09 -06:00
Makefile f2fs: separate out iostat feature 2021-08-23 10:25:51 -07:00
namei.c f2fs update for 6.9-rc1 2024-03-18 11:26:00 -07:00
node.c f2fs: fix to release node block count in error path of f2fs_new_node_page() 2024-05-10 03:38:28 +00:00
node.h f2fs: use BLKS_PER_SEG, BLKS_PER_SEC, and SEGS_PER_SEC 2024-02-27 09:41:12 -08:00
recovery.c f2fs: remove unused GC_FAILURE_PIN 2024-05-09 01:03:17 +00:00
segment.c f2fs: use meta inode for GC of atomic file 2024-07-10 22:48:04 +00:00
segment.h f2fs: fix start segno of large section 2024-07-09 19:33:50 +00:00
shrinker.c f2fs: add block_age-based extent cache 2022-12-12 14:53:56 -08:00
super.c f2fs: remove unreachable lazytime mount option parsing 2024-07-10 22:47:57 +00:00
sysfs.c f2fs: use new ioprio Macro to get ckpt thread ioprio level 2024-06-12 15:46:03 +00:00
verity.c f2fs: Use folio in f2fs_read_merkle_tree_page 2024-02-27 09:41:15 -08:00
xattr.c f2fs: fix to check return value of f2fs_recover_xattr_data 2023-12-15 15:09:17 -08:00
xattr.h f2fs: move f2fs_xattr_handlers and f2fs_xattr_handler_map to .rodata 2023-10-09 16:24:18 +02:00