From patchwork Fri Nov 3 23:20:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10041361 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ACB89602D8 for ; Fri, 3 Nov 2017 23:21:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F3DE283AF for ; Fri, 3 Nov 2017 23:21:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 942082920A; Fri, 3 Nov 2017 23:21:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41F88283AF for ; Fri, 3 Nov 2017 23:21:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751536AbdKCXVE (ORCPT ); Fri, 3 Nov 2017 19:21:04 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:49360 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752127AbdKCXVC (ORCPT ); Fri, 3 Nov 2017 19:21:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1509751262; x=1541287262; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=FIyxtfkI/6+qDovZzR8c6KQQ2qlwsXGtv68Zq51XNzQ=; b=Y7zGalX9DhYVrt3Z2IEWQmlsIckgevKmJG7QN4HO91BsUlH/pM9aA/Wc B9yomq38v2pq8u1N/h5dw5CxTOih9XldbsQ2HJkA7jTJvBF0uaVqGrzE0 dRRAdbi2k9gYH8+JyF14CQl1KeU63I7qwsbQ9K+VvANQ6NDmoioPceTif DUyOLqrivgG7SmI41TkKM2GZSAHu4gbPibk8HPKl1N2AAbdnUYiGC+6oX hfLcFea7hnsd+E7V+JtJmD4T0EyL8F06egcp0yU/PRfJrh9+plMLvRObc g/4J+uG+4xrgEF+T7TRpzre2WQgu75m49Wj65BF8Ec2q3aZtKfISkx3JD g==; X-IronPort-AV: E=Sophos;i="5.44,339,1505750400"; d="scan'208";a="61365176" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 04 Nov 2017 07:21:01 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 03 Nov 2017 16:19:03 -0700 Received: from unknown (HELO MILHUBIP04.sdcorp.global.sandisk.com) ([10.177.9.97]) by uls-op-cesaip02.wdc.com with ESMTP; 03 Nov 2017 16:21:02 -0700 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.319.2; Fri, 3 Nov 2017 16:20:59 -0700 X-AuditID: 0ab1095a-d99e3980000146e4-bf-59fcf9db3e7a Received: from thinkpad-bart.int.fusionio.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id C8.33.18148.BD9FCF95; Fri, 3 Nov 2017 16:20:59 -0700 (PDT) From: Bart Van Assche To: Doug Ledford CC: , Mike Marciniszyn , Bart Van Assche Subject: [PATCH 5/5] IB/srpt: Ensure that modifying the use_srq configfs attribute works Date: Fri, 3 Nov 2017 16:20:56 -0700 Message-ID: <20171103232056.30614-6-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171103232056.30614-1-bart.vanassche@wdc.com> References: <20171103232056.30614-1-bart.vanassche@wdc.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNJMWRmVeSWpSXmKPExsXCtZGTTff2zz+RBq1HZC0u/fnCaPHy/AdW i2eHelksNvxvZHdg8Vi85yWTx/t9V9k8Pm+S82g/0M0UwBLFZZOSmpNZllqkb5fAlXHo4HLG gh/cFds3vWJvYOzm6mLk5JAQMJGY/Xg2axcjF4eQwEpGiYnzXjKDJNgE9CROzdvHBGKLCKhJ bHq1iB3EZhaolri6ZzojiC0sECFxacc0FhCbRUBV4vzJmWC9vALWEt0b77FALJCXWPv2HlA9 BwengI3E+ZniIGEhoJIlNxtYJzByL2BkWMUolpuZU5ybnllgaKRXnJiXklmcrZecn7uJEeL9 qB2M1yeaH2Jk4uCUamDc5Z1jYHrw6eIcfysbwap6LuPzTbeOiP1bcFNbUHKneY4UT9uilXX+ +vcyszQn2mnNmjvddndtnI9oP6fj9Dcya2fve3Xe51SEZ4eLywGekwm7eoNdKj+eflz082zd qRktmne3Nm38vddJo7E31fDiHKPw/eLHe2as6XOS/nl2qu23O05nFsxSYinOSDTUYi4qTgQA EjGHva4BAAA= MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The use_srq configfs attribute is created after it is read. Hence modify srpt_tpg_attrib_use_srq_store() such that this function switches dynamically between non-SRQ and SRQ mode. Reported-by: Mike Marciniszyn Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/srpt/ib_srpt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index ca602eb50078..fde4f6741316 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -3054,7 +3054,9 @@ static ssize_t srpt_tpg_attrib_use_srq_store(struct config_item *item, { struct se_portal_group *se_tpg = attrib_to_tpg(item); struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); + struct srpt_device *sdev = sport->sdev; unsigned long val; + bool enabled; int ret; ret = kstrtoul(page, 0, &val); @@ -3062,7 +3064,17 @@ static ssize_t srpt_tpg_attrib_use_srq_store(struct config_item *item, return ret; if (val != !!val) return -EINVAL; + + ret = mutex_lock_interruptible(&sdev->mutex); + if (ret < 0) + return ret; + enabled = sport->enabled; + /* Log out all initiator systems before changing 'use_srq'. */ + srpt_set_enabled(sport, false); sport->port_attrib.use_srq = val; + srpt_use_srq(sdev, sport->port_attrib.use_srq); + srpt_set_enabled(sport, enabled); + mutex_unlock(&sdev->mutex); return count; }