[Devel] scsi: make scsi error laud

Submitted by Dmitry Monakhov on Nov. 11, 2016, 2:54 p.m.

Details

Message ID 1478876064-19874-1-git-send-email-dmonakhov@openvz.org
State New
Series "scsi: make scsi error laud"
Headers show

Commit Message

Dmitry Monakhov Nov. 11, 2016, 2:54 p.m.
This patch is not for release, testing purpose only.
We need it in order to investigate #PSBM-54665

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>

Patch hide | download patch | download mbox

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){