nvmf: Fail incoming commands to an inactive subsystem

Eventually this should probably queue, but for now
just fail these commands.

Change-Id: Ie1b1088aa38198c17062ac9874539ad6d99b01eb
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/394125
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Ben Walker 2018-01-09 15:23:27 -07:00 committed by Jim Harris
parent 823b565b5f
commit 6711e5a525

View File

@ -118,6 +118,19 @@ spdk_nvmf_request_exec(struct spdk_nvmf_request *req)
nvmf_trace_command(req->cmd, qpair->type);
/* Check if the subsystem is paused (if there is a subsystem) */
if (qpair->ctrlr) {
if (qpair->group->sgroups[qpair->ctrlr->subsys->id].state != SPDK_NVMF_SUBSYSTEM_ACTIVE) {
struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl;
/* TODO: Queue requests here instead of failing */
rsp->status.sct = SPDK_NVME_SCT_GENERIC;
rsp->status.sc = SPDK_NVME_SC_INTERNAL_DEVICE_ERROR;
spdk_nvmf_request_complete(req);
return;
}
}
if (spdk_unlikely(req->cmd->nvmf_cmd.opcode == SPDK_NVME_OPC_FABRIC)) {
status = spdk_nvmf_ctrlr_process_fabrics_cmd(req);
} else if (spdk_unlikely(qpair->type == QPAIR_TYPE_AQ)) {