android_kernel_samsung_sm8650/fs
Chao Yu 9698f7e8e7 FROMGIT: f2fs: introduce FAULT_BLKADDR_CONSISTENCE
We will encounter below inconsistent status when FAULT_BLKADDR type
fault injection is on.

Info: checkpoint state = d6 :  nat_bits crc fsck compacted_summary orphan_inodes sudden-power-off
[ASSERT] (fsck_chk_inode_blk:1254)  --> ino: 0x1c100 has i_blocks: 000000c0, but has 191 blocks
[FIX] (fsck_chk_inode_blk:1260)  --> [0x1c100] i_blocks=0x000000c0 -> 0xbf
[FIX] (fsck_chk_inode_blk:1269)  --> [0x1c100] i_compr_blocks=0x00000026 -> 0x27
[ASSERT] (fsck_chk_inode_blk:1254)  --> ino: 0x1cadb has i_blocks: 0000002f, but has 46 blocks
[FIX] (fsck_chk_inode_blk:1260)  --> [0x1cadb] i_blocks=0x0000002f -> 0x2e
[FIX] (fsck_chk_inode_blk:1269)  --> [0x1cadb] i_compr_blocks=0x00000011 -> 0x12
[ASSERT] (fsck_chk_inode_blk:1254)  --> ino: 0x1c62c has i_blocks: 00000002, but has 1 blocks
[FIX] (fsck_chk_inode_blk:1260)  --> [0x1c62c] i_blocks=0x00000002 -> 0x1

After we inject fault into f2fs_is_valid_blkaddr() during truncation,
a) it missed to increase @nr_free or @valid_blocks
b) it can cause in blkaddr leak in truncated dnode
Which may cause inconsistent status.

This patch separates FAULT_BLKADDR_CONSISTENCE from FAULT_BLKADDR,
and rename FAULT_BLKADDR to FAULT_BLKADDR_VALIDITY
so that we can:
a) use FAULT_BLKADDR_CONSISTENCE in f2fs_truncate_data_blocks_range()
to simulate inconsistent issue independently, then it can verify fsck
repair flow.
b) FAULT_BLKADDR_VALIDITY fault will not cause any inconsistent status,
we can just use it to check error path handling in kernel side.

Reviewed-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Bug: 313549450
(cherry picked from commit c7115e094ca820bb72e0c89f158d16bc48c6fa04
 https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev)
Change-Id: Ifd6527aa2e48d883ae4063bfce1a404ccfbdaa48
Signed-off-by: Daeho Jeong <daehojeong@google.com>
2024-03-04 18:26:14 +00:00
..
9p 9p: v9fs_listxattr: fix %s null argument warning 2023-11-28 17:07:01 +00:00
adfs
affs affs: initialize fsdata in affs_truncate() 2023-02-01 08:34:08 +01:00
afs afs: Fix file locking on R/O volumes to operate in local mode 2023-12-03 07:32:08 +01:00
autofs autofs: fix memory leak of waitqueues in autofs_catatonic_mode 2023-09-23 11:10:59 +02:00
befs
bfs
btrfs This is the 6.1.66 stable release 2023-12-14 12:51:15 +00:00
cachefiles
ceph ceph_wait_on_conflict_unlink(): grab reference before dropping ->d_lock 2023-11-08 14:11:02 +01:00
coda coda: Avoid partial allocation of sig_inputArgs 2023-03-10 09:33:52 +01:00
configfs configfs: fix possible memory leak in configfs_create_dir() 2022-12-31 13:32:22 +01:00
cramfs UPSTREAM: mm: replace vma->vm_flags direct modifications with modifier calls 2023-06-07 14:24:57 +00:00
crypto BACKPORT: fscrypt: support crypto data unit size less than filesystem block size 2023-12-06 17:54:14 +00:00
debugfs debugfs: fix error when writing negative value to atomic_t debugfs file 2022-12-31 13:31:58 +01:00
devpts
dlm dlm: fix plock lookup when using multiple lockspaces 2023-09-13 09:43:02 +02:00
ecryptfs
efivarfs efi: efivars: Fix variable writes without query_variable_store() 2022-10-21 11:09:40 +02:00
efs
erofs BACKPORT: erofs: fix infinite loop due to a race of filling compressed_bvecs 2024-02-12 20:56:13 +00:00
exfat exfat: support handle zero-size directory 2023-11-28 17:07:00 +00:00
exportfs
ext2 ext2: fix datatype of block number in ext2_xattr_set2() 2023-09-23 11:11:05 +02:00
ext4 Merge 6.1.65 into android14-6.1-lts 2023-12-20 13:31:28 +00:00
f2fs FROMGIT: f2fs: introduce FAULT_BLKADDR_CONSISTENCE 2024-03-04 18:26:14 +00:00
fat
freevxfs
fscache fscache: Use clear_and_wake_up_bit() in fscache_create_volume_work() 2023-02-22 12:59:43 +01:00
fuse ANDROID: fuse: Fix the issue of fuse_dentry_canonical_path 2024-02-02 10:03:33 +00:00
gfs2 gfs2: Silence "suspicious RCU usage in gfs2_permission" warning 2023-11-28 17:07:04 +00:00
hfs hfs: fix missing hfs_bnode_get() in __hfs_bnode_create 2023-03-10 09:34:07 +01:00
hfsplus fs: hfsplus: remove WARN_ON() from hfsplus_cat_{read,write}_inode() 2023-05-24 17:32:34 +01:00
hostfs
hpfs
hugetlbfs UPSTREAM: mm: replace vma->vm_flags direct modifications with modifier calls 2023-06-07 14:24:57 +00:00
incfs ANDROID: Incremental fs: Allocate data buffer based on input request size 2023-07-18 17:21:16 +00:00
iomap iomap: update ki_pos a little later in iomap_dio_complete 2023-12-08 08:51:20 +01:00
isofs
jbd2 jbd2: fix potential data lost in recovering journal raced with synchronizing fs bdev 2023-11-28 17:07:13 +00:00
jffs2 jffs2: reduce stack usage in jffs2_build_xattr_subsystem() 2023-07-19 16:22:11 +02:00
jfs jfs: fix array-index-out-of-bounds in diAlloc 2023-11-28 17:06:59 +00:00
kernfs kernfs: fix missing kernfs_idr_lock to remove an ID from the IDR 2023-07-19 16:21:53 +02:00
lockd fs: lockd: avoid possible wrong NULL parameter 2023-09-13 09:42:49 +02:00
minix
netfs netfs: Only call folio_start_fscache() one time for each folio 2023-10-06 14:56:32 +02:00
nfs NFSv4.1: fix SP4_MACH_CRED protection for pnfs IO 2023-11-28 17:07:04 +00:00
nfs_common
nfsd NFSD: Fix checksum mismatches in the duplicate reply cache 2023-12-03 07:32:10 +01:00
nilfs2 nilfs2: prevent WARNING in nilfs_sufile_set_segment_usage() 2023-12-13 18:39:19 +01:00
nls Revert "fs/nls: make load_nls() take a const parameter" 2023-11-01 14:32:18 +00:00
notify This is the 6.1.39 stable release 2023-09-02 19:41:42 +00:00
ntfs
ntfs3 Merge 6.1.62 into android14-6.1-lts 2023-11-27 14:58:20 +00:00
ocfs2 This is the 6.1.53 stable release 2023-09-18 09:57:37 +00:00
omfs
openpromfs
orangefs UPSTREAM: mm: replace vma->vm_flags direct modifications with modifier calls 2023-06-07 14:24:57 +00:00
overlayfs This is the 6.1.64 stable release 2023-12-12 18:41:13 +00:00
proc This is the 6.1.64 stable release 2023-12-12 18:41:13 +00:00
pstore This is the 6.1.63 stable release 2023-11-27 16:59:46 +00:00
qnx4
qnx6
quota quota: explicitly forbid quota files from being encrypted 2023-11-28 17:07:13 +00:00
ramfs shmem: use ramfs_kill_sb() for kill_sb method of ramfs-based tmpfs 2023-07-19 16:22:11 +02:00
reiserfs reiserfs: Check the return value from __getblk() 2023-09-13 09:42:27 +02:00
romfs
smb cifs: Fix flushing, invalidation and file size with FICLONE 2023-12-13 18:39:28 +01:00
squashfs revert "squashfs: harden sanity check in squashfs_read_xattr_id_table" 2023-02-22 12:59:50 +01:00
sysfs
sysv fs/sysv: Null check to prevent null-ptr-deref bug 2023-08-11 12:08:23 +02:00
tracefs tracefs: Add missing lockdown check to tracefs_create_dir() 2023-09-23 11:11:12 +02:00
ubifs ubifs: Fix memory leak in do_rename 2023-05-11 23:03:05 +09:00
udf udf: initialize newblock to 0 2023-09-13 09:43:05 +02:00
ufs
unicode
vboxsf
verity This is the 6.1.53 stable release 2023-09-18 09:57:37 +00:00
xfs This is the 6.1.64 stable release 2023-12-12 18:41:13 +00:00
zonefs zonefs: Always invalidate last cached page on append write 2023-04-06 12:10:52 +02:00
aio.c UPSTREAM: mm: replace vma->vm_flags direct modifications with modifier calls 2023-06-07 14:24:57 +00:00
anon_inodes.c
attr.c attr: block mode changes of symlinks 2023-09-23 11:11:10 +02:00
bad_inode.c
binfmt_elf_fdpic.c fs: binfmt_elf_efpic: fix personality for ELF-FDPIC 2023-10-06 14:57:06 +02:00
binfmt_elf_test.c
binfmt_elf.c BACKPORT: mm: always expand the stack with the mmap write lock held 2023-07-27 11:47:21 +00:00
binfmt_flat.c
binfmt_misc.c binfmt_misc: fix shift-out-of-bounds in check_special_flags 2022-12-31 13:32:57 +01:00
binfmt_script.c
buffer.c fscrypt: support decrypting data from large folios 2023-02-27 19:45:05 -08:00
char_dev.c chardev: fix error handling in cdev_device_add() 2022-12-31 13:32:41 +01:00
compat_binfmt_elf.c
coredump.c coredump: Move dump_emit_page() to kill unused warning 2023-02-22 12:59:50 +01:00
d_path.c
dax.c
dcache.c
direct-io.c
drop_caches.c FROMGIT: fs: drop_caches: draining pages before dropping caches 2023-08-10 10:47:24 +00:00
eventfd.c eventfd: prevent underflow for eventfd semaphores 2023-09-13 09:42:27 +02:00
eventpoll.c ANDROID: fs: Add vendor hooks for ep_create_wakeup_source & timerfd_create 2023-12-13 15:54:47 -08:00
exec.c BACKPORT: mm: always expand the stack with the mmap write lock held 2023-07-27 11:47:21 +00:00
fcntl.c
fhandle.c
file_table.c
file.c file: reinstate f_pos locking optimization for regular files 2023-08-11 12:08:23 +02:00
filesystems.c
fs_context.c vfs, security: Fix automount superblock LSM init problem, preventing NFS sb sharing 2023-09-13 09:42:28 +02:00
fs_parser.c ext4: journal_path mount options should follow links 2023-01-07 11:11:59 +01:00
fs_pin.c
fs_struct.c
fs_types.c
fs-writeback.c writeback, cgroup: switch inodes with dirty timestamps to release dying cgwbs 2023-11-20 11:51:50 +01:00
fsopen.c
init.c
inode.c fs: add ctime accessors infrastructure 2023-11-28 17:07:15 +00:00
internal.h nfs: use vfs setgid helper 2023-08-30 16:11:10 +02:00
ioctl.c
Kconfig This is the 6.1.36 stable release 2023-06-28 10:19:08 +00:00
Kconfig.binfmt
kernel_read_file.c
libfs.c libfs: add DEFINE_SIMPLE_ATTRIBUTE_SIGNED for signed value 2022-12-31 13:31:58 +01:00
locks.c locks: fix KASAN: use-after-free in trace_event_raw_event_filelock_lock 2023-09-23 11:11:00 +02:00
Makefile This is the 6.1.36 stable release 2023-06-28 10:19:08 +00:00
mbcache.c ext4: fix deadlock due to mbcache entry corruption 2023-01-07 11:12:02 +01:00
mount.h
mpage.c ANDROID: Revert "mm: remove cleancache" 2023-04-26 17:01:50 +00:00
namei.c Revert "audit,io_uring: io_uring openat triggers audit reference count underflow" 2023-11-06 14:51:23 +00:00
namespace.c fs: drop peer group ids under namespace lock 2023-04-13 16:55:33 +02:00
no-block.c
nsfs.c
open.c Merge 6.1.45 into android14-6.1-lts 2023-09-13 19:32:45 +00:00
pipe.c
pnode.c pnode: terminate at peers of source 2023-01-04 11:29:01 +01:00
pnode.h
posix_acl.c
proc_namespace.c
read_write.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
readdir.c
remap_range.c
select.c
seq_file.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
signalfd.c
splice.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
stack.c
stat.c
statfs.c statfs: enforce statfs[64] structure initialization 2023-05-24 17:32:51 +01:00
super.c Merge 6.1.45 into android14-6.1-lts 2023-09-13 19:32:45 +00:00
sync.c
sysctls.c
timerfd.c ANDROID: fs: Add vendor hooks for ep_create_wakeup_source & timerfd_create 2023-12-13 15:54:47 -08:00
userfaultfd.c FROMGIT: mm: handle userfaults under VMA lock 2023-08-16 09:59:38 -07:00
utimes.c
xattr.c fs: don't audit the capability check in simple_xattr_list() 2022-12-31 13:31:55 +01:00