nvmf: Hot plug notifications now use the subsystem pause functionality
Use the general purpose mechanism to pause a subsystem when a bdev is hot removed. Change-Id: I3cd4fb15140d6682707b7840c6a9c3f63fe48e55 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/394259 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:
parent
d346b9c5a2
commit
7358fb6f85
@ -813,7 +813,7 @@ spdk_nvmf_ctrlr_identify_ns(struct spdk_nvmf_subsystem *subsystem,
|
||||
struct spdk_nvmf_ns *ns;
|
||||
|
||||
ns = _spdk_nvmf_subsystem_get_ns(subsystem, cmd->nsid);
|
||||
if (ns == NULL || ns->bdev == NULL || ns->is_removed) {
|
||||
if (ns == NULL || ns->bdev == NULL) {
|
||||
SPDK_ERRLOG("Identify Namespace for invalid NSID %u\n", cmd->nsid);
|
||||
rsp->status.sc = SPDK_NVME_SC_INVALID_NAMESPACE_OR_FORMAT;
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
@ -913,7 +913,7 @@ spdk_nvmf_ctrlr_identify_active_ns_list(struct spdk_nvmf_subsystem *subsystem,
|
||||
|
||||
for (ns = spdk_nvmf_subsystem_get_first_ns(subsystem); ns != NULL;
|
||||
ns = spdk_nvmf_subsystem_get_next_ns(subsystem, ns)) {
|
||||
if (ns->id <= cmd->nsid || ns->is_removed) {
|
||||
if (ns->id <= cmd->nsid) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -404,7 +404,7 @@ spdk_nvmf_ctrlr_process_io_cmd(struct spdk_nvmf_request *req)
|
||||
}
|
||||
|
||||
ns = _spdk_nvmf_subsystem_get_ns(ctrlr->subsys, nsid);
|
||||
if (ns == NULL || ns->bdev == NULL || ns->is_removed) {
|
||||
if (ns == NULL || ns->bdev == NULL) {
|
||||
SPDK_ERRLOG("Unsuccessful query for nsid %u\n", cmd->nsid);
|
||||
response->status.sc = SPDK_NVME_SC_INVALID_NAMESPACE_OR_FORMAT;
|
||||
response->status.dnr = 1;
|
||||
|
@ -141,7 +141,6 @@ struct spdk_nvmf_ns {
|
||||
struct spdk_bdev_desc *desc;
|
||||
uint32_t id;
|
||||
bool allocated;
|
||||
bool is_removed;
|
||||
};
|
||||
|
||||
enum spdk_nvmf_qpair_type {
|
||||
|
@ -710,6 +710,9 @@ spdk_nvmf_subsystem_remove_ns(struct spdk_nvmf_subsystem *subsystem, uint32_t ns
|
||||
{
|
||||
struct spdk_nvmf_ns *ns;
|
||||
|
||||
assert(subsystem->state == SPDK_NVMF_SUBSYSTEM_PAUSED ||
|
||||
subsystem->state == SPDK_NVMF_SUBSYSTEM_INACTIVE);
|
||||
|
||||
if (nsid == 0 || nsid > subsystem->max_nsid) {
|
||||
return -1;
|
||||
}
|
||||
@ -727,22 +730,26 @@ spdk_nvmf_subsystem_remove_ns(struct spdk_nvmf_subsystem *subsystem, uint32_t ns
|
||||
}
|
||||
|
||||
static void
|
||||
_spdk_nvmf_ns_hot_remove(void *ctx)
|
||||
_spdk_nvmf_ns_hot_remove(struct spdk_nvmf_subsystem *subsystem,
|
||||
void *cb_arg, int status)
|
||||
{
|
||||
struct spdk_nvmf_ns *ns = ctx;
|
||||
struct spdk_nvmf_ns *ns = cb_arg;
|
||||
|
||||
spdk_nvmf_subsystem_remove_ns(ns->subsystem, ns->id);
|
||||
|
||||
spdk_nvmf_subsystem_resume(subsystem, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
spdk_nvmf_ns_hot_remove(void *remove_ctx)
|
||||
{
|
||||
struct spdk_nvmf_ns *ns = remove_ctx;
|
||||
int rc;
|
||||
|
||||
ns->is_removed = true;
|
||||
spdk_thread_send_msg(ns->subsystem->tgt->master_thread,
|
||||
_spdk_nvmf_ns_hot_remove,
|
||||
ns);
|
||||
rc = spdk_nvmf_subsystem_pause(ns->subsystem, _spdk_nvmf_ns_hot_remove, ns);
|
||||
if (rc) {
|
||||
SPDK_ERRLOG("Unable to pause subsystem to process namespace removal!\n");
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
Loading…
Reference in New Issue
Block a user