Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB/srp: Don't wait for response when QP is in error state.

When there is a call to send_tsk_mgmt SRP posts a send and waits for 5
seconds to get a response.

When the QP is in the error state it is obvious that there will be no
response so it is quite useless to wait. In fact, the timeout causes
SRP to wait a long time to reconnect when a QP error occurs. (Each
abort and each reset_device calls send_tsk_mgmt, which waits for the
timeout). The following patch solves this problem by identifying the
failure and returning an immediate error code.

Signed-off-by: Ishai Rabinovitz <ishai@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

authored by

Ishai Rabinovitz and committed by
Roland Dreier
1033ff67 062dbb69

+8
+7
drivers/infiniband/ulp/srp/ib_srp.c
··· 548 548 target->tx_head = 0; 549 549 target->tx_tail = 0; 550 550 551 + target->qp_in_error = 0; 551 552 ret = srp_connect_target(target); 552 553 if (ret) 553 554 goto err; ··· 879 878 printk(KERN_ERR PFX "failed %s status %d\n", 880 879 wc.wr_id & SRP_OP_RECV ? "receive" : "send", 881 880 wc.status); 881 + target->qp_in_error = 1; 882 882 break; 883 883 } 884 884 ··· 1339 1337 1340 1338 printk(KERN_ERR "SRP abort called\n"); 1341 1339 1340 + if (target->qp_in_error) 1341 + return FAILED; 1342 1342 if (srp_find_req(target, scmnd, &req)) 1343 1343 return FAILED; 1344 1344 if (srp_send_tsk_mgmt(target, req, SRP_TSK_ABORT_TASK)) ··· 1369 1365 1370 1366 printk(KERN_ERR "SRP reset_device called\n"); 1371 1367 1368 + if (target->qp_in_error) 1369 + return FAILED; 1372 1370 if (srp_find_req(target, scmnd, &req)) 1373 1371 return FAILED; 1374 1372 if (srp_send_tsk_mgmt(target, req, SRP_TSK_LUN_RESET)) ··· 1807 1801 goto err_free; 1808 1802 } 1809 1803 1804 + target->qp_in_error = 0; 1810 1805 ret = srp_connect_target(target); 1811 1806 if (ret) { 1812 1807 printk(KERN_ERR PFX "Connection failed\n");
+1
drivers/infiniband/ulp/srp/ib_srp.h
··· 158 158 struct completion done; 159 159 int status; 160 160 enum srp_target_state state; 161 + int qp_in_error; 161 162 }; 162 163 163 164 struct srp_iu {