All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror
@ 2017-08-21 14:10 Fam Zheng
  2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 1/4] scsi: Refactor scsi sense interpreting code Fam Zheng
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Fam Zheng @ 2017-08-21 14:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

v4: Handle more sense keys/ascqs. [Paolo]
    Add scsi_sense_buf_to_errno to util/scsi.c. [Paolo]
    Shorten the comment notes on SCSI constants.

v3: Enhance and reuse iscsi sense data translation. [Paolo]

First refactor and enhance the code in iscsi for sense data translation, then
modify error handing of scsi-block and expose the qdev properties.

Fam Zheng (4):
  scsi: Refactor scsi sense interpreting code
  scsi: Improve scsi_sense_to_errno
  scsi: Introduce scsi_sense_buf_to_errno
  scsi-block: Support rerror/werror

 MAINTAINERS         |  2 ++
 block/iscsi.c       | 45 +++------------------------
 hw/scsi/scsi-disk.c | 38 +++++++++++++---------
 include/scsi/scsi.h | 20 ++++++++++++
 util/Makefile.objs  |  1 +
 util/scsi.c         | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 141 insertions(+), 55 deletions(-)
 create mode 100644 include/scsi/scsi.h
 create mode 100644 util/scsi.c

-- 
2.13.5

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH v4 1/4] scsi: Refactor scsi sense interpreting code
  2017-08-21 14:10 [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror Fam Zheng
@ 2017-08-21 14:10 ` Fam Zheng
  2017-08-22 13:22   ` Paolo Bonzini
  2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 2/4] scsi: Improve scsi_sense_to_errno Fam Zheng
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Fam Zheng @ 2017-08-21 14:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

So that it can be reused outside of iscsi.c.

Also update MAINTAINERS to include the new files in SCSI section.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 MAINTAINERS         |  2 ++
 block/iscsi.c       | 45 ++++-----------------------------------------
 include/scsi/scsi.h | 19 +++++++++++++++++++
 util/Makefile.objs  |  1 +
 util/scsi.c         | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 78 insertions(+), 41 deletions(-)
 create mode 100644 include/scsi/scsi.h
 create mode 100644 util/scsi.c

diff --git a/MAINTAINERS b/MAINTAINERS
index ccee28b12d..2a4e5036ae 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -969,7 +969,9 @@ SCSI
 M: Paolo Bonzini <pbonzini@redhat.com>
 S: Supported
 F: include/hw/scsi/*
+F: include/scsi/*
 F: hw/scsi/*
+F: util/scsi*
 F: tests/virtio-scsi-test.c
 T: git git://github.com/bonzini/qemu.git scsi-next
 
diff --git a/block/iscsi.c b/block/iscsi.c
index d557c99668..4bed63cd6d 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -40,6 +40,7 @@
 #include "qmp-commands.h"
 #include "qapi/qmp/qstring.h"
 #include "crypto/secret.h"
+#include "scsi/scsi.h"
 
 #include <iscsi/iscsi.h>
 #include <iscsi/scsi-lowlevel.h>
@@ -209,47 +210,9 @@ static inline unsigned exp_random(double mean)
 
 static int iscsi_translate_sense(struct scsi_sense *sense)
 {
-    int ret;
-
-    switch (sense->key) {
-    case SCSI_SENSE_NOT_READY:
-        return -EBUSY;
-    case SCSI_SENSE_DATA_PROTECTION:
-        return -EACCES;
-    case SCSI_SENSE_COMMAND_ABORTED:
-        return -ECANCELED;
-    case SCSI_SENSE_ILLEGAL_REQUEST:
-        /* Parse ASCQ */
-        break;
-    default:
-        return -EIO;
-    }
-    switch (sense->ascq) {
-    case SCSI_SENSE_ASCQ_PARAMETER_LIST_LENGTH_ERROR:
-    case SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE:
-    case SCSI_SENSE_ASCQ_INVALID_FIELD_IN_CDB:
-    case SCSI_SENSE_ASCQ_INVALID_FIELD_IN_PARAMETER_LIST:
-        ret = -EINVAL;
-        break;
-    case SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE:
-        ret = -ENOSPC;
-        break;
-    case SCSI_SENSE_ASCQ_LOGICAL_UNIT_NOT_SUPPORTED:
-        ret = -ENOTSUP;
-        break;
-    case SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT:
-    case SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_CLOSED:
-    case SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_OPEN:
-        ret = -ENOMEDIUM;
-        break;
-    case SCSI_SENSE_ASCQ_WRITE_PROTECTED:
-        ret = -EACCES;
-        break;
-    default:
-        ret = -EIO;
-        break;
-    }
-    return ret;
+    return - scsi_sense_to_errno(sense->key,
+                                 (sense->ascq & 0xFF00) >> 8,
+                                 sense->ascq & 0xFF);
 }
 
 /* Called (via iscsi_service) with QemuMutex held.  */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
