mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-22 14:13:04 +00:00
btrfs-progs: super-recover: fix the broken sb detection
Commit 3296d058b7
("btrfs-progs: super-recover: Reuse
btrfs_read_dev_super function") changed the logic when a superblock
is added to the bad block list to depend on -EIO. However currently
btrfs_read_dev_super doesn't return -EIO when the fist super block
is broken. Instead it returns -1. This causes the super-recovery
logic to miss the fact that the first super block is completely broken.
Fix this by considering any error code from btrfs_read_dev_super other
than -ENOENT to mean that the super block is corrupted. -ENOENT
means that the superblock copy is not part of the fs i.e. it's smaller
than the offset of the block. This can only occur for the 2nd copy at
256gb mark.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
90a16b10b3
commit
4487aa64e7
@ -136,7 +136,7 @@ read_dev_supers(char *filename, struct btrfs_recover_superblock *recover)
|
||||
max_gen = btrfs_super_generation(sb);
|
||||
if (max_gen > recover->max_generation)
|
||||
recover->max_generation = max_gen;
|
||||
} else if (ret == -EIO){
|
||||
} else if (ret != -ENOENT){
|
||||
/*
|
||||
* Skip superblock which doesn't exist, only adds
|
||||
* really corrupted superblock
|
||||
|
Loading…
Reference in New Issue
Block a user