From 2d1fc3ca06344fe60014682fd65fc8bae7b5d87e Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Mon, 20 Jul 2020 23:56:24 -0400 Subject: [PATCH] iscsi: report that long text responses isn't supported When there are many Target information which exceeds the data buffer, the initiator and target can use long text responses, but SPDK doesn't support this feature now, so here we just report an error here, we may add this feature in following patches. Fix issue #1442. Change-Id: I5962c00943819cd11ce21e610e4b37265451f0cb Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3454 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Ziye Yang Reviewed-by: Paul Luse Reviewed-by: Jim Harris --- lib/iscsi/tgt_node.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/iscsi/tgt_node.c b/lib/iscsi/tgt_node.c index 4b2366444..0807a3384 100644 --- a/lib/iscsi/tgt_node.c +++ b/lib/iscsi/tgt_node.c @@ -319,17 +319,12 @@ iscsi_send_tgts(struct spdk_iscsi_conn *conn, const char *iiqn, if (alloc_len < 1) { return 0; } - if (total > alloc_len) { + if (total >= alloc_len) { total = alloc_len; data[total - 1] = '\0'; return total; } - if (alloc_len - total < 1) { - SPDK_ERRLOG("data space small %d\n", alloc_len); - return total; - } - pthread_mutex_lock(&g_iscsi.mutex); TAILQ_FOREACH(target, &g_iscsi.target_head, tailq) { if (strcasecmp(tiqn, "ALL") != 0 @@ -352,8 +347,11 @@ iscsi_send_tgts(struct spdk_iscsi_conn *conn, const char *iiqn, TAILQ_FOREACH(p, &pg->head, per_pg_tailq) { if (alloc_len - total < 1) { pthread_mutex_unlock(&g_iscsi.mutex); - SPDK_ERRLOG("data space small %d\n", alloc_len); - return total; + /* TODO: long text responses support */ + SPDK_ERRLOG("SPDK doesn't support long text responses now, " + "you can use larger MaxRecvDataSegmentLength" + "value in initiator\n"); + return alloc_len; } host = p->host; /* wildcard? */