On Wed, Feb 15, 2017 at 09:36:03AM +0800, Qu Wenruo wrote: > > > >+ # Corrupt superblock checksum > >+ dd if=/dev/zero of=$TEST_DEV seek=$superblock_offset bs=1 \ > >+ count=4 conv=notrunc &> /dev/null > >+ run_check_stdout $SUDO_HELPER mount $TEST_DEV $TEST_MNT | \ > >+ grep -q 'wrong fs type' > > What about using btrfs check instead of trying to mount it? > > This could emit the need to use $SUDO_HELPER, and could catch super error > more accurate. > > >+ if [ $? -ne 0 ]; then > >+ _fail "Failed to corrupt superblock." > >+ fi > >+ > >+ # Copy backup superblock to primary > >+ run_check $TOP/btrfs-select-super -s 1 $TEST_DEV > >+ run_check $SUDO_HELPER mount $TEST_DEV $TEST_MNT > Same here. I started with 'btrfs check' and 'btrfs check --repair' but it seems like --repair don't fix the corruption. So just moved away from using it.
After you mentioned, now I see 'btrfs check' will be helpful. Will make these changes. Cheers. Lakshmipathi.G -- 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