Message ID | 1578532344-101668-1-git-send-email-chenxiang66@hisilicon.com (mailing list archive) |
---|---|
State | Mainlined |
Commit | 465f4edaecc6c37f81349233e84d46246bcac11a |
Headers | show |
Series | scsi: sd: Clear sdkp->protection_type when the disk isn't DIF in sd_read_protection_type() | expand |
> For a SAS disk, format it as a SAS DIF disk, then if re-format SAS DIF > disk to normal SAS disk,it will report errors as follows: Clarified commit description. Applied to 5.5/scsi-fixes, thanks!
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index cea6259..65ce10c 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2211,8 +2211,10 @@ static int sd_read_protection_type(struct scsi_disk *sdkp, unsigned char *buffer u8 type; int ret = 0; - if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) + if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) { + sdkp->protection_type = 0; return ret; + } type = ((buffer[12] >> 1) & 7) + 1; /* P_TYPE 0 = Type 1 */