···111111 }112112}113113114114-static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd)114114+static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd, unsigned long msecs)115115{116116 struct request *rq = scsi_cmd_to_rq(cmd);117117···121121 } else {122122 WARN_ON_ONCE(true);123123 }124124- blk_mq_requeue_request(rq, true);124124+125125+ if (msecs) {126126+ blk_mq_requeue_request(rq, false);127127+ blk_mq_delay_kick_requeue_list(rq->q, msecs);128128+ } else129129+ blk_mq_requeue_request(rq, true);125130}126131127132/**···656651 return bytes;657652}658653659659-/* Helper for scsi_io_completion() when "reprep" action required. */660660-static void scsi_io_completion_reprep(struct scsi_cmnd *cmd,661661- struct request_queue *q)662662-{663663- /* A new command will be prepared and issued. */664664- scsi_mq_requeue_cmd(cmd);665665-}666666-667654static bool scsi_cmd_runtime_exceeced(struct scsi_cmnd *cmd)668655{669656 struct request *req = scsi_cmd_to_rq(cmd);···673676 return false;674677}675678679679+/*680680+ * When ALUA transition state is returned, reprep the cmd to681681+ * use the ALUA handler's transition timeout. Delay the reprep682682+ * 1 sec to avoid aggressive retries of the target in that683683+ * state.684684+ */685685+#define ALUA_TRANSITION_REPREP_DELAY 1000686686+676687/* Helper for scsi_io_completion() when special action required. */677688static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result)678689{679679- struct request_queue *q = cmd->device->request_queue;680690 struct request *req = scsi_cmd_to_rq(cmd);681691 int level = 0;682682- enum {ACTION_FAIL, ACTION_REPREP, ACTION_RETRY,683683- ACTION_DELAYED_RETRY} action;692692+ enum {ACTION_FAIL, ACTION_REPREP, ACTION_DELAYED_REPREP,693693+ ACTION_RETRY, ACTION_DELAYED_RETRY} action;684694 struct scsi_sense_hdr sshdr;685695 bool sense_valid;686696 bool sense_current = true; /* false implies "deferred sense" */···776772 action = ACTION_DELAYED_RETRY;777773 break;778774 case 0x0a: /* ALUA state transition */779779- blk_stat = BLK_STS_TRANSPORT;780780- fallthrough;775775+ action = ACTION_DELAYED_REPREP;776776+ break;781777 default:782778 action = ACTION_FAIL;783779 break;···836832 return;837833 fallthrough;838834 case ACTION_REPREP:839839- scsi_io_completion_reprep(cmd, q);835835+ scsi_mq_requeue_cmd(cmd, 0);836836+ break;837837+ case ACTION_DELAYED_REPREP:838838+ scsi_mq_requeue_cmd(cmd, ALUA_TRANSITION_REPREP_DELAY);840839 break;841840 case ACTION_RETRY:842841 /* Retry the same command immediately */···933926 * command block will be released and the queue function will be goosed. If we934927 * are not done then we have to figure out what to do next:935928 *936936- * a) We can call scsi_io_completion_reprep(). The request will be929929+ * a) We can call scsi_mq_requeue_cmd(). The request will be937930 * unprepared and put back on the queue. Then a new command will938931 * be created for it. This should be used if we made forward939932 * progress, or if we want to switch from READ(10) to READ(6) for···949942void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)950943{951944 int result = cmd->result;952952- struct request_queue *q = cmd->device->request_queue;953945 struct request *req = scsi_cmd_to_rq(cmd);954946 blk_status_t blk_stat = BLK_STS_OK;955947···985979 * request just queue the command up again.986980 */987981 if (likely(result == 0))988988- scsi_io_completion_reprep(cmd, q);982982+ scsi_mq_requeue_cmd(cmd, 0);989983 else990984 scsi_io_completion_action(cmd, result);991985}
+1-1
drivers/scsi/storvsc_drv.c
···20122012 */20132013 host_dev->handle_error_wq =20142014 alloc_ordered_workqueue("storvsc_error_wq_%d",20152015- WQ_MEM_RECLAIM,20152015+ 0,20162016 host->host_no);20172017 if (!host_dev->handle_error_wq) {20182018 ret = -ENOMEM;