Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP4
qemu-linux-user.20748
0108-iscsi-base-all-handling-of-check-co.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0108-iscsi-base-all-handling-of-check-co.patch of Package qemu-linux-user.20748
From: Paolo Bonzini <pbonzini@redhat.com> Date: Tue, 2 Jul 2019 11:40:41 +0200 Subject: 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> (cherry picked from commit 8c460269aa77b6c8e434ac57cf66b71aed00ff09) [LM: BSC#1154790] Signed-off-by: Lin Ma <lma@suse.com> --- block/iscsi.c | 29 ++++++++++++++--------------- scsi/utils.c | 5 ++--- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index a0d38626a511e9c4a7e36bbb29d1..3ddf99049b49faab2741e08581b0 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -220,9 +220,9 @@ static inline unsigned exp_random(double mean) static int iscsi_translate_sense(struct scsi_sense *sense) { - return - scsi_sense_to_errno(sense->key, - (sense->ascq & 0xFF00) >> 8, - sense->ascq & 0xFF); + return scsi_sense_to_errno(sense->key, + (sense->ascq & 0xFF00) >> 8, + sense->ascq & 0xFF); } /* Called (via iscsi_service) with QemuMutex held. */ @@ -239,13 +239,6 @@ iscsi_co_generic_cb(struct iscsi_context *iscsi, int status, if (status != SCSI_STATUS_GOOD) { if (iTask->retries++ < ISCSI_CMD_RETRIES) { - if (status == SCSI_STATUS_CHECK_CONDITION - && task->sense.key == SCSI_SENSE_UNIT_ATTENTION) { - error_report("iSCSI CheckCondition: %s", - iscsi_get_error(iscsi)); - iTask->do_retry = 1; - goto out; - } if (status == SCSI_STATUS_BUSY || status == SCSI_STATUS_TIMEOUT || status == SCSI_STATUS_TASK_SET_FULL) { @@ -267,14 +260,20 @@ iscsi_co_generic_cb(struct iscsi_context *iscsi, int status, timer_mod(&iTask->retry_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + retry_time); iTask->do_retry = 1; - goto out; + } + } else if (status == SCSI_STATUS_CHECK_CONDITION) { + int error = iscsi_translate_sense(&task->sense); + if (error == EAGAIN) { + error_report("iSCSI CheckCondition: %s", + iscsi_get_error(iscsi)); + iTask->do_retry = 1; + } else { + iTask->err_code = -error; + iTask->err_str = g_strdup(iscsi_get_error(iscsi)); } } - iTask->err_code = iscsi_translate_sense(&task->sense); - iTask->err_str = g_strdup(iscsi_get_error(iscsi)); } -out: if (iTask->co) { aio_bh_schedule_oneshot(iTask->iscsilun->aio_context, iscsi_co_generic_bh_cb, iTask); @@ -940,7 +939,7 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status, if (status < 0) { error_report("Failed to ioctl(SG_IO) to iSCSI lun. %s", iscsi_get_error(iscsi)); - acb->status = iscsi_translate_sense(&acb->task->sense); + acb->status = -iscsi_translate_sense(&acb->task->sense); } acb->ioh->driver_status = 0; diff --git a/scsi/utils.c b/scsi/utils.c index 873d49c90796a8ec75671f5d11bb..c50e81fdb87f535e6f49dd31699e 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -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:
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor