diff options
author | Filipe Manana <fdmanana@suse.com> | 2023-06-13 18:07:54 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-06-19 13:59:39 +0200 |
commit | 6822b3f708608d74820cd69e76de16d42899a230 (patch) | |
tree | a3f2289eba32fae1b402de60a05d50fa22ba1225 /rust | |
parent | btrfs: do not BUG_ON on failure to get dir index for new snapshot (diff) | |
download | linux-6822b3f708608d74820cd69e76de16d42899a230.tar.xz linux-6822b3f708608d74820cd69e76de16d42899a230.zip |
btrfs: do not BUG_ON after failure to migrate space during truncation
During truncation we reserve 2 metadata units when starting a transaction
(reserved space goes to fs_info->trans_block_rsv) and then attempt to
migrate 1 unit (min_size bytes) from fs_info->trans_block_rsv into the
local block reserve. If we ever fail we trigger a BUG_ON(), which should
never happen, because we reserved 2 units. However if we happen to fail
for some reason, we don't need to be so dire and hit a BUG_ON(), we can
just error out the truncation and, since this is highly unexpected,
surround the error check with WARN_ON(), to get an informative stack
trace and tag the branh as 'unlikely'. Also make the 'min_size' variable
const, since it's not supposed to ever change and any accidental change
could possibly make the space migration not so unlikely to fail.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'rust')
0 files changed, 0 insertions, 0 deletions