Commit 6711e5a5 authored by Ben Walker's avatar Ben Walker Committed by Jim Harris
Browse files

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: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/394125


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 823b565b
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -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)) {