android_kernel_xiaomi_sm8350/fs/btrfs
Filipe Manana f73eb7342b btrfs: add missing run of delayed items after unlink during log replay
commit 4751dc99627e4d1465c5bfa8cb7ab31ed418eff5 upstream.

During log replay, whenever we need to check if a name (dentry) exists in
a directory we do searches on the subvolume tree for inode references or
or directory entries (BTRFS_DIR_INDEX_KEY keys, and BTRFS_DIR_ITEM_KEY
keys as well, before kernel 5.17). However when during log replay we
unlink a name, through btrfs_unlink_inode(), we may not delete inode
references and dir index keys from a subvolume tree and instead just add
the deletions to the delayed inode's delayed items, which will only be
run when we commit the transaction used for log replay. This means that
after an unlink operation during log replay, if we attempt to search for
the same name during log replay, we will not see that the name was already
deleted, since the deletion is recorded only on the delayed items.

We run delayed items after every unlink operation during log replay,
except at unlink_old_inode_refs() and at add_inode_ref(). This was due
to an overlook, as delayed items should be run after evert unlink, for
the reasons stated above.

So fix those two cases.

Fixes: 0d836392ca ("Btrfs: fix mount failure after fsync due to hard link recreation")
Fixes: 1f250e929a ("Btrfs: fix log replay failure after unlink and link combination")
CC: stable@vger.kernel.org # 4.19+
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-03-08 19:07:50 +01:00
..
tests
acl.c
async-thread.c btrfs: fix memory ordering between normal and ordered work functions 2021-11-26 10:47:21 +01:00
async-thread.h
backref.c btrfs: remove BUG_ON(!eie) in find_parent_nodes 2022-01-27 09:19:45 +01:00
backref.h
block-group.c btrfs: delete duplicated words + other fixes in comments 2021-08-08 09:04:07 +02:00
block-group.h
block-rsv.c
block-rsv.h
btrfs_inode.h btrfs: fix race between marking inode needs to be logged and log syncing 2021-09-03 10:08:15 +02:00
check-integrity.c
check-integrity.h
compression.c
compression.h
ctree.c btrfs: check the root node for uptodate before returning it 2022-01-27 09:19:50 +01:00
ctree.h btrfs: fix lockdep splat when enabling and disabling qgroups 2021-08-15 13:08:05 +02:00
delalloc-space.c btrfs: make btrfs_qgroup_reserve_data take btrfs_inode 2021-08-15 13:08:04 +02:00
delalloc-space.h
delayed-inode.c btrfs: don't flush from btrfs_delayed_inode_reserve_metadata 2021-08-15 13:08:06 +02:00
delayed-inode.h
delayed-ref.c
delayed-ref.h
dev-replace.c
dev-replace.h
dir-item.c
disk-io.c btrfs: check-integrity: fix a warning on write caching disabled disk 2021-12-08 09:01:09 +01:00
disk-io.h
export.c
export.h
extent_io.c btrfs: clear extent buffer uptodate when we fail to write it 2021-12-14 14:49:01 +01:00
extent_io.h
extent_map.c
extent_map.h
extent-tree.c btrfs: unlock newly allocated extent buffer after error 2021-10-20 11:40:13 +02:00
file-item.c
file.c btrfs: fix race between marking inode needs to be logged and log syncing 2021-09-03 10:08:15 +02:00
free-space-cache.c btrfs: delete duplicated words + other fixes in comments 2021-08-08 09:04:07 +02:00
free-space-cache.h
free-space-tree.c
free-space-tree.h
inode-item.c
inode-map.c
inode-map.h
inode.c btrfs: respect the max size in the header when activating swap file 2022-01-27 09:19:51 +01:00
ioctl.c fsnotify: invalidate dcache before IN_DELETE event 2022-02-01 17:24:39 +01:00
Kconfig
locking.c
locking.h
lzo.c
Makefile
misc.h
ordered-data.c
ordered-data.h
orphan.c
print-tree.c
print-tree.h
props.c
props.h
qgroup.c btrfs: qgroup: fix deadlock between rescan worker and remove qgroup 2022-03-08 19:07:50 +01:00
qgroup.h btrfs: export and rename qgroup_reserve_meta 2021-08-15 13:08:06 +02:00
raid56.c
raid56.h
rcu-string.h
reada.c
ref-verify.c
ref-verify.h
relocation.c
root-tree.c btrfs: replace the BUG_ON in btrfs_del_root_ref with proper error handling 2021-12-14 14:49:01 +01:00
scrub.c
send.c btrfs: send: in case of IO error log it 2022-02-23 11:59:55 +01:00
send.h
space-info.c btrfs: prevent __btrfs_dump_space_info() to underflow its free space 2021-09-30 10:09:22 +02:00
space-info.h
struct-funcs.c
super.c
sysfs.c
sysfs.h
transaction.c btrfs: qgroup: remove ASYNC_COMMIT mechanism in favor of reserve retry-after-EDQUOT 2021-08-15 13:08:05 +02:00
transaction.h btrfs: fix race between marking inode needs to be logged and log syncing 2021-09-03 10:08:15 +02:00
tree-checker.c
tree-checker.h
tree-defrag.c
tree-log.c btrfs: add missing run of delayed items after unlink during log replay 2022-03-08 19:07:50 +01:00
tree-log.h btrfs: do not commit logs and transactions during link and rename operations 2021-08-08 09:04:07 +02:00
ulist.c
ulist.h
uuid-tree.c
volumes.c btrfs: do not take the uuid_mutex in btrfs_rm_device 2021-11-17 09:48:33 +01:00
volumes.h
xattr.c
xattr.h
zlib.c
zstd.c