new file mode 100644
index 0000000000..f894ace4bf
--- /dev/null
+++ b/include/scsi/scsi.h
@@ -0,0 +1,19 @@
+/*
+ *  SCSI helpers
+ *
+ *  Copyright 2017 Red Hat, Inc.
+ *
+ *  Authors:
+ *   Fam Zheng <famz@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+#ifndef QEMU_SCSI_H
+#define QEMU_SCSI_H
+
+int scsi_sense_to_errno(int key, int asc, int ascq);
+
+#endif
diff --git a/util/Makefile.objs b/util/Makefile.objs
index 50a55ecc75..c9e6c493d3 100644
--- a/util/Makefile.objs
+++ b/util/Makefile.objs
@@ -45,3 +45,4 @@ util-obj-y += qht.o
 util-obj-y += range.o
 util-obj-y += stats64.o
 util-obj-y += systemd.o
+util-obj-y += scsi.o
diff --git a/util/scsi.c b/util/scsi.c
new file mode 100644
index 0000000000..a6710799fc
--- /dev/null
+++ b/util/scsi.c
@@ -0,0 +1,52 @@
+/*
+ *  SCSI helpers
+ *
+ *  Copyright 2017 Red Hat, Inc.
+ *
+ *  Authors:
+ *   Fam Zheng <famz@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+#include "qemu/osdep.h"
+#include "scsi/scsi.h"
+
+int scsi_sense_to_errno(int key, int asc, int ascq)
+{
+    switch (key) {
+    case 0x02: /* NOT READY */
+        return EBUSY;
+    case 0x07: /* DATA PROTECTION */
+        return EACCES;
+    case 0x0b: /* COMMAND ABORTED */
+        return ECANCELED;
+    case 0x05: /* ILLEGAL REQUEST */
+        /* Parse ASCQ */
+        break;
+    default:
+        return EIO;
+    }
+    switch ((asc << 8) | ascq) {
+    case 0x1a00: /* PARAMETER LIST LENGTH ERROR */
+    case 0x2000: /* INVALID OPERATION CODE */
+    case 0x2400: /* INVALID FIELD IN CDB */
+    case 0x2600: /* INVALID FIELD IN PARAMETER LIST */
+        return EINVAL;
+    case 0x2100: /* LBA OUT OF RANGE */
+        return ENOSPC;
+    case 0x2500: /* LOGICAL UNIT NOT SUPPORTED */
+        return ENOTSUP;
+    case 0x3a00: /* MEDIUM NOT PRESENT */
+    case 0x3a01: /* MEDIUM NOT PRESENT TRAY CLOSED */
+    case 0x3a02: /* MEDIUM NOT PRESENT TRAY OPEN */
+        return ENOMEDIUM;
+    case 0x2700: /* WRITE PROTECTED */
+        return EACCES;
+    default:
+        return EIO;
+    }
+}
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH v4 2/4] scsi: Improve scsi_sense_to_errno
  2017-08-21 14:10 [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror Fam Zheng
  2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 1/4] scsi: Refactor scsi sense interpreting code Fam Zheng
