aboutsummaryrefslogtreecommitdiff
path: root/block/iscsi.c
diff options
context:
space:
mode:
authorXie Yongji <xieyongji@bytedance.com>2020-07-01 18:54:44 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2020-07-10 18:02:23 -0400
commitc58daf76a6d9aee7502d0fcd5f3e7ec9b9861646 (patch)
treec6e3daeb0ac15a934a17550a4a3eb8007c01b066 /block/iscsi.c
parentdd3b00202a5ff4153a0088917ac69d2e6cd2bc1f (diff)
iscsi: return -EIO when sense fields are meaningless
When an I/O request failed, now we only return correct value on scsi check condition. We should also have a default errno such as -EIO in other case. Signed-off-by: Xie Yongji <xieyongji@bytedance.com> Message-Id: <20200701105444.3226-2-xieyongji@bytedance.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'block/iscsi.c')
-rw-r--r--block/iscsi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/iscsi.c b/block/iscsi.c
index 7519b0970f..bd2122a3a4 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -241,9 +241,11 @@ iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
iTask->status = status;
iTask->do_retry = 0;
+ iTask->err_code = 0;
iTask->task = task;
if (status != SCSI_STATUS_GOOD) {
+ iTask->err_code = -EIO;
if (iTask->retries++ < ISCSI_CMD_RETRIES) {
if (status == SCSI_STATUS_BUSY ||
status == SCSI_STATUS_TIMEOUT ||