nvmf: Leverage bdev uuid to correctly detected remove+add ns while

paused

Change-Id: Idbf00956394f7ee7ff7e27f2627785cd7146b01f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459605
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
This commit is contained in:
Ben Walker 2019-06-27 04:24:12 -07:00 committed by Changpeng Liu
parent 85e9760161
commit 09ef0593d4
2 changed files with 13 additions and 2 deletions

View File

@ -954,13 +954,23 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
return -ENOMEM;
}
ns_info->channel = ch;
} else {
/* A namespace was present before and didn't change. */
} else if (spdk_uuid_compare(&ns_info->uuid, spdk_bdev_get_uuid(ns->bdev)) != 0) {
/* A namespace was here before, but was replaced by a new one. */
spdk_put_io_channel(ns_info->channel);
memset(ns_info, 0, sizeof(*ns_info));
ch = spdk_bdev_get_io_channel(ns->desc);
if (ch == NULL) {
SPDK_ERRLOG("Could not allocate I/O channel.\n");
return -ENOMEM;
}
ns_info->channel = ch;
}
if (ns == NULL) {
memset(ns_info, 0, sizeof(*ns_info));
} else {
ns_info->uuid = *spdk_bdev_get_uuid(ns->bdev);
ns_info->crkey = ns->crkey;
ns_info->rtype = ns->rtype;
if (ns->holder) {

View File

@ -132,6 +132,7 @@ struct spdk_nvmf_reservation_info {
struct spdk_nvmf_subsystem_pg_ns_info {
struct spdk_io_channel *channel;
struct spdk_uuid uuid;
/* current reservation key, no reservation if the value is 0 */
uint64_t crkey;
/* reservation type */