From 9a0bd78b439ff3819fed16897cf8e8469eb57f44 Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Tue, 6 Jul 2021 22:31:26 +0800 Subject: [PATCH] interrupt_tgt: Fix the interrupt mode usage issue. When the application is not set with the interrupt mode, we should fail the rpc. Fixes issue #2023 Change-Id: I4157f220948b7c96f474682c41ac9d78977b1c40 Signed-off-by: Ziye Yang Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8676 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Tomasz Zawadzki Reviewed-by: Xiaodong Liu Reviewed-by: Shuhei Matsumoto Reviewed-by: --- examples/interrupt_tgt/interrupt_tgt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/interrupt_tgt/interrupt_tgt.c b/examples/interrupt_tgt/interrupt_tgt.c index 8b01f6296..7fe92e6d2 100644 --- a/examples/interrupt_tgt/interrupt_tgt.c +++ b/examples/interrupt_tgt/interrupt_tgt.c @@ -78,6 +78,14 @@ rpc_reactor_set_interrupt_mode(struct spdk_jsonrpc_request *request, return; } + if (!spdk_interrupt_mode_is_enabled()) { + SPDK_ERRLOG("Interrupt mode is not set when staring the application\n"); + spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, + "spdk_json_decode_object failed"); + return; + } + + SPDK_NOTICELOG("RPC Start to %s interrupt mode on reactor %d.\n", req.disable_interrupt ? "disable" : "enable", req.lcore); if (req.lcore >= (int64_t)spdk_env_get_first_core() &&