nvmf: Temporarily remove hot plug support

The current hot plug support assumes only one thread
can access a subsystem at a time, but now that we're
changing that this will need to be reworked. In the
interest of making it easier to change the threading
model, remove hot plug support temporarily. We'll add
it back in once the threading model changes are done.

Change-Id: I15b75b402b85aa62f5ba864a64cde1de3cdb4ba3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/376417
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2017-08-29 14:43:30 -07:00 committed by Daniel Verkamp
parent b163dc0216
commit 496ba0d273
4 changed files with 3 additions and 70 deletions

View File

@ -542,20 +542,6 @@ spdk_nvmf_property_set(struct spdk_nvmf_ctrlr *ctrlr,
int
spdk_nvmf_ctrlr_poll(struct spdk_nvmf_ctrlr *ctrlr)
{
struct spdk_nvmf_subsystem *subsys = ctrlr->subsys;
if (subsys->is_removed) {
if (ctrlr->aer_req) {
struct spdk_nvmf_request *aer = ctrlr->aer_req;
aer->rsp->nvme_cpl.status.sct = SPDK_NVME_SCT_GENERIC;
aer->rsp->nvme_cpl.status.sc = SPDK_NVME_SC_ABORTED_SQ_DELETION;
aer->rsp->nvme_cpl.status.dnr = 0;
spdk_nvmf_request_complete(aer);
ctrlr->aer_req = NULL;
}
}
return spdk_nvmf_poll_group_poll(ctrlr->group);
}

View File

@ -175,7 +175,6 @@ struct spdk_nvmf_subsystem {
uint32_t id;
char subnqn[SPDK_NVMF_NQN_MAX_LEN + 1];
enum spdk_nvmf_subtype subtype;
bool is_removed;
bool allow_any_host;
struct spdk_nvmf_tgt *tgt;

View File

@ -273,17 +273,7 @@ spdk_nvmf_request_exec_on_master(void *ctx)
rsp->status.sc = SPDK_NVME_SC_COMMAND_SEQUENCE_ERROR;
status = SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
} else {
struct spdk_nvmf_subsystem *subsystem;
subsystem = ctrlr->subsys;
assert(subsystem != NULL);
if (subsystem->is_removed) {
rsp->status.sc = SPDK_NVME_SC_ABORTED_BY_REQUEST;
status = SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
} else {
status = spdk_nvmf_ctrlr_process_admin_cmd(req);
}
status = spdk_nvmf_ctrlr_process_admin_cmd(req);
}
switch (status) {
@ -326,19 +316,7 @@ spdk_nvmf_request_exec(struct spdk_nvmf_request *req)
rsp->status.sc = SPDK_NVME_SC_COMMAND_SEQUENCE_ERROR;
status = SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
} else {
struct spdk_nvmf_subsystem *subsystem = ctrlr->subsys;
assert(subsystem != NULL);
/* TODO: subsystem->is_removed is touched by multiple threads.
* This needs stronger synchronization.
*/
if (subsystem->is_removed) {
rsp->status.sc = SPDK_NVME_SC_ABORTED_BY_REQUEST;
status = SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
} else {
status = spdk_nvmf_ctrlr_process_io_cmd(req);
}
status = spdk_nvmf_ctrlr_process_io_cmd(req);
}
switch (status) {

View File

@ -50,25 +50,6 @@ spdk_nvmf_subsystem_start(struct spdk_nvmf_subsystem *subsystem)
return spdk_nvmf_subsystem_bdev_attach(subsystem);
}
static bool
nvmf_subsystem_removable(struct spdk_nvmf_subsystem *subsystem)
{
struct spdk_nvmf_ctrlr *ctrlr;
struct spdk_nvmf_qpair *qpair;
if (subsystem->is_removed) {
TAILQ_FOREACH(ctrlr, &subsystem->ctrlrs, link) {
TAILQ_FOREACH(qpair, &ctrlr->qpairs, link) {
if (!spdk_nvmf_transport_qpair_is_idle(qpair)) {
return false;
}
}
}
return true;
}
return false;
}
void
spdk_nvmf_subsystem_poll(struct spdk_nvmf_subsystem *subsystem)
{
@ -78,10 +59,6 @@ spdk_nvmf_subsystem_poll(struct spdk_nvmf_subsystem *subsystem)
/* For each connection in the ctrlr, check for completions */
spdk_nvmf_ctrlr_poll(ctrlr);
}
if (nvmf_subsystem_removable(subsystem)) {
spdk_nvmf_subsystem_bdev_detach(subsystem);
}
}
static bool
@ -338,13 +315,6 @@ spdk_nvmf_listener_get_trid(struct spdk_nvmf_listener *listener)
return &listener->trid;
}
static void spdk_nvmf_ctrlr_hot_remove(void *remove_ctx)
{
struct spdk_nvmf_subsystem *subsystem = (struct spdk_nvmf_subsystem *)remove_ctx;
subsystem->is_removed = true;
}
uint32_t
spdk_nvmf_subsystem_add_ns(struct spdk_nvmf_subsystem *subsystem, struct spdk_bdev *bdev,
uint32_t nsid)
@ -405,7 +375,7 @@ spdk_nvmf_subsystem_add_ns(struct spdk_nvmf_subsystem *subsystem, struct spdk_bd
memset(ns, 0, sizeof(*ns));
ns->bdev = bdev;
ns->id = nsid;
rc = spdk_bdev_open(bdev, true, spdk_nvmf_ctrlr_hot_remove, subsystem, &ns->desc);
rc = spdk_bdev_open(bdev, true, NULL, NULL, &ns->desc);
if (rc != 0) {
SPDK_ERRLOG("Subsystem %s: bdev %s cannot be opened, error=%d\n",
subsystem->subnqn, spdk_bdev_get_name(bdev), rc);