nvmf/rpc: stop_listen rpc now uses the async stop listen function.
Signed-off-by: Seth Howell <seth.howell@intel.com> Change-Id: Ie7352d6f1a9d74557a92c6e39c376856804f021c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3450 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
parent
49ee92a61f
commit
d1b0d2cbe5
@ -587,6 +587,7 @@ struct nvmf_rpc_listener_ctx {
|
||||
char *nqn;
|
||||
char *tgt_name;
|
||||
struct spdk_nvmf_tgt *tgt;
|
||||
struct spdk_nvmf_transport *transport;
|
||||
struct spdk_nvmf_subsystem *subsystem;
|
||||
struct rpc_listen_address address;
|
||||
|
||||
@ -656,6 +657,26 @@ nvmf_rpc_subsystem_listen(void *cb_arg, int status)
|
||||
/* Can't really do anything to recover here - subsystem will remain paused. */
|
||||
}
|
||||
}
|
||||
static void
|
||||
nvmf_rpc_stop_listen_async_done(void *cb_arg, int status)
|
||||
{
|
||||
struct nvmf_rpc_listener_ctx *ctx = cb_arg;
|
||||
|
||||
if (status) {
|
||||
SPDK_ERRLOG("Unable to remove listener.\n");
|
||||
spdk_jsonrpc_send_error_response_fmt(ctx->request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
|
||||
"error stopping listener: %d\n", status);
|
||||
ctx->response_sent = true;
|
||||
}
|
||||
|
||||
if (spdk_nvmf_subsystem_resume(ctx->subsystem, nvmf_rpc_listen_resumed, ctx)) {
|
||||
if (!ctx->response_sent) {
|
||||
spdk_jsonrpc_send_error_response(ctx->request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR, "Internal error");
|
||||
}
|
||||
nvmf_rpc_listener_ctx_free(ctx);
|
||||
/* Can't really do anything to recover here - subsystem will remain paused. */
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nvmf_rpc_listen_paused(struct spdk_nvmf_subsystem *subsystem,
|
||||
@ -683,7 +704,9 @@ nvmf_rpc_listen_paused(struct spdk_nvmf_subsystem *subsystem,
|
||||
"Invalid parameters");
|
||||
ctx->response_sent = true;
|
||||
}
|
||||
spdk_nvmf_tgt_stop_listen(ctx->tgt, &ctx->trid);
|
||||
spdk_nvmf_transport_stop_listen_async(ctx->transport, &ctx->trid, nvmf_rpc_stop_listen_async_done,
|
||||
ctx);
|
||||
return;
|
||||
} else {
|
||||
SPDK_UNREACHABLE();
|
||||
}
|
||||
@ -857,6 +880,14 @@ rpc_nvmf_subsystem_remove_listener(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->transport = spdk_nvmf_tgt_get_transport(tgt, ctx->trid.trstring);
|
||||
if (!ctx->transport) {
|
||||
spdk_jsonrpc_send_error_response(ctx->request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"Invalid parameters");
|
||||
nvmf_rpc_listener_ctx_free(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->op = NVMF_RPC_LISTEN_REMOVE;
|
||||
|
||||
if (spdk_nvmf_subsystem_pause(subsystem, nvmf_rpc_listen_paused, ctx)) {
|
||||
|
Loading…
Reference in New Issue
Block a user