mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-11 03:31:17 +00:00
btrfs-progs: add more error handling to btrfs_free_block_group
As btrfs_update_block_group fails when the block group is not found in cache, we can exit btrfs_free_block_group, not much to rollback. The caller will also exit in turn. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
eae83c46f7
commit
1fc20730db
@ -9467,7 +9467,9 @@ repair_abort:
|
|||||||
goto repair_abort;
|
goto repair_abort;
|
||||||
}
|
}
|
||||||
|
|
||||||
btrfs_fix_block_accounting(trans, root);
|
ret = btrfs_fix_block_accounting(trans, root);
|
||||||
|
if (ret)
|
||||||
|
goto repair_abort;
|
||||||
ret = btrfs_commit_transaction(trans, root);
|
ret = btrfs_commit_transaction(trans, root);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto repair_abort;
|
goto repair_abort;
|
||||||
|
@ -3840,7 +3840,7 @@ out:
|
|||||||
int btrfs_fix_block_accounting(struct btrfs_trans_handle *trans,
|
int btrfs_fix_block_accounting(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root)
|
struct btrfs_root *root)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = 0;
|
||||||
int slot;
|
int slot;
|
||||||
u64 start = 0;
|
u64 start = 0;
|
||||||
u64 bytes_used = 0;
|
u64 bytes_used = 0;
|
||||||
@ -3904,13 +3904,16 @@ int btrfs_fix_block_accounting(struct btrfs_trans_handle *trans,
|
|||||||
bytes_used += fs_info->nodesize;
|
bytes_used += fs_info->nodesize;
|
||||||
ret = btrfs_update_block_group(trans, root,
|
ret = btrfs_update_block_group(trans, root,
|
||||||
key.objectid, fs_info->nodesize, 1, 0);
|
key.objectid, fs_info->nodesize, 1, 0);
|
||||||
BUG_ON(ret);
|
if (ret)
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
path.slots[0]++;
|
path.slots[0]++;
|
||||||
}
|
}
|
||||||
btrfs_set_super_bytes_used(root->fs_info->super_copy, bytes_used);
|
btrfs_set_super_bytes_used(root->fs_info->super_copy, bytes_used);
|
||||||
|
ret = 0;
|
||||||
|
out:
|
||||||
btrfs_release_path(&path);
|
btrfs_release_path(&path);
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __get_extent_size(struct btrfs_root *root, struct btrfs_path *path,
|
static void __get_extent_size(struct btrfs_root *root, struct btrfs_path *path,
|
||||||
|
Loading…
Reference in New Issue
Block a user