From patchwork Thu Apr 30 08:58:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 6300841 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A18179F326 for ; Thu, 30 Apr 2015 09:14:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AECE1201E4 for ; Thu, 30 Apr 2015 09:14:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 94D30201CD for ; Thu, 30 Apr 2015 09:14:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751237AbbD3JOC (ORCPT ); Thu, 30 Apr 2015 05:14:02 -0400 Received: from mail-bl2on0084.outbound.protection.outlook.com ([65.55.169.84]:31026 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751095AbbD3JOA (ORCPT ); Thu, 30 Apr 2015 05:14:00 -0400 Received: from BY2PR02CA0098.namprd02.prod.outlook.com (25.163.44.152) by DM2PR0201MB1037.namprd02.prod.outlook.com (25.160.219.147) with Microsoft SMTP Server (TLS) id 15.1.154.19; Thu, 30 Apr 2015 08:58:13 +0000 Received: from BN1AFFO11FD018.protection.gbl (2a01:111:f400:7c10::181) by BY2PR02CA0098.outlook.office365.com (2a01:111:e400:5261::24) with Microsoft SMTP Server (TLS) id 15.1.154.19 via Frontend Transport; Thu, 30 Apr 2015 08:58:13 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; odin.com; dkim=none (message not signed) header.d=none; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.173 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.173; helo=milsmgep12.sandisk.com; Received: from milsmgep12.sandisk.com (63.163.107.173) by BN1AFFO11FD018.mail.protection.outlook.com (10.58.52.78) with Microsoft SMTP Server id 15.1.160.8 via Frontend Transport; Thu, 30 Apr 2015 08:58:10 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id 92.2A.14695.2AEE1455; Thu, 30 Apr 2015 01:58:10 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.224.2; Thu, 30 Apr 2015 01:58:09 -0700 X-AuditID: ac160a69-f79656d000003967-82-5541eea2ac9e Received: from [10.50.231.61] ( [10.177.8.100]) by milsmgip12.sandisk.com (Symantec Messaging Gateway) with SMTP id C2.8A.04406.0AEE1455; Thu, 30 Apr 2015 01:58:09 -0700 (PDT) Message-ID: <5541EE9F.8090605@sandisk.com> Date: Thu, 30 Apr 2015 10:58:07 +0200 From: Bart Van Assche User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Doug Ledford CC: James Bottomley , Sagi Grimberg , Sebastian Parschauer , linux-rdma , "linux-scsi@vger.kernel.org" Subject: [PATCH 04/12] IB/srp: Fix connection state tracking References: <5541EE21.3050809@sandisk.com> In-Reply-To: <5541EE21.3050809@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnkeLIzCtJLcpLzFFi42JZI8azSHfRO8dQg6enuSxenv/AavF//W0W i2eHelksuq/vYLO40faAzeLkbX4HNo9n0w8zeRz+8YPZ48+fz8we7/ddZfP4vEkugDWKyyYl NSezLLVI3y6BK2Pj76fMBbelKs7NvsfSwLhfrIuRk0NCwETi6cLVrBC2mMSFe+vZuhi5OIQE TjB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9ovkhRiYOTqkGxiCnoksG/+Ovaem9duKT+i4WcvvBWZccKe5glcNe7OIm tVILjS6wnrmcvN7mmr3Uz62bHzumv84tMP/9lKVL3DH2/6pv3g5ym1Yeb3Ot6ZnjcVncokXT /u4j102PtrGHHrmStGd7YZj97hn+k85GFzttPbGdKSPw+p3ELpeZDWcSCmQrb6c4K7EUZyQa ajEXFScCAEYR1F8RAgAA X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(438002)(189002)(199003)(77096005)(59896002)(2950100001)(47776003)(4001350100001)(87936001)(62966003)(77156002)(92566002)(33656002)(65806001)(65956001)(229853001)(76176999)(87266999)(46102003)(50986999)(54356999)(86362001)(19580405001)(23676002)(80316001)(83506001)(106466001)(19580395003)(64126003)(36756003)(65816999)(50466002)(5001960100002)(110136002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0201MB1037; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0201MB1037; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:DM2PR0201MB1037; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0201MB1037; X-Forefront-PRVS: 056297E276 X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2015 08:58:10.7598 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.173]; Helo=[milsmgep12.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0201MB1037 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reception of a DREQ message only causes the state of a single channel to change. Modify the SRP initiator such that channel and target connection state are tracked separately. This patch avoids that following false positive warning can be reported by srp_destroy_qp(): WARNING: at drivers/infiniband/ulp/srp/ib_srp.c:617 srp_destroy_qp+0xa6/0x120 [ib_srp]() Call Trace: [] warn_slowpath_common+0x7f/0xc0 [] warn_slowpath_null+0x1a/0x20 [] srp_destroy_qp+0xa6/0x120 [ib_srp] [] srp_free_ch_ib+0x82/0x1e0 [ib_srp] [] srp_create_target+0x7ab/0x998 [ib_srp] [] dev_attr_store+0x20/0x30 [] sysfs_write_file+0xef/0x170 [] vfs_write+0xc8/0x190 [] sys_write+0x51/0x90 Signed-off-by: Bart Van Assche Cc: Sagi Grimberg Cc: Sebastian Parschauer Cc: #v3.19 --- drivers/infiniband/ulp/srp/ib_srp.c | 7 ++++--- drivers/infiniband/ulp/srp/ib_srp.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 5ce6cfd..0eb07d3 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -465,14 +465,13 @@ static struct srp_fr_pool *srp_alloc_fr_pool(struct srp_target_port *target) */ static void srp_destroy_qp(struct srp_rdma_ch *ch) { - struct srp_target_port *target = ch->target; static struct ib_qp_attr attr = { .qp_state = IB_QPS_ERR }; static struct ib_recv_wr wr = { .wr_id = SRP_LAST_WR_ID }; struct ib_recv_wr *bad_wr; int ret; /* Destroying a QP and reusing ch->done is only safe if not connected */ - WARN_ON_ONCE(target->connected); + WARN_ON_ONCE(ch->connected); ret = ib_modify_qp(ch->qp, &attr, IB_QP_STATE); WARN_ONCE(ret, "ib_cm_init_qp_attr() returned %d\n", ret); @@ -836,6 +835,7 @@ static void srp_disconnect_target(struct srp_target_port *target) for (i = 0; i < target->ch_count; i++) { ch = &target->ch[i]; + ch->connected = false; if (ch->cm_id && ib_send_cm_dreq(ch->cm_id, NULL, 0)) { shost_printk(KERN_DEBUG, target->scsi_host, PFX "Sending CM DREQ failed\n"); @@ -1017,6 +1017,7 @@ static int srp_connect_ch(struct srp_rdma_ch *ch, bool multich) switch (ch->status) { case 0: srp_change_conn_state(target, true); + ch->connected = true; return 0; case SRP_PORT_REDIRECT: @@ -2367,7 +2368,7 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event) case IB_CM_DREQ_RECEIVED: shost_printk(KERN_WARNING, target->scsi_host, PFX "DREQ received - connection closed\n"); - srp_change_conn_state(target, false); + ch->connected = false; if (ib_send_cm_drep(cm_id, NULL, 0)) shost_printk(KERN_ERR, target->scsi_host, PFX "Sending CM DREP failed\n"); diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index a611556..95a4471 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h @@ -170,6 +170,7 @@ struct srp_rdma_ch { struct completion tsk_mgmt_done; u8 tsk_mgmt_status; + bool connected; }; /**