Test script:
Corrupt primary superblock and check if device scan and mount
fails:
mkfs.btrfs -fq /dev/sdc
dd if=/dev/urandom of=/dev/sdc ibs=1 obs=1 count=1 seek=64K
btrfs dev scan
mount /dev/sdb /btrfs
Corrupt secondary superblock and check if device scan and mount
is succcessful, check for the dmesg for errors.
mkfs.btrfs -fq /dev/sdc
dd if=/dev/urandom of=/dev/sdc ibs=1 obs=1 count=1 seek=64K
btrfs dev scan
mount /dev/sdb /btrfs
Have you considered adding fstests, it will be very easy to test for
this behavior?
This is one off kind of bug, not sure if it would value add
for checking it all the time in xfstests?
Same comment as before regarding string literals splitting across lines.
accepted.
+ else
+ pr_err("BTRFS error (device %pg): "\
+ "superblock checksum failed, bytenr=%llu",
+ bdev, bytenr);
+ btrfs_release_disk_super(*page);
+ return err;
+ }
Also it will be better to have the checksum check after we have verified
some basic invariants - that bytenr and magic have sane values.
accepted.
Thanks,
Anand
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html