Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: handle unexpected free-space-tree key types

Replace the conditional assertions with proper error handling and
transaction abort if we find an unexpected key type in the free space
tree.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>

+15 -3
+15 -3
fs/btrfs/free-space-tree.c
··· 259 259 nr++; 260 260 path->slots[0]--; 261 261 } else { 262 - ASSERT(0); 262 + btrfs_err(fs_info, "unexpected free space tree key type %u", 263 + found_key.type); 264 + ret = -EUCLEAN; 265 + btrfs_abort_transaction(trans, ret); 266 + goto out; 263 267 } 264 268 } 265 269 ··· 409 405 410 406 nr++; 411 407 } else { 412 - ASSERT(0); 408 + btrfs_err(fs_info, "unexpected free space tree key type %u", 409 + found_key.type); 410 + ret = -EUCLEAN; 411 + btrfs_abort_transaction(trans, ret); 412 + goto out; 413 413 } 414 414 } 415 415 ··· 1526 1518 nr++; 1527 1519 path->slots[0]--; 1528 1520 } else { 1529 - ASSERT(0); 1521 + btrfs_err(trans->fs_info, "unexpected free space tree key type %u", 1522 + found_key.type); 1523 + ret = -EUCLEAN; 1524 + btrfs_abort_transaction(trans, ret); 1525 + return ret; 1530 1526 } 1531 1527 } 1532 1528