Skip to content

Commit 7d493a5

Browse files
josefbacikkdave
authored andcommitted
btrfs: fix incorrect comparison for delayed refs
When I reworked delayed ref comparison in cf4f043 ("btrfs: move ->parent and ->ref_root into btrfs_delayed_ref_node"), I made a mistake and returned -1 for the case where ref1->ref_root was > than ref2->ref_root. This is a subtle bug that can result in improper delayed ref running order, which can result in transaction aborts. Fixes: cf4f043 ("btrfs: move ->parent and ->ref_root into btrfs_delayed_ref_node") CC: [email protected] # 6.10+ Reviewed-by: Filipe Manana <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 2b084d8 commit 7d493a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/delayed-ref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ static int comp_refs(struct btrfs_delayed_ref_node *ref1,
298298
if (ref1->ref_root < ref2->ref_root)
299299
return -1;
300300
if (ref1->ref_root > ref2->ref_root)
301-
return -1;
301+
return 1;
302302
if (ref1->type == BTRFS_EXTENT_DATA_REF_KEY)
303303
ret = comp_data_refs(ref1, ref2);
304304
}

0 commit comments

Comments
 (0)