Skip to content

Commit ed67f2a

Browse files
fdmananakdave
authored andcommitted
btrfs: don't loop for nowait writes when checking for cross references
When checking for delayed refs when verifying if there are cross references for a data extent, we stop if the path has nowait set and we can't try lock the delayed ref head's mutex, returning -EAGAIN with the goal of making a write fallback to a blocking context. However we ignore the -EAGAIN at btrfs_cross_ref_exist() when check_delayed_ref() returns it, and keep looping instead of immediately returning the -EAGAIN to the caller. Fix this by not looping if we get -EAGAIN and we have a nowait path. Fixes: 26ce911 ("btrfs: make can_nocow_extent nowait compatible") CC: stable@vger.kernel.org # 6.1+ Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent b188ad7 commit ed67f2a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/extent-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2422,7 +2422,7 @@ int btrfs_cross_ref_exist(struct btrfs_root *root, u64 objectid, u64 offset,
24222422
goto out;
24232423

24242424
ret = check_delayed_ref(root, path, objectid, offset, bytenr);
2425-
} while (ret == -EAGAIN);
2425+
} while (ret == -EAGAIN && !path->nowait);
24262426

24272427
out:
24282428
btrfs_release_path(path);

0 commit comments

Comments
 (0)