Skip to content

Commit b1a5d3f

Browse files
fdmananagregkh
authored andcommitted
btrfs: make btrfs_destroy_delayed_refs() return void
[ Upstream commit 99f09ce ] btrfs_destroy_delayed_refs() always returns 0 and its single caller does not check its return value, as it also returns void, and so does the callers' caller and so on. This is because we are in the transaction abort path, where we have no way to deal with errors (we are in a critical situation) and all cleanup of resources works in a best effort fashion. So make btrfs_destroy_delayed_refs() return void. Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Signed-off-by: David Sterba <[email protected]> Stable-dep-of: fb33eb2 ("btrfs: fix leak of qgroup extent records after transaction abort") Signed-off-by: Sasha Levin <[email protected]>
1 parent 95e69b1 commit b1a5d3f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

fs/btrfs/disk-io.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4939,21 +4939,20 @@ static void btrfs_destroy_all_ordered_extents(struct btrfs_fs_info *fs_info)
49394939
btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);
49404940
}
49414941

4942-
static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
4943-
struct btrfs_fs_info *fs_info)
4942+
static void btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
4943+
struct btrfs_fs_info *fs_info)
49444944
{
49454945
struct rb_node *node;
49464946
struct btrfs_delayed_ref_root *delayed_refs;
49474947
struct btrfs_delayed_ref_node *ref;
4948-
int ret = 0;
49494948

49504949
delayed_refs = &trans->delayed_refs;
49514950

49524951
spin_lock(&delayed_refs->lock);
49534952
if (atomic_read(&delayed_refs->num_entries) == 0) {
49544953
spin_unlock(&delayed_refs->lock);
49554954
btrfs_debug(fs_info, "delayed_refs has NO entry");
4956-
return ret;
4955+
return;
49574956
}
49584957

49594958
while ((node = rb_first_cached(&delayed_refs->href_root)) != NULL) {
@@ -5015,8 +5014,6 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
50155014
btrfs_qgroup_destroy_extent_records(trans);
50165015

50175016
spin_unlock(&delayed_refs->lock);
5018-
5019-
return ret;
50205017
}
50215018

50225019
static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root)

0 commit comments

Comments
 (0)