mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
Btrfs: fix BUG() in scrub when first superblock reading gives EIO
This fixes a very special case that can be reproduced by just disconnecting a disk at runtime, and without unmounting the filesystem first, start scrub on the filesystem with the disconnected disk. All read and write EIOs are handled correctly, only the first superblock is an exception and gives a BUG() in a subfunction. The BUG() is correct, it would crash later otherwise. The subfunction must not be called for superblocks and this is what the fix changes. Reported-by: Joeri Vanthienen <mail@joerivanthienen.be> Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
parent
6c760c0724
commit
4ded4f6395
1 changed files with 11 additions and 0 deletions
|
@ -785,6 +785,17 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check)
|
|||
|
||||
BUG_ON(sblock_to_check->page_count < 1);
|
||||
fs_info = sctx->dev_root->fs_info;
|
||||
if (sblock_to_check->pagev[0]->flags & BTRFS_EXTENT_FLAG_SUPER) {
|
||||
/*
|
||||
* if we find an error in a super block, we just report it.
|
||||
* They will get written with the next transaction commit
|
||||
* anyway
|
||||
*/
|
||||
spin_lock(&sctx->stat_lock);
|
||||
++sctx->stat.super_errors;
|
||||
spin_unlock(&sctx->stat_lock);
|
||||
return 0;
|
||||
}
|
||||
length = sblock_to_check->page_count * PAGE_SIZE;
|
||||
logical = sblock_to_check->pagev[0]->logical;
|
||||
generation = sblock_to_check->pagev[0]->generation;
|
||||
|
|
Loading…
Reference in a new issue