[Devel] [PATCH RHEL7 COMMIT] scsi/debug: make scsi error loud

Konstantin Khorenko khorenko at virtuozzo.com
Mon Nov 14 01:42:12 PST 2016


The commit is pushed to "branch-rh7-3.10.0-327.36.1.vz7.19.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.36.1.vz7.19.8
------>
commit 4ec5256e33ede697a89bef7280a63c3dc09eeec0
Author: Dmitry Monakhov <dmonakhov at openvz.org>
Date:   Mon Nov 14 13:42:08 2016 +0400

    scsi/debug: make scsi error loud
    
    This patch is not for release, testing purpose only.
    We need it in order to investigate
    
    https://jira.sw.ru/browse/PSBM-54665
    
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 drivers/scsi/hosts.c       | 13 +++++++------
 drivers/scsi/virtio_scsi.c | 20 ++++++++++++++++----
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 287045b..7364d86 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -141,12 +141,13 @@ int scsi_host_set_state(struct Scsi_Host *shost, enum scsi_host_state state)
 	return 0;
 
  illegal:
-	SCSI_LOG_ERROR_RECOVERY(1,
-				shost_printk(KERN_ERR, shost,
-					     "Illegal host state transition"
-					     "%s->%s\n",
-					     scsi_host_state_name(oldstate),
-					     scsi_host_state_name(state)));
+	shost_printk(KERN_ERR, shost,
+		     "Illegal host state transition"
+		     "%s->%s\n",
+		     scsi_host_state_name(oldstate),
+		     scsi_host_state_name(state));
+	dump_stack();
+
 	return -EINVAL;
 }
 EXPORT_SYMBOL(scsi_host_set_state);
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 573574b..c2e3307 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -61,6 +61,13 @@ struct virtio_scsi_vq {
 	struct virtqueue *vq;
 };
 
+#define __check_ret(val) do {				\
+		if (val == FAILED) {			\
+			printk("virtscsi_failure");	\
+			dump_stack();			\
+		}					\
+	} while(0)
+
 /*
  * Per-target queue state.
  *
@@ -489,6 +496,7 @@ static int virtscsi_add_cmd(struct virtqueue *vq,
 	return virtqueue_add_sgs(vq, sgs, out_num, in_num, cmd, GFP_ATOMIC);
 }
 
+
 static int virtscsi_kick_cmd(struct virtio_scsi_vq *vq,
 			     struct virtio_scsi_cmd *cmd,
 			     size_t req_size, size_t resp_size)
@@ -633,6 +641,7 @@ static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd)
 	virtscsi_poll_requests(vscsi);
 
 out:
+	__check_ret(ret);
 	mempool_free(cmd, virtscsi_cmd_pool);
 	return ret;
 }
@@ -644,8 +653,10 @@ static int virtscsi_device_reset(struct scsi_cmnd *sc)
 
 	sdev_printk(KERN_INFO, sc->device, "device reset\n");
 	cmd = mempool_alloc(virtscsi_cmd_pool, GFP_NOIO);
-	if (!cmd)
+	if (!cmd) {
+		__check_ret(FAILED);
 		return FAILED;
+	}
 
 	memset(cmd, 0, sizeof(*cmd));
 	cmd->sc = sc;
@@ -666,11 +677,12 @@ static int virtscsi_abort(struct scsi_cmnd *sc)
 	struct virtio_scsi *vscsi = shost_priv(sc->device->host);
 	struct virtio_scsi_cmd *cmd;
 
-	scmd_printk(KERN_INFO, sc, "abort\n");
+	scmd_printk(KERN_INFO, sc, "%s abort\n", __FUNCTION__);
 	cmd = mempool_alloc(virtscsi_cmd_pool, GFP_NOIO);
-	if (!cmd)
+	if (!cmd) {
+		__check_ret(FAILED);
 		return FAILED;
-
+	}
 	memset(cmd, 0, sizeof(*cmd));
 	cmd->sc = sc;
 	cmd->req.tmf = (struct virtio_scsi_ctrl_tmf_req){


More information about the Devel mailing list