Skip to content

Commit 1bf76df

Browse files
fdmananakdave
authored andcommitted
btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1
When running a delayed tree reference, if we find a ref count different from 1, we return -EIO. This isn't an IO error, as it indicates either a bug in the delayed refs code or a memory corruption, so change the error code from -EIO to -EUCLEAN. Also tag the branch as 'unlikely' as this is not expected to ever happen, and change the error message to print the tree block's bytenr without the parenthesis (and there was a missing space between the 'block' word and the opening parenthesis), for consistency as that's the style we used everywhere else. Reviewed-by: Josef Bacik <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent a7ddeeb commit 1bf76df

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/btrfs/extent-tree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,12 +1699,12 @@ static int run_delayed_tree_ref(struct btrfs_trans_handle *trans,
16991699
parent = ref->parent;
17001700
ref_root = ref->root;
17011701

1702-
if (node->ref_mod != 1) {
1702+
if (unlikely(node->ref_mod != 1)) {
17031703
btrfs_err(trans->fs_info,
1704-
"btree block(%llu) has %d references rather than 1: action %d ref_root %llu parent %llu",
1704+
"btree block %llu has %d references rather than 1: action %d ref_root %llu parent %llu",
17051705
node->bytenr, node->ref_mod, node->action, ref_root,
17061706
parent);
1707-
return -EIO;
1707+
return -EUCLEAN;
17081708
}
17091709
if (node->action == BTRFS_ADD_DELAYED_REF && insert_reserved) {
17101710
BUG_ON(!extent_op || !extent_op->update_flags);

0 commit comments

Comments
 (0)