nvmf: use util to rm all registrants
Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com> Change-Id: I5352b64ee1dfcca874563398aa49409e6805895e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5671 Community-CI: Broadcom CI Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
8162070997
commit
3bb303d9e6
@ -1146,11 +1146,13 @@ nvmf_subsystem_ns_changed(struct spdk_nvmf_subsystem *subsystem, uint32_t nsid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t
|
||||||
|
nvmf_ns_reservation_clear_all_registrants(struct spdk_nvmf_ns *ns);
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_nvmf_subsystem_remove_ns(struct spdk_nvmf_subsystem *subsystem, uint32_t nsid)
|
spdk_nvmf_subsystem_remove_ns(struct spdk_nvmf_subsystem *subsystem, uint32_t nsid)
|
||||||
{
|
{
|
||||||
struct spdk_nvmf_ns *ns;
|
struct spdk_nvmf_ns *ns;
|
||||||
struct spdk_nvmf_registrant *reg, *reg_tmp;
|
|
||||||
|
|
||||||
if (!(subsystem->state == SPDK_NVMF_SUBSYSTEM_INACTIVE ||
|
if (!(subsystem->state == SPDK_NVMF_SUBSYSTEM_INACTIVE ||
|
||||||
subsystem->state == SPDK_NVMF_SUBSYSTEM_PAUSED)) {
|
subsystem->state == SPDK_NVMF_SUBSYSTEM_PAUSED)) {
|
||||||
@ -1169,15 +1171,10 @@ spdk_nvmf_subsystem_remove_ns(struct spdk_nvmf_subsystem *subsystem, uint32_t ns
|
|||||||
|
|
||||||
subsystem->ns[nsid - 1] = NULL;
|
subsystem->ns[nsid - 1] = NULL;
|
||||||
|
|
||||||
TAILQ_FOREACH_SAFE(reg, &ns->registrants, link, reg_tmp) {
|
free(ns->ptpl_file);
|
||||||
TAILQ_REMOVE(&ns->registrants, reg, link);
|
nvmf_ns_reservation_clear_all_registrants(ns);
|
||||||
free(reg);
|
|
||||||
}
|
|
||||||
spdk_bdev_module_release_bdev(ns->bdev);
|
spdk_bdev_module_release_bdev(ns->bdev);
|
||||||
spdk_bdev_close(ns->desc);
|
spdk_bdev_close(ns->desc);
|
||||||
if (ns->ptpl_file) {
|
|
||||||
free(ns->ptpl_file);
|
|
||||||
}
|
|
||||||
free(ns);
|
free(ns);
|
||||||
|
|
||||||
nvmf_subsystem_ns_changed(subsystem, nsid);
|
nvmf_subsystem_ns_changed(subsystem, nsid);
|
||||||
|
Loading…
Reference in New Issue
Block a user