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

IB/srp: Report receive errors correctly

The IB spec does not guarantee that the opcode is available in error
completions. Hence do not rely on it. See also commit 948d1e889e5b
("IB/srp: Introduce srp_handle_qp_err()").

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: <stable@vger.kernel.org> # v3.8
Signed-off-by: Roland Dreier <roland@purestorage.com>

authored by

Bart Van Assche and committed by
Roland Dreier
cd4e3854 99b6697a

+4 -5
+4 -5
drivers/infiniband/ulp/srp/ib_srp.c
··· 1449 1449 srp_start_tl_fail_timers(target->rport); 1450 1450 } 1451 1451 1452 - static void srp_handle_qp_err(enum ib_wc_status wc_status, 1453 - enum ib_wc_opcode wc_opcode, 1452 + static void srp_handle_qp_err(enum ib_wc_status wc_status, bool send_err, 1454 1453 struct srp_target_port *target) 1455 1454 { 1456 1455 if (target->connected && !target->qp_in_error) { 1457 1456 shost_printk(KERN_ERR, target->scsi_host, 1458 1457 PFX "failed %s status %d\n", 1459 - wc_opcode & IB_WC_RECV ? "receive" : "send", 1458 + send_err ? "send" : "receive", 1460 1459 wc_status); 1461 1460 queue_work(system_long_wq, &target->tl_err_work); 1462 1461 } ··· 1472 1473 if (likely(wc.status == IB_WC_SUCCESS)) { 1473 1474 srp_handle_recv(target, &wc); 1474 1475 } else { 1475 - srp_handle_qp_err(wc.status, wc.opcode, target); 1476 + srp_handle_qp_err(wc.status, false, target); 1476 1477 } 1477 1478 } 1478 1479 } ··· 1488 1489 iu = (struct srp_iu *) (uintptr_t) wc.wr_id; 1489 1490 list_add(&iu->list, &target->free_tx); 1490 1491 } else { 1491 - srp_handle_qp_err(wc.status, wc.opcode, target); 1492 + srp_handle_qp_err(wc.status, true, target); 1492 1493 } 1493 1494 } 1494 1495 }