bdev_nvme: don't register multiple ctrlr destruct pollers.

This change is aimed at fixing github issue #1312 where we are
apparently calling the nvme_bdev_ctrlr_destruct function more than
once.

In the previous implementation, if a controller was resetting for more than
one iteration of the poller, a second iteration of the poller would get
registered.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: Ica01ecb21d76ea4f60624efd780bf4eea957c277
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1611
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
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>
This commit is contained in:
Seth Howell 2020-03-31 15:10:18 -07:00 committed by Tomasz Zawadzki
parent 20564d423b
commit 302ae5cc5c

View File

@ -145,6 +145,13 @@ nvme_bdev_ctrlr_destruct(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr)
{
assert(nvme_bdev_ctrlr->destruct);
pthread_mutex_lock(&g_bdev_nvme_mutex);
/* If we have already registered a poller, let that one take care of it. */
if (nvme_bdev_ctrlr->destruct_poller != NULL) {
pthread_mutex_unlock(&g_bdev_nvme_mutex);
return 1;
}
if (nvme_bdev_ctrlr->resetting) {
nvme_bdev_ctrlr->destruct_poller =
spdk_poller_register((spdk_poller_fn)nvme_bdev_ctrlr_destruct, nvme_bdev_ctrlr, 1000);