Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3418555pxb; Tue, 12 Jan 2021 14:18:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKHxvN2N8dcPQ4GVhJe+rmy+zrXHiUSnpU1Y7EPEI2QKHkM0tqwh8cu6TFjE4SDSLIeU3O X-Received: by 2002:a17:906:f1cc:: with SMTP id gx12mr645144ejb.164.1610489895037; Tue, 12 Jan 2021 14:18:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610489895; cv=none; d=google.com; s=arc-20160816; b=vwzF9r6Pj3b89D9uRAsKmQGVbItvVpsrXtJaEXCaKSoe2LJo82y7dq5V3m6sikdgg3 rs+kfaisPPJ6Okg2kBYcdS2bl//Ad8kmZfeCr6fmv71xEPYSIgHyVI7dLV1J9OUPHX0A LJ1CbY4rJculo3CJN0XIPil5eXSas8ZpNyKuweWPYcS0O6+v8USihhRmKdWh5vNiWK5w HW42OAYWl1zVkRwVxf05V+DgVyzHKuWAzQ3xnygDOcGRqEsEzWo07YdUN9F0/0zeo9Ct e+ZW4G8LPxBG5F4gCiro1iF97HsvwuLjWfaEmn+Hwl7ed2w8u5FRE36BHaI6cnCLL7n+ LIdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OCeqXqTg76Y0WcH/KI/byd9/8vHZqFTCU6yOhsYJqt8=; b=sdGADDKgp0KPFXawkWt8IxoSWkG7+G2CxOa8mfPWGtV0x0ZjU+LmTYIjZjCxVJM1u7 q0ptg4XTYTLaea3+Iq14CG8szG1syyzWqtJV4Ud80fsMkYAtr7Ejk5VdDz/45QmXwUB2 hC5GOB1uBLXhUOa0jr8X651/IzkHzJVP6E3Izfc2z5mWRTTv4iJpPhKbWtqKxdIhDPQM mBU9gHSeLYzvauBbSuTqXV+PGfhWzXGVacfU8NB9zq9liFO/vSY+GrEQm6pzH+L2wRtq mhR2+Brd6mVmXgdO/XYDX1bEvhilBBNH+eGjDxAHewO+38JsOnXpbBOiQRq43Er8rkqI jYHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Wf4VU+0r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j25si24886ejb.361.2021.01.12.14.17.51; Tue, 12 Jan 2021 14:18:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Wf4VU+0r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404616AbhALAY5 (ORCPT + 99 others); Mon, 11 Jan 2021 19:24:57 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:17604 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2403902AbhAKXN1 (ORCPT ); Mon, 11 Jan 2021 18:13:27 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 10BN1Q9l093675; Mon, 11 Jan 2021 18:12:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=OCeqXqTg76Y0WcH/KI/byd9/8vHZqFTCU6yOhsYJqt8=; b=Wf4VU+0rh3h1LzOaPCugHkxlezrad9NmmDbC+er4jDxv5GhnAsiqIdxL0wczk+0Gj1gL uVKiavzYHTqIr7lrQ5hXxLQOUFXNQ49ye3uebPe0RDzOk/9otJbodgQQaigmiK9GlP3a Gd3xdgKJcGYSi3Vd1affXtQRJKUetb2Ful9GnlauOr8pTkkE6iFIWcPDEb6cLlN+nLYN hvcxLYdj+WGXM9P6JVkLHCCsBQ2mT1oty+Aon07LRuazVOlKt83ysWpKiESfuwDcCzXi lLIM8t0w/GO9EBm4FJxIC7vAmNJtRCiL0qVD9rb6ogZEvv6tbQaBBKTOzujfGgfvJj0P 4g== Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0b-001b2d01.pphosted.com with ESMTP id 360wgfmekf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Jan 2021 18:12:41 -0500 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 10BN7Q1I010322; Mon, 11 Jan 2021 23:12:40 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma01wdc.us.ibm.com with ESMTP id 35y448sysj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Jan 2021 23:12:40 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 10BNCbfl27656688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Jan 2021 23:12:37 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B84C7805C; Mon, 11 Jan 2021 23:12:37 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E71678060; Mon, 11 Jan 2021 23:12:36 +0000 (GMT) Received: from vios4361.aus.stglabs.ibm.com (unknown [9.3.43.61]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 11 Jan 2021 23:12:36 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v4 19/21] ibmvfc: purge scsi channels after transport loss/reset Date: Mon, 11 Jan 2021 17:12:23 -0600 Message-Id: <20210111231225.105347-20-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210111231225.105347-1-tyreld@linux.ibm.com> References: <20210111231225.105347-1-tyreld@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2021-01-11_32:2021-01-11,2021-01-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 mlxscore=0 priorityscore=1501 mlxlogscore=999 spamscore=0 adultscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101110126 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Grab the queue and list lock for each Sub-CRQ and add any uncompleted events to the host purge list. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 24e1278acfeb..b413f5da71ce 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -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) { struct ibmvfc_event *evt, *pos; + struct ibmvfc_queue *queues = vhost->scsi_scrqs.scrqs; 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"); spin_lock_irqsave(&vhost->crq.l_lock, flags); @@ -1064,6 +1070,16 @@ static void ibmvfc_purge_requests(struct ibmvfc_host *vhost, int error_code) ibmvfc_fail_request(evt, error_code); list_splice_init(&vhost->crq.sent, &vhost->purge); 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); + } } /** -- 2.27.0