|
@@ -536,30 +536,32 @@ static struct nvmf_transport_ops *nvmf_lookup_transport(
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
-blk_status_t nvmf_check_if_ready(struct nvme_ctrl *ctrl, struct request *rq,
|
|
|
|
- bool queue_live, bool is_connected)
|
|
|
|
|
|
+/*
|
|
|
|
+ * For something we're not in a state to send to the device the default action
|
|
|
|
+ * is to busy it and retry it after the controller state is recovered. However,
|
|
|
|
+ * anything marked for failfast or nvme multipath is immediately failed.
|
|
|
|
+ *
|
|
|
|
+ * Note: commands used to initialize the controller will be marked for failfast.
|
|
|
|
+ * Note: nvme cli/ioctl commands are marked for failfast.
|
|
|
|
+ */
|
|
|
|
+blk_status_t nvmf_fail_nonready_command(struct request *rq)
|
|
{
|
|
{
|
|
- struct nvme_command *cmd = nvme_req(rq)->cmd;
|
|
|
|
|
|
+ if (!blk_noretry_request(rq) && !(rq->cmd_flags & REQ_NVME_MPATH))
|
|
|
|
+ return BLK_STS_RESOURCE;
|
|
|
|
+ nvme_req(rq)->status = NVME_SC_ABORT_REQ;
|
|
|
|
+ return BLK_STS_IOERR;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(nvmf_fail_nonready_command);
|
|
|
|
|
|
- if (likely(ctrl->state == NVME_CTRL_LIVE && is_connected))
|
|
|
|
- return BLK_STS_OK;
|
|
|
|
|
|
+bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
|
|
|
|
+ bool queue_live)
|
|
|
|
+{
|
|
|
|
+ struct nvme_command *cmd = nvme_req(rq)->cmd;
|
|
|
|
|
|
switch (ctrl->state) {
|
|
switch (ctrl->state) {
|
|
case NVME_CTRL_NEW:
|
|
case NVME_CTRL_NEW:
|
|
case NVME_CTRL_CONNECTING:
|
|
case NVME_CTRL_CONNECTING:
|
|
case NVME_CTRL_DELETING:
|
|
case NVME_CTRL_DELETING:
|
|
- /*
|
|
|
|
- * This is the case of starting a new or deleting an association
|
|
|
|
- * but connectivity was lost before it was fully created or torn
|
|
|
|
- * down. We need to error the commands used to initialize the
|
|
|
|
- * controller so the reconnect can go into a retry attempt. The
|
|
|
|
- * commands should all be marked REQ_FAILFAST_DRIVER, which will
|
|
|
|
- * hit the reject path below. Anything else will be queued while
|
|
|
|
- * the state settles.
|
|
|
|
- */
|
|
|
|
- if (!is_connected)
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* If queue is live, allow only commands that are internally
|
|
* If queue is live, allow only commands that are internally
|
|
* generated pass through. These are commands on the admin
|
|
* generated pass through. These are commands on the admin
|
|
@@ -567,7 +569,7 @@ blk_status_t nvmf_check_if_ready(struct nvme_ctrl *ctrl, struct request *rq,
|
|
* ioctl admin cmds received while initializing.
|
|
* ioctl admin cmds received while initializing.
|
|
*/
|
|
*/
|
|
if (queue_live && !(nvme_req(rq)->flags & NVME_REQ_USERCMD))
|
|
if (queue_live && !(nvme_req(rq)->flags & NVME_REQ_USERCMD))
|
|
- return BLK_STS_OK;
|
|
|
|
|
|
+ return true;
|
|
|
|
|
|
/*
|
|
/*
|
|
* If the queue is not live, allow only a connect command. This
|
|
* If the queue is not live, allow only a connect command. This
|
|
@@ -577,26 +579,13 @@ blk_status_t nvmf_check_if_ready(struct nvme_ctrl *ctrl, struct request *rq,
|
|
if (!queue_live && blk_rq_is_passthrough(rq) &&
|
|
if (!queue_live && blk_rq_is_passthrough(rq) &&
|
|
cmd->common.opcode == nvme_fabrics_command &&
|
|
cmd->common.opcode == nvme_fabrics_command &&
|
|
cmd->fabrics.fctype == nvme_fabrics_type_connect)
|
|
cmd->fabrics.fctype == nvme_fabrics_type_connect)
|
|
- return BLK_STS_OK;
|
|
|
|
- break;
|
|
|
|
|
|
+ return true;
|
|
|
|
+ return false;
|
|
default:
|
|
default:
|
|
- break;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
- /*
|
|
|
|
- * Any other new io is something we're not in a state to send to the
|
|
|
|
- * device. Default action is to busy it and retry it after the
|
|
|
|
- * controller state is recovered. However, anything marked for failfast
|
|
|
|
- * or nvme multipath is immediately failed. Note: commands used to
|
|
|
|
- * initialize the controller will be marked for failfast.
|
|
|
|
- * Note: nvme cli/ioctl commands are marked for failfast.
|
|
|
|
- */
|
|
|
|
- if (!blk_noretry_request(rq) && !(rq->cmd_flags & REQ_NVME_MPATH))
|
|
|
|
- return BLK_STS_RESOURCE;
|
|
|
|
- nvme_req(rq)->status = NVME_SC_ABORT_REQ;
|
|
|
|
- return BLK_STS_IOERR;
|
|
|
|
}
|
|
}
|
|
-EXPORT_SYMBOL_GPL(nvmf_check_if_ready);
|
|
|
|
|
|
+EXPORT_SYMBOL_GPL(__nvmf_check_ready);
|
|
|
|
|
|
static const match_table_t opt_tokens = {
|
|
static const match_table_t opt_tokens = {
|
|
{ NVMF_OPT_TRANSPORT, "transport=%s" },
|
|
{ NVMF_OPT_TRANSPORT, "transport=%s" },
|