Commit 302ae5cc authored by Seth Howell's avatar Seth Howell Committed by Tomasz Zawadzki
Browse files

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: default avatarSeth Howell <seth.howell@intel.com>
Change-Id: Ica01ecb21d76ea4f60624efd780bf4eea957c277
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1611


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 20564d42
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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);