diff mbox series

[2/2] iscsi: return -EIO when sense fields are meaningless

Message ID 20200701105444.3226-2-xieyongji@bytedance.com
State New
Headers show
Series None | expand

Commit Message

Yongji Xie July 1, 2020, 10:54 a.m. UTC
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>
---
 block/iscsi.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Paolo Bonzini July 1, 2020, 11:40 a.m. UTC | #1
On 01/07/20 12:54, Xie Yongji wrote:
> 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>
> ---
>  block/iscsi.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 2964c9f8d2..387ed872ef 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 ||
> 

Queued both, thanks.

Paolo
diff mbox series

Patch

diff --git a/block/iscsi.c b/block/iscsi.c
index 2964c9f8d2..387ed872ef 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 ||