@@ -582,21 +582,27 @@ static int scsifront_queuecommand(struct Scsi_Host *shost,
* We have to wait until an answer is returned. This answer contains the
* result to be returned to the requestor.
*/
-static int scsifront_action_handler(struct scsi_cmnd *sc, uint8_t act)
+static int scsifront_action_handler(struct scsi_device *sdev,
+ struct scsi_cmnd *sc)
{
- struct Scsi_Host *host = sc->device->host;
+ struct Scsi_Host *host = sdev->host;
struct vscsifrnt_info *info = shost_priv(host);
- struct vscsifrnt_shadow *shadow, *s = scsi_cmd_priv(sc);
+ struct vscsifrnt_shadow *shadow, *s;
int err = 0;
shadow = kzalloc(sizeof(*shadow), GFP_NOIO);
if (!shadow)
return FAILED;
- shadow->act = act;
shadow->rslt_reset = RSLT_RESET_WAITING;
shadow->sc = sc;
- shadow->ref_rqid = s->rqid;
+ if (sc) {
+ s = scsi_cmd_priv(sc);
+ shadow->ref_rqid = s->rqid;
+ shadow->act = VSCSIIF_ACT_SCSI_ABORT;
+ } else
+ shadow->act = VSCSIIF_ACT_SCSI_RESET;
+
init_waitqueue_head(&shadow->wq_reset);
spin_lock_irq(host->host_lock);
@@ -646,13 +652,13 @@ static int scsifront_action_handler(struct scsi_cmnd *sc, uint8_t act)
static int scsifront_eh_abort_handler(struct scsi_cmnd *sc)
{
pr_debug("%s\n", __func__);
- return scsifront_action_handler(sc, VSCSIIF_ACT_SCSI_ABORT);
+ return scsifront_action_handler(sc->device, sc);
}
static int scsifront_dev_reset_handler(struct scsi_cmnd *sc)
{
pr_debug("%s\n", __func__);
- return scsifront_action_handler(sc, VSCSIIF_ACT_SCSI_RESET);
+ return scsifront_action_handler(sc->device, NULL);
}
static int scsifront_sdev_configure(struct scsi_device *sdev)
For device reset we shouldn't rely on the scsi command, so allow scsifront_action_handler() to be called with a NULL command argument. Signed-off-by: Hannes Reinecke <hare@suse.com> --- drivers/scsi/xen-scsifront.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)