iscsi: base all handling of check condition on scsi_sense_to_errno

Now that scsi-disk is not using scsi_sense_to_errno to separate guest-recoverable
sense codes, we can modify it to simplify iscsi's own sense handling.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2019-07-02 11:40:41 +02:00
parent 00e3cccdf4
commit 8c460269aa
2 changed files with 16 additions and 18 deletions

View file

@ -379,8 +379,7 @@ int scsi_sense_to_errno(int key, int asc, int ascq)
case NO_SENSE:
case RECOVERED_ERROR:
case UNIT_ATTENTION:
/* These sense keys are not errors */
return 0;
return EAGAIN;
case ABORTED_COMMAND: /* COMMAND ABORTED */
return ECANCELED;
case NOT_READY:
@ -409,7 +408,7 @@ int scsi_sense_to_errno(int key, int asc, int ascq)
case 0x2700: /* WRITE PROTECTED */
return EACCES;
case 0x0401: /* NOT READY, IN PROGRESS OF BECOMING READY */
return EAGAIN;
return EINPROGRESS;
case 0x0402: /* NOT READY, INITIALIZING COMMAND REQUIRED */
return ENOTCONN;
default: