On 03/21/2018 10:37 AM, Anand Jain wrote:


@@ -418,8 +418,10 @@ static int btrfs_check_super_csum(struct btrfs_fs_info *fs_info,
                    crc, BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE);
      btrfs_csum_final(crc, result);
-    if (memcmp(raw_disk_sb, result, sizeof(result)))
-        return 1;
+    if (memcmp(raw_disk_sb, result, sizeof(result))) {
+        btrfs_err(fs_info, "superblock checksum mismatch");
+        return -EINVAL;

Don't we want EUCLEAN here, since an error in the checksum indicates
corruption?

  With the v2 patch sentout here is the error str that is seen on the cli.

   mount: mount /dev/sdb on /btrfs failed: Structure needs cleaning

 And since we return -EINVAL for the error csum_type not found we get..

 mount: wrong fs type, bad option, bad superblock on /dev/sdb,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

 Looks like mount syscall interprets -EINVAL error.

I am ok. However would have much better if it says checksum error.

 Also we may need an error code to say incompatible disk format/version.

Do you/anyone suggest I should update the errno.h?

Thanks, Anand


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
--
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

Reply via email to