@ 2017-08-21 14:10 ` Fam Zheng
  2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 3/4] scsi: Introduce scsi_sense_buf_to_errno Fam Zheng
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Fam Zheng @ 2017-08-21 14:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

Tweak the errno mapping to return more accurate/appropriate values.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 util/scsi.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/util/scsi.c b/util/scsi.c
index a6710799fc..472eb5bea5 100644
--- a/util/scsi.c
+++ b/util/scsi.c
@@ -18,13 +18,16 @@
 int scsi_sense_to_errno(int key, int asc, int ascq)
 {
     switch (key) {
-    case 0x02: /* NOT READY */
-        return EBUSY;
-    case 0x07: /* DATA PROTECTION */
-        return EACCES;
+    case 0x00: /* NO SENSE */
+    case 0x01: /* RECOVERED ERROR */
+    case 0x06: /* UNIT ATTENTION */
+        /* These sense keys are not errors */
+        return 0;
     case 0x0b: /* COMMAND ABORTED */
         return ECANCELED;
+    case 0x02: /* NOT READY */
     case 0x05: /* ILLEGAL REQUEST */
+    case 0x07: /* DATA PROTECTION */
         /* Parse ASCQ */
         break;
     default:
@@ -37,6 +40,7 @@ int scsi_sense_to_errno(int key, int asc, int ascq)
     case 0x2600: /* INVALID FIELD IN PARAMETER LIST */
         return EINVAL;
     case 0x2100: /* LBA OUT OF RANGE */
+    case 0x2707: /* SPACE ALLOC FAILED */
         return ENOSPC;
     case 0x2500: /* LOGICAL UNIT NOT SUPPORTED */
         return ENOTSUP;
@@ -46,6 +50,10 @@ int scsi_sense_to_errno(int key, int asc, int ascq)
         return ENOMEDIUM;
     case 0x2700: /* WRITE PROTECTED */
         return EACCES;
+    case 0x0401: /* NOT READY, IN PROGRESS OF BECOMING READY */
+        return EAGAIN;
+    case 0x0402: /* NOT READY, INITIALIZING COMMAND REQUIRED */
+        return ENOTCONN;
     default:
         return EIO;
     }
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH v4 3/4] scsi: Introduce scsi_sense_buf_to_errno
  2017-08-21 14:10 [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror Fam Zheng
  2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 1/4] scsi: Refactor scsi sense interpreting code Fam Zheng
  2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 2/4] scsi: Improve scsi_sense_to_errno Fam Zheng
@ 2017-08-21 14:10 ` Fam Zheng
  2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 4/4] scsi-block: Support rerror/werror Fam Zheng
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Fam Zheng @ 2017-08-21 14:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

This recognizes the "fixed" and "descriptor" format sense data, extracts
the sense key/asc/ascq fields then converts them to an errno.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 include/scsi/scsi.h |  1 +
 util/scsi.c         | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index f894ace4bf..fe330385d8 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -15,5 +15,6 @@
 #define QEMU_SCSI_H
 
 int scsi_sense_to_errno(int key, int asc, int ascq);
+int scsi_sense_buf_to_errno(const uint8_t *sense, size_t sense_size);
 
 #endif
diff --git a/util/scsi.c b/util/scsi.c
index 472eb5bea5..472293d59b 100644
--- a/util/scsi.c
+++ b/util/scsi.c
@@ -58,3 +58,33 @@ int scsi_sense_to_errno(int key, int asc, int ascq)
         return EIO;
     }
 }
+
+int scsi_sense_buf_to_errno(const uint8_t *sense, size_t sense_size)
+{
+    int key, asc, ascq;
+    if (sense_size < 1) {
+        return EIO;
+    }
+    switch (sense[0]) {
+    case 0x70: /* Fixed format sense data. */
+        if (sense_size < 14) {
+            return EIO;
+        }
+        key = sense[2] & 0xF;
+        asc = sense[12];
+        ascq = sense[13];
+        break;
+    case 0x72: /* Descriptor format sense data. */
+        if (sense_size < 4) {
+            return EIO;
+        }
+        key = sense[1] & 0xF;
+        asc = sense[2];
+        ascq = sense[3];
+        break;
+    default:
+        return EIO;
+        break;
+    }
+    return scsi_sense_to_errno(key, asc, ascq);
+}
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH v4 4/4] scsi-block: Support rerror/werror
  2017-08-21 14:10 [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror Fam Zheng
                   ` (2 preceding siblings ...)
  2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 3/4] scsi: Introduce scsi_sense_buf_to_errno Fam Zheng
@ 2017-08-21 14:10 ` Fam Zheng
  2017-08-21 17:26 ` [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror Paolo Bonzini
  2017-08-22  7:16 ` no-reply
  5 siblings, 0 replies; 8+ messages in thread
From: Fam Zheng @ 2017-08-21 14:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

This makes the werror/rerror options available on the scsi-block device,
to allow user specify error handling policy similar to scsi-hd.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 hw/scsi/scsi-disk.c | 38 ++++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 5f1e5e8070..cf38f93b9d 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -39,6 +39,7 @@ do { printf("scsi-disk: " fmt , ## __VA_ARGS__); } while (0)
 #include "hw/block/block.h"
 #include "sysemu/dma.h"
 #include "qemu/cutils.h"
+#include "scsi/scsi.h"
 
 #ifdef __linux
 #include <scsi/sg.h>
@@ -106,7 +107,7 @@ typedef struct SCSIDiskState
     bool tray_locked;
 } SCSIDiskState;
 
-static int scsi_handle_rw_error(SCSIDiskReq *r, int error, bool acct_failed);
+static bool scsi_handle_rw_error(SCSIDiskReq *r, int error, bool acct_failed);
 
 static void scsi_free_request(SCSIRequest *req)
 {
@@ -184,19 +185,10 @@ static bool scsi_disk_req_check_error(SCSIDiskReq *r, int ret, bool acct_failed)
         return true;
     }
 
-    if (ret < 0) {
+    if (ret < 0 || (r->status && *r->status)) {
         return scsi_handle_rw_error(r, -ret, acct_failed);
     }
 
-    if (r->status && *r->status) {
-        if (acct_failed) {
-            SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
-            block_acct_failed(blk_get_stats(s->qdev.conf.blk), &r->acct);
-        }
-        scsi_req_complete(&r->req, *r->status);
-        return true;
-    }
-
     return false;
 }
 
@@ -422,13 +414,13 @@ static void scsi_read_data(SCSIRequest *req)
 }
 
 /*
- * scsi_handle_rw_error has two return values.  0 means that the error
- * must be ignored, 1 means that the error has been processed and the
+ * scsi_handle_rw_error has two return values.  False means that the error
+ * must be ignored, true means that the error has been processed and the
  * caller should not do anything else for this request.  Note that
  * scsi_handle_rw_error always manages its reference counts, independent
  * of the return value.
  */
-static int scsi_handle_rw_error(SCSIDiskReq *r, int error, bool acct_failed)
+static bool scsi_handle_rw_error(SCSIDiskReq *r, int error, bool acct_failed)
 {
     bool is_read = (r->req.cmd.mode == SCSI_XFER_FROM_DEV);
     SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
@@ -440,6 +432,11 @@ static int scsi_handle_rw_error(SCSIDiskReq *r, int error, bool acct_failed)
             block_acct_failed(blk_get_stats(s->qdev.conf.blk), &r->acct);
         }
         switch (error) {
+        case 0:
+            /* The command has run, no need to fake sense.  */
+            assert(r->status && *r->status);
+            scsi_req_complete(&r->req, *r->status);
+            break;
         case ENOMEDIUM:
             scsi_check_condition(r, SENSE_CODE(NO_MEDIUM));
             break;
@@ -457,6 +454,18 @@ static int scsi_handle_rw_error(SCSIDiskReq *r, int error, bool acct_failed)
             break;
         }
     }
+    if (!error) {
+        assert(r->status && *r->status);
+        error = scsi_sense_buf_to_errno(r->req.sense, sizeof(r->req.sense));
+
+        if (error == ECANCELED || error == EAGAIN || error == ENOTCONN ||
+            error == 0)  {
+            /* These errors are handled by guest. */
+            scsi_req_complete(&r->req, *r->status);
+            return true;
+        }
+    }
+
     blk_error_action(s->qdev.conf.blk, action, is_read, error);
     if (action == BLOCK_ERROR_ACTION_STOP) {
         scsi_req_retry(&r->req);
@@ -2972,6 +2981,7 @@ static const TypeInfo scsi_cd_info = {
 
 #ifdef __linux__
 static Property scsi_block_properties[] = {
+    DEFINE_BLOCK_ERROR_PROPERTIES(SCSIDiskState, qdev.conf),         \
     DEFINE_PROP_DRIVE("drive", SCSIDiskState, qdev.conf.blk),
     DEFINE_PROP_END_OF_LIST(),
 };
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror
  2017-08-21 14:10 [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror Fam Zheng
                   ` (3 preceding siblings ...)
  2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 4/4] scsi-block: Support rerror/werror Fam Zheng
@ 2017-08-21 17:26 ` Paolo Bonzini
  2017-08-22  7:16 ` no-reply
  5 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2017-08-21 17:26 UTC (permalink / raw)
  To: Fam Zheng; +Cc: qemu-devel

----- Original Message -----
> From: "Fam Zheng" <famz@redhat.com>
> To: qemu-devel@nongnu.org
> Cc: "Paolo Bonzini" <pbonzini@redhat.com>
> Sent: Monday, August 21, 2017 4:10:04 PM
> Subject: [PATCH v4 0/4] scsi-block: Support werror/rerror
> 
> v4: Handle more sense keys/ascqs. [Paolo]
>     Add scsi_sense_buf_to_errno to util/scsi.c. [Paolo]
>     Shorten the comment notes on SCSI constants.
> 
> v3: Enhance and reuse iscsi sense data translation. [Paolo]
> 
> First refactor and enhance the code in iscsi for sense data translation, then
> modify error handing of scsi-block and expose the qdev properties.
> 
> Fam Zheng (4):
>   scsi: Refactor scsi sense interpreting code
>   scsi: Improve scsi_sense_to_errno
>   scsi: Introduce scsi_sense_buf_to_errno
>   scsi-block: Support rerror/werror

Looks good, thanks!

Paolo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror
  2017-08-21 14:10 [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror Fam Zheng
                   ` (4 preceding siblings ...)
  2017-08-21 17:26 ` [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror Paolo Bonzini
@ 2017-08-22  7:16 ` no-reply
  5 siblings, 0 replies; 8+ messages in thread
From: no-reply @ 2017-08-22  7:16 UTC (permalink / raw)
  To: famz; +Cc: qemu-devel, pbonzini

Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20170821141008.19383-1-famz@redhat.com
Subject: [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
2c3500c6c6 scsi-block: Support rerror/werror
05189062ee scsi: Introduce scsi_sense_buf_to_errno
71fe29752d scsi: Improve scsi_sense_to_errno
e0bc108941 scsi: Refactor scsi sense interpreting code

=== OUTPUT BEGIN ===
Checking PATCH 1/4: scsi: Refactor scsi sense interpreting code...
ERROR: space prohibited after that '-' (ctx:WxW)
#84: FILE: block/iscsi.c:213:
+    return - scsi_sense_to_errno(sense->key,
            ^

ERROR: return of an errno should typically be -ve (return -EBUSY)
#151: FILE: util/scsi.c:22:
+        return EBUSY;

ERROR: return of an errno should typically be -ve (return -EACCES)
#153: FILE: util/scsi.c:24:
+        return EACCES;

ERROR: return of an errno should typically be -ve (return -ECANCELED)
#155: FILE: util/scsi.c:26:
+        return ECANCELED;

ERROR: return of an errno should typically be -ve (return -EIO)
#160: FILE: util/scsi.c:31:
+        return EIO;

ERROR: return of an errno should typically be -ve (return -EINVAL)
#167: FILE: util/scsi.c:38:
+        return EINVAL;

ERROR: return of an errno should typically be -ve (return -ENOSPC)
#169: FILE: util/scsi.c:40:
+        return ENOSPC;

ERROR: return of an errno should typically be -ve (return -ENOTSUP)
#171: FILE: util/scsi.c:42:
+        return ENOTSUP;

ERROR: return of an errno should typically be -ve (return -ENOMEDIUM)
#175: FILE: util/scsi.c:46:
+        return ENOMEDIUM;

ERROR: return of an errno should typically be -ve (return -EACCES)
#177: FILE: util/scsi.c:48:
+        return EACCES;

ERROR: return of an errno should typically be -ve (return -EIO)
#179: FILE: util/scsi.c:50:
+        return EIO;

total: 11 errors, 0 warnings, 141 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 2/4: scsi: Improve scsi_sense_to_errno...
ERROR: return of an errno should typically be -ve (return -EAGAIN)
#49: FILE: util/scsi.c:54:
+        return EAGAIN;

ERROR: return of an errno should typically be -ve (return -ENOTCONN)
#51: FILE: util/scsi.c:56:
+        return ENOTCONN;

total: 2 errors, 0 warnings, 37 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 3/4: scsi: Introduce scsi_sense_buf_to_errno...
ERROR: return of an errno should typically be -ve (return -EIO)
#36: FILE: util/scsi.c:66:
+        return EIO;

ERROR: return of an errno should typically be -ve (return -EIO)
#41: FILE: util/scsi.c:71:
+            return EIO;

ERROR: return of an errno should typically be -ve (return -EIO)
#49: FILE: util/scsi.c:79:
+            return EIO;

ERROR: return of an errno should typically be -ve (return -EIO)
#56: FILE: util/scsi.c:86:
+        return EIO;

total: 4 errors, 0 warnings, 39 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 4/4: scsi-block: Support rerror/werror...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v4 1/4] scsi: Refactor scsi sense interpreting code
  2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 1/4] scsi: Refactor scsi sense interpreting code Fam Zheng
@ 2017-08-22 13:22   ` Paolo Bonzini
  0 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2017-08-22 13:22 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel

On 21/08/2017 16:10, Fam Zheng wrote:
> So that it can be reused outside of iscsi.c.
> 
> Also update MAINTAINERS to include the new files in SCSI section.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  MAINTAINERS         |  2 ++
>  block/iscsi.c       | 45 ++++-----------------------------------------
>  include/scsi/scsi.h | 19 +++++++++++++++++++
>  util/Makefile.objs  |  1 +
>  util/scsi.c         | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 78 insertions(+), 41 deletions(-)

I've now introduced a more comprehensive scsi/utils.c.  No need to do
anything, I'll pick your file when I rebase the multipath patches I've
just sent.

Paolo

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-08-22 13:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-21 14:10 [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror Fam Zheng
2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 1/4] scsi: Refactor scsi sense interpreting code Fam Zheng
2017-08-22 13:22   ` Paolo Bonzini
2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 2/4] scsi: Improve scsi_sense_to_errno Fam Zheng
2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 3/4] scsi: Introduce scsi_sense_buf_to_errno Fam Zheng
2017-08-21 14:10 ` [Qemu-devel] [PATCH v4 4/4] scsi-block: Support rerror/werror Fam Zheng
2017-08-21 17:26 ` [Qemu-devel] [PATCH v4 0/4] scsi-block: Support werror/rerror Paolo Bonzini
2017-08-22  7:16 ` no-reply

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.