Add support for reserved timeout handling. Any driver which specifies that it supports reserved tags must supply a handler. Signed-off-by: John Garry <john.garry@xxxxxxxxxx> --- drivers/scsi/hosts.c | 15 +++++++++++---- drivers/scsi/scsi_error.c | 3 +++ include/scsi/scsi_host.h | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 78968553089f..52346085b3c1 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -230,10 +230,17 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, goto fail; } - if (shost->nr_reserved_cmds && !sht->reserved_queuecommand) { - shost_printk(KERN_ERR, shost, - "nr_reserved_cmds set but no method to queue\n"); - goto fail; + if (shost->nr_reserved_cmds) { + if (!sht->reserved_queuecommand) { + shost_printk(KERN_ERR, shost, + "nr_reserved_cmds set but no method to queue\n"); + goto fail; + } + if (!sht->reserved_timedout) { + shost_printk(KERN_ERR, shost, + "nr_reserved_cmds set but no method to handle timeouts\n"); + goto fail; + } } /* Use min_t(int, ...) in case shost->can_queue exceeds SHRT_MAX */ diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 6995c8979230..2f86a4284f29 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -338,6 +338,9 @@ enum blk_eh_timer_return scsi_timeout(struct request *req) if (host->eh_deadline != -1 && !host->last_reset) host->last_reset = jiffies; + if (blk_mq_is_reserved_rq(req)) + return host->hostt->reserved_timedout(scmd); + if (host->hostt->eh_timed_out) rtn = host->hostt->eh_timed_out(scmd); diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index a39f36aa0b0d..266c13e731de 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -74,6 +74,7 @@ struct scsi_host_template { */ int (* queuecommand)(struct Scsi_Host *, struct scsi_cmnd *); int (*reserved_queuecommand)(struct Scsi_Host *, struct scsi_cmnd *); + enum blk_eh_timer_return (*reserved_timedout)(struct scsi_cmnd *); /* * The commit_rqs function is used to trigger a hardware -- 2.35.3