Files
linux/fs
Filipe Manana 36f9aafa46 btrfs: fix unnecessary transaction commit fallback from btrfs_log_all_parents()
When btrfs_log_all_parents() returns without doing any work (because all
parent directories were already logged), it returns 1, which is propagated
up the fsync call chain up to btrfs_log_dentry_safe(), and that causes
btrfs_sync_file() to trigger am unnecessary transaction commit.

This all happens because the call to btrfs_search_slot() in
btrfs_log_all_parents() always returns 1, as there can not be any inode
ref keys with an offset 0 (an invalid inode number), so if the while loop
below it does not do any work because all parent directories were already
logged, the 'ret' variable remains with a value of 1, which is then
returned up the call chain to btrfs_sync_file().

Fix this by setting 'ret' to 0 after the call to btrfs_search_slot().

Fixes: 0f24ea456a ("btrfs: tracepoints: add trace event for btrfs_log_all_parents()")
Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-09-07 18:36:14 +02:00
..
2026-05-21 13:39:35 +02:00
2026-07-28 09:20:44 +02:00
2026-05-21 13:39:35 +02:00
2026-06-11 11:42:21 -07:00
2026-07-27 12:31:11 +08:00
2026-07-01 15:26:47 +02:00
2026-07-09 15:48:55 -07:00
2026-01-02 13:43:41 -05:00
2026-07-01 15:26:47 +02:00
2026-05-21 13:39:36 +02:00
2026-05-21 13:39:35 +02:00
2026-01-12 16:52:09 +01:00
2026-07-24 10:30:58 +02:00