Commit dff1d59f authored by Alexey Marchuk's avatar Alexey Marchuk Committed by Jim Harris
Browse files

lib/nvmf: Deprecate cb_fn in spdk_nvmf_qpair_disconnect



Handling this callback is quite complex and may lead to
various problems. In most of places, the actual event
when qpair is dosconnected is not importnat for the
app logic. Only in shutdown path we need to be sure
that all qpairs are disconnected, it can be achieved
by checking poll_group::qpairs list

Signed-off-by: default avatarAlexey Marchuk <alexeymar@nvidia.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17165

 (master)

(cherry picked from commit 0de1c215)
Change-Id: I453961299f67342c1193dc622685aefb46bfceb6
Signed-off-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17710


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent e5c1be95
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -165,6 +165,9 @@ a specified qpair.
Added API `spdk_nvmf_tgt_pause_polling` and `spdk_nvmf_tgt_resume_polling` to allow
pausing polling on poll group of a given target.

Parameters `cb_fn` and `ctx` of `spdk_nvmf_qpair_disconnect` API are deprecated. These parameters
will be removed in 23.09 release.

### rpc

Added `spdk_rpc_set_allowlist` to restrict allowed RPCs to the specified list.
+7 −0
Original line number Diff line number Diff line
@@ -58,6 +58,13 @@ and will be removed in SPDK 23.05.
Deprecated `spdk_nvme_ctrlr_prepare_for_reset` API, which will be removed in SPDK 22.01.
For PCIe transport, `spdk_nvme_ctrlr_disconnect` should be used before freeing I/O qpairs.

### nvmf

#### `spdk_nvmf_qpair_disconnect`

Parameters `cb_fn` and `ctx` of `spdk_nvmf_qpair_disconnect` API are deprecated. These parameters
will be removed in 23.09 release.

### bdev

#### `bdev_register_examine_thread`
+2 −2
Original line number Diff line number Diff line
@@ -291,8 +291,8 @@ typedef void (*nvmf_qpair_disconnect_cb)(void *ctx);
 * Disconnect an NVMe-oF qpair
 *
 * \param qpair The NVMe-oF qpair to disconnect.
 * \param cb_fn The function to call upon completion of the disconnect.
 * \param ctx The context to pass to the callback function.
 * \param cb_fn Deprecated, will be removed in v23.09. The function to call upon completion of the disconnect.
 * \param ctx Deprecated, will be removed in v23.09. The context to pass to the callback function.
 *
 * \return 0 upon success.
 * \return -ENOMEM if the function specific context could not be allocated.
+7 −0
Original line number Diff line number Diff line
@@ -1224,6 +1224,9 @@ _nvmf_qpair_disconnect_msg(void *ctx)
	free(ctx);
}

SPDK_LOG_DEPRECATION_REGISTER(spdk_nvmf_qpair_disconnect, "cb_fn and ctx are deprecated", "v23.09",
			      0);

int
spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair, nvmf_qpair_disconnect_cb cb_fn, void *ctx)
{
@@ -1234,6 +1237,10 @@ spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair, nvmf_qpair_disconnect_
		return -EINPROGRESS;
	}

	if (cb_fn || ctx) {
		SPDK_LOG_DEPRECATED(spdk_nvmf_qpair_disconnect);
	}

	/* If we get a qpair in the uninitialized state, we can just destroy it immediately */
	if (qpair->state == SPDK_NVMF_QPAIR_UNINITIALIZED) {
		nvmf_transport_qpair_fini(qpair, NULL, NULL);