Skip to content

Commit 9253e66

Browse files
Sagi GrimbergNicholas Bellinger
authored andcommitted
iser-target: Fix variable-length response error completion
Since commit "2426bd456a6 target: Report correct response ..." we might get a command with data_size that does not fit to the number of allocated data sg elements. Given that we rely on cmd t_data_nents which might be different than the data_size, we sometimes receive local length error completion. The correct approach would be to take the command data_size into account when constructing the ib sg_list. Signed-off-by: Sagi Grimberg <[email protected]> Signed-off-by: Jenny Falkovich <[email protected]> Cc: [email protected] # 3.16+ Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent b2feda4 commit 9253e66

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/infiniband/ulp/isert/ib_isert.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,7 +2380,6 @@ isert_build_rdma_wr(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd,
23802380
page_off = offset % PAGE_SIZE;
23812381

23822382
send_wr->sg_list = ib_sge;
2383-
send_wr->num_sge = sg_nents;
23842383
send_wr->wr_id = (uintptr_t)&isert_cmd->tx_desc;
23852384
/*
23862385
* Perform mapping of TCM scatterlist memory ib_sge dma_addr.
@@ -2400,14 +2399,17 @@ isert_build_rdma_wr(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd,
24002399
ib_sge->addr, ib_sge->length, ib_sge->lkey);
24012400
page_off = 0;
24022401
data_left -= ib_sge->length;
2402+
if (!data_left)
2403+
break;
24032404
ib_sge++;
24042405
isert_dbg("Incrementing ib_sge pointer to %p\n", ib_sge);
24052406
}
24062407

2408+
send_wr->num_sge = ++i;
24072409
isert_dbg("Set outgoing sg_list: %p num_sg: %u from TCM SGLs\n",
24082410
send_wr->sg_list, send_wr->num_sge);
24092411

2410-
return sg_nents;
2412+
return send_wr->num_sge;
24112413
}
24122414

24132415
static int

0 commit comments

Comments
 (0)