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? */