Commit 7eb3ccd8 authored by Tyrel Datwyler's avatar Tyrel Datwyler Committed by Martin K. Petersen

scsi: ibmvfc: Purge SCSI channels after transport loss/reset

Grab the queue and list lock for each Sub-CRQ and add any uncompleted
events to the host purge list.

Link: https://lore.kernel.org/r/20210114203148.246656-20-tyreld@linux.ibm.comReviewed-by: default avatarBrian King <brking@linux.vnet.ibm.com>
Signed-off-by: default avatarTyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a835f386
...@@ -1056,7 +1056,13 @@ static void ibmvfc_fail_request(struct ibmvfc_event *evt, int error_code) ...@@ -1056,7 +1056,13 @@ static void ibmvfc_fail_request(struct ibmvfc_event *evt, int error_code)
static void ibmvfc_purge_requests(struct ibmvfc_host *vhost, int error_code) static void ibmvfc_purge_requests(struct ibmvfc_host *vhost, int error_code)
{ {
struct ibmvfc_event *evt, *pos; struct ibmvfc_event *evt, *pos;
struct ibmvfc_queue *queues = vhost->scsi_scrqs.scrqs;
unsigned long flags; unsigned long flags;
int hwqs = 0;
int i;
if (vhost->using_channels)
hwqs = vhost->scsi_scrqs.active_queues;
ibmvfc_dbg(vhost, "Purging all requests\n"); ibmvfc_dbg(vhost, "Purging all requests\n");
spin_lock_irqsave(&vhost->crq.l_lock, flags); spin_lock_irqsave(&vhost->crq.l_lock, flags);
...@@ -1064,6 +1070,16 @@ static void ibmvfc_purge_requests(struct ibmvfc_host *vhost, int error_code) ...@@ -1064,6 +1070,16 @@ static void ibmvfc_purge_requests(struct ibmvfc_host *vhost, int error_code)
ibmvfc_fail_request(evt, error_code); ibmvfc_fail_request(evt, error_code);
list_splice_init(&vhost->crq.sent, &vhost->purge); list_splice_init(&vhost->crq.sent, &vhost->purge);
spin_unlock_irqrestore(&vhost->crq.l_lock, flags); spin_unlock_irqrestore(&vhost->crq.l_lock, flags);
for (i = 0; i < hwqs; i++) {
spin_lock_irqsave(queues[i].q_lock, flags);
spin_lock(&queues[i].l_lock);
list_for_each_entry_safe(evt, pos, &queues[i].sent, queue_list)
ibmvfc_fail_request(evt, error_code);
list_splice_init(&queues[i].sent, &vhost->purge);
spin_unlock(&queues[i].l_lock);
spin_unlock_irqrestore(queues[i].q_lock, flags);
}
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment