Skip to content

Commit 92bbccd

Browse files
Chad Dupuismartinkpetersen
authored andcommitted
scsi: qedf: Add additional checks when restarting an rport due to ABTS timeout
There are a couple of kernel cases when we restart a remote port due to ABTS timeout that we need to handle: 1. Flush any outstanding ABTS requests when flushing I/Os so that we do not hold up the eh_abort handler indefinitely causing process hangs. 2. Check if we are currently uploading a connection before issuing an ABTS. Signed-off-by: Chad Dupuis <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 96673e1 commit 92bbccd

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

drivers/scsi/qedf/qedf_io.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,31 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun)
14571457
goto free_cmd;
14581458
}
14591459

1460+
if (io_req->cmd_type == QEDF_ABTS) {
1461+
rc = kref_get_unless_zero(&io_req->refcount);
1462+
if (!rc) {
1463+
QEDF_ERR(&(qedf->dbg_ctx),
1464+
"Could not get kref for abort io_req=0x%p xid=0x%x.\n",
1465+
io_req, io_req->xid);
1466+
continue;
1467+
}
1468+
QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1469+
"Flushing abort xid=0x%x.\n", io_req->xid);
1470+
1471+
clear_bit(QEDF_CMD_IN_ABORT, &io_req->flags);
1472+
1473+
if (io_req->sc_cmd) {
1474+
if (io_req->return_scsi_cmd_on_abts)
1475+
qedf_scsi_done(qedf, io_req, DID_ERROR);
1476+
}
1477+
1478+
/* Notify eh_abort handler that ABTS is complete */
1479+
complete(&io_req->abts_done);
1480+
kref_put(&io_req->refcount, qedf_release_cmd);
1481+
1482+
goto free_cmd;
1483+
}
1484+
14601485
if (!io_req->sc_cmd)
14611486
continue;
14621487
if (lun > 0) {
@@ -1534,6 +1559,11 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts)
15341559
goto abts_err;
15351560
}
15361561

1562+
if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) {
1563+
QEDF_ERR(&qedf->dbg_ctx, "fcport is uploading.\n");
1564+
rc = 1;
1565+
goto out;
1566+
}
15371567

15381568
kref_get(&io_req->refcount);
15391569

@@ -1573,6 +1603,7 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts)
15731603
* task at the firmware.
15741604
*/
15751605
qedf_initiate_cleanup(io_req, return_scsi_cmd_on_abts);
1606+
out:
15761607
return rc;
15771608
}
15781609

0 commit comments

Comments
 (0)