linux-yocto/fs/btrfs
Filipe Manana e774a693b7 btrfs: use btrfs_record_snapshot_destroy() during rmdir
[ Upstream commit 157501b046 ]

We are setting the parent directory's last_unlink_trans directly which
may result in a concurrent task starting to log the directory not see the
update and therefore can log the directory after we removed a child
directory which had a snapshot within instead of falling back to a
transaction commit. Replaying such a log tree would result in a mount
failure since we can't currently delete snapshots (and subvolumes) during
log replay. This is the type of failure described in commit 1ec9a1ae1e
("Btrfs: fix unreplayable log after snapshot delete + parent dir fsync").

Fix this by using btrfs_record_snapshot_destroy() which updates the
last_unlink_trans field while holding the inode's log_mutex lock.

Fixes: 44f714dae5 ("Btrfs: improve performance on fsync against new inode after rename/unlink")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-07-17 18:30:50 +02:00
..
tests btrfs: remove pointless and double ulist frees in error paths of qgroup tests 2022-11-26 09:24:32 +01:00
acl.c
async-thread.c
async-thread.h
backref.c btrfs: fix information leak in btrfs_ioctl_logical_to_ino() 2024-05-02 16:24:48 +02:00
backref.h btrfs: sink iterator parameter to btrfs_ioctl_logical_to_ino 2022-12-08 11:28:38 +01:00
block-group.c btrfs: get zone unusable bytes while holding lock at btrfs_reclaim_bgs_work() 2025-06-04 14:37:56 +02:00
block-group.h btrfs: fix space cache corruption and potential double allocations 2022-09-05 10:30:12 +02:00
block-rsv.c btrfs: don't free qgroup space unless specified 2023-05-17 11:50:21 +02:00
block-rsv.h
btrfs_inode.h btrfs: put initial index value of a directory in a constant 2022-08-31 17:16:35 +02:00
check-integrity.c btrfs: rename btrfs_bio to btrfs_io_context 2022-07-21 21:24:32 +02:00
check-integrity.h
compression.c btrfs: remove unused parameter nr_pages in add_ra_bio_pages() 2022-04-20 09:34:04 +02:00
compression.h
ctree.c btrfs: fix use-after-free when COWing tree bock and tracing is enabled 2025-01-09 13:28:48 +01:00
ctree.h btrfs: rename and export __btrfs_cow_block() 2025-01-09 13:28:48 +01:00
delalloc-space.c btrfs: don't arbitrarily slow down delalloc if we're committing 2023-11-28 16:56:29 +00:00
delalloc-space.h
delayed-inode.c btrfs: change BUG_ON to assertion when checking for delayed_node root 2024-09-04 13:23:26 +02:00
delayed-inode.h btrfs: fix infinite directory reads 2024-02-23 08:54:30 +01:00
delayed-ref.c btrfs: reinitialize delayed ref list after deleting it from the list 2024-11-14 13:13:40 +01:00
delayed-ref.h btrfs: add additional parameters to btrfs_init_tree_ref/btrfs_init_data_ref 2022-07-12 16:34:50 +02:00
dev-replace.c btrfs: dev-replace: properly validate device names 2024-03-06 14:38:48 +00:00
dev-replace.h
dir-item.c
discard.c btrfs: make btrfs_discard_workfn() block_group ref explicit 2025-06-04 14:37:56 +02:00
discard.h
disk-io.c btrfs: flush delalloc workers queue before stopping cleaner kthread during unmount 2025-01-09 13:28:48 +01:00
disk-io.h btrfs: make thaw time super block check to also verify checksum 2023-01-12 11:59:20 +01:00
export.c btrfs: export: handle invalid inode or root reference in btrfs_get_parent() 2024-04-13 13:01:44 +02:00
export.h btrfs: fix type of parameter generation in btrfs_get_dentry 2022-11-10 18:15:38 +01:00
extent_io.c btrfs: avoid linker error in btrfs_find_create_tree_block() 2025-06-04 14:37:56 +02:00
extent_io.h btrfs: fix qgroup reserve overflow the qgroup limit 2022-04-13 20:59:23 +02:00
extent_map.c btrfs: rename btrfs_bio to btrfs_io_context 2022-07-21 21:24:32 +02:00
extent_map.h
extent-io-tree.h
extent-tree.c btrfs: don't BUG_ON() when 0 reference count at btrfs_lookup_extent_info() 2025-05-22 14:08:27 +02:00
file-item.c btrfs: handle memory allocation failure in btrfs_csum_one_bio 2023-06-21 15:59:13 +02:00
file.c btrfs: fix hole expansion when writing at an offset beyond EOF 2025-03-13 12:50:41 +01:00
free-space-cache.c btrfs: rename bitmap_set_bits() -> btrfs_bitmap_set_bits() 2024-09-04 13:23:16 +02:00
free-space-cache.h
free-space-tree.c btrfs: fix invalid delayed ref after subvolume creation failure 2022-07-12 16:34:50 +02:00
free-space-tree.h
inode-item.c
inode.c btrfs: use btrfs_record_snapshot_destroy() during rmdir 2025-07-17 18:30:50 +02:00
ioctl.c btrfs: forbid creating subvol qgroups 2024-02-23 08:55:01 +01:00
Kconfig
locking.c btrfs: fix lockdep splat with reloc root extent buffers 2022-09-05 10:30:12 +02:00
locking.h btrfs: fix lockdep splat with reloc root extent buffers 2022-09-05 10:30:12 +02:00
lzo.c
Makefile
misc.h
ordered-data.c
ordered-data.h
orphan.c
print-tree.c btrfs: print-tree: parent bytenr must be aligned to sector size 2023-05-17 11:50:22 +02:00
print-tree.h
props.c
props.h
qgroup.c btrfs: run delayed iputs when flushing delalloc 2024-09-04 13:23:37 +02:00
qgroup.h
raid56.c btrfs: raid56: properly handle the error when unable to find the missing stripe 2022-11-26 09:24:31 +01:00
raid56.h btrfs: rename btrfs_bio to btrfs_io_context 2022-07-21 21:24:32 +02:00
rcu-string.h btrfs: replace strncpy() with strscpy() 2023-01-12 11:59:05 +01:00
reada.c btrfs: rename btrfs_bio to btrfs_io_context 2022-07-21 21:24:32 +02:00
ref-verify.c btrfs: ref-verify: fix use-after-free after invalid ref action 2024-12-14 19:51:22 +01:00
ref-verify.h
reflink.c
reflink.h
relocation.c btrfs: convert BUG_ON in btrfs_reloc_cow_block() to proper error handling 2025-03-13 12:50:17 +01:00
root-tree.c btrfs: fix silent failure when deleting root reference 2022-08-31 17:16:46 +02:00
scrub.c btrfs: zoned: use zone aware sb location for scrub 2024-04-10 16:19:31 +02:00
send.c btrfs: send: return -ENAMETOOLONG when attempting a path that is too long 2025-06-04 14:37:56 +02:00
send.h
space-info.c
space-info.h
struct-funcs.c
subpage.c
subpage.h
super.c btrfs: correctly escape subvol in btrfs_show_options() 2025-05-02 07:44:12 +02:00
sysfs.c btrfs: sysfs: fix direct super block member reads 2025-01-09 13:28:48 +01:00
sysfs.h
transaction.c btrfs: fix use-after-free when attempting to join an aborted transaction 2025-03-13 12:50:16 +01:00
transaction.h btrfs: fix race between direct IO write and fsync when using same fd 2024-09-12 11:07:53 +02:00
tree-checker.c btrfs: tree-checker: reject inline extent items with 0 ref count 2025-01-09 13:28:34 +01:00
tree-checker.h
tree-defrag.c btrfs: fix an error handling path in btrfs_defrag_leaves() 2023-01-12 11:59:08 +01:00
tree-log.c btrfs: fix missing error handling when searching for inode refs during log replay 2025-07-10 15:57:44 +02:00
tree-log.h btrfs: pass the dentry to btrfs_log_new_name() instead of the inode 2022-08-31 17:16:36 +02:00
tree-mod-log.c
tree-mod-log.h
ulist.c
ulist.h
uuid-tree.c
verity.c
volumes.c btrfs: update superblock's device bytes_used when dropping chunk 2025-07-10 15:57:39 +02:00
volumes.h btrfs: add a helper to read the superblock metadata_uuid 2023-09-23 11:10:00 +02:00
xattr.c btrfs: check if root is readonly while setting security xattr 2022-08-31 17:16:46 +02:00
xattr.h
zlib.c btrfs: zlib: zero-initialize zlib workspace 2023-02-14 19:17:56 +01:00
zoned.c btrfs: zero the buffer before marking it dirty in btrfs_redirty_list_add 2023-05-17 11:50:22 +02:00
zoned.h btrfs: zoned: revive max_zone_append_bytes 2022-08-31 17:16:34 +02:00
zstd.c