Commit c5d2a852 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

bdev/nvme: Call disconnected_cb always if registered and rc is negative



Previous code had a potential bug that disconnected_cb was lost if rc was
negative but not -ENXIO. However, NVMe driver basically returns only
-ENXIO in this case. We can add the second parameter success or rc to
disconnected_cb but it will make the code more complicated. Hence, let's
simply call disconnected_cb if it is registered and rc is negative.

Signed-off-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I7cda48f25335a6c504053424b9eae785552ed286
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18210


Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent e510829f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1610,7 +1610,7 @@ bdev_nvme_poll_adminq(void *arg)
		disconnected_cb = nvme_ctrlr->disconnected_cb;
		nvme_ctrlr->disconnected_cb = NULL;

		if (rc == -ENXIO && disconnected_cb != NULL) {
		if (disconnected_cb != NULL) {
			bdev_nvme_change_adminq_poll_period(nvme_ctrlr,
							    g_opts.nvme_adminq_poll_period_us);
			disconnected_cb(nvme_ctrlr);