Re: [PATCH 2/3] btrfs: return required error from btrfs_check_super_csum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 






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

 yeah, I struggled with it before.
 Strangely there isn't an error code for the csum error
 when csum being widely used in the computer systems.

 Our closest are:

#define	EFAULT		14	/* Bad address */
#define	EUCLEAN		135	/* Structure needs cleaning */

 Will use the suggested EUCLEAN.

Thanks, Anand
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux