X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=drivers%2Fscsi%2Fscsi_lib.c;h=da36a3a81a9ee2206f753a04d4fbbe91b883e00a;hb=fe709ed827d370e6b0c0a9f9456da1c22bdcd118;hp=4ba37198e069856c2b6b061e681d1c54955e2eb4;hpb=0644f5393e915f13733bcc65f13195ff39aeb63e;p=firefly-linux-kernel-4.4.55.git diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 4ba37198e069..da36a3a81a9e 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -776,7 +776,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) } if (req->cmd_type == REQ_TYPE_BLOCK_PC) { /* SG_IO ioctl from block level */ - req->errors = result; if (result) { if (sense_valid && req->sense) { /* @@ -792,6 +791,10 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) if (!sense_deferred) error = __scsi_error_from_host_byte(cmd, result); } + /* + * __scsi_error_from_host_byte may have reset the host_byte + */ + req->errors = cmd->result; req->resid_len = scsi_get_resid(cmd);