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@huawei.com>
---
drivers/scsi/hosts.c | 15 +++++++++++----
drivers/scsi/scsi_error.c | 3 +++
include/scsi/scsi_host.h | 1 +
3 files changed, 15 insertions(+), 4 deletions(-)
@@ -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 */
@@ -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);
@@ -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