[Devel] [PATCH] scsi: make scsi error laud
Dmitry Monakhov
dmonakhov at openvz.org
Fri Nov 11 06:54:24 PST 2016
This patch is not for release, testing purpose only.
We need it in order to investigate #PSBM-54665
Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
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){
--
2.7.4
More information about the Devel
mailing list