From da657d43839f35fab79b9ff0c34a30b10ed6077f Mon Sep 17 00:00:00 2001 From: Michael Haeuptle Date: Thu, 7 Nov 2019 10:57:37 -0700 Subject: [PATCH] json: increase the json rpc client value limit The jsonrpc client has a limit of 1024 JSON values per request which is hardly enough for any meaningful config. For example, calling getbdevs for 24 NVMe drives require ~2300 JSON values. I kept the original 1024 limit for the RPC server where it makes sense to have a smaller limit and introduced a seperate limit for the client. Signed-off-by: Michael Haeuptle Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473568 (master) (cherry picked from commit 92df9955261220750dc7460681258544f4b0e86a) Change-Id: Id0300991b76151e4003e323f5ea29bc5fc0d2d11 Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478342 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Reviewed-by: Alexey Marchuk Reviewed-by: Michael Haeuptle --- lib/jsonrpc/jsonrpc_client.c | 2 +- lib/jsonrpc/jsonrpc_internal.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/jsonrpc/jsonrpc_client.c b/lib/jsonrpc/jsonrpc_client.c index 70bd89c96f..2694faf2b1 100644 --- a/lib/jsonrpc/jsonrpc_client.c +++ b/lib/jsonrpc/jsonrpc_client.c @@ -93,7 +93,7 @@ spdk_jsonrpc_parse_response(struct spdk_jsonrpc_client *client) } SPDK_DEBUGLOG(SPDK_LOG_RPC_CLIENT, "JSON string is :\n%s\n", client->recv_buf); - if (rc < 0 || rc > SPDK_JSONRPC_MAX_VALUES) { + if (rc < 0 || rc > SPDK_JSONRPC_CLIENT_MAX_VALUES) { SPDK_ERRLOG("JSON parse error (rc: %zd)\n", rc); /* * Can't recover from parse error (no guaranteed resync point in streaming JSON). diff --git a/lib/jsonrpc/jsonrpc_internal.h b/lib/jsonrpc/jsonrpc_internal.h index e51d9c9dfb..2631d76e98 100644 --- a/lib/jsonrpc/jsonrpc_internal.h +++ b/lib/jsonrpc/jsonrpc_internal.h @@ -46,6 +46,7 @@ #define SPDK_JSONRPC_ID_MAX_LEN 128 #define SPDK_JSONRPC_MAX_CONNS 64 #define SPDK_JSONRPC_MAX_VALUES 1024 +#define SPDK_JSONRPC_CLIENT_MAX_VALUES 8192 struct spdk_jsonrpc_request { struct spdk_jsonrpc_server_conn *conn;