From patchwork Wed Jan 11 18:54:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 9511039 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 7C77D60710 for ; Wed, 11 Jan 2017 18:55:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 711DF2866E for ; Wed, 11 Jan 2017 18:55:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 656FA28675; Wed, 11 Jan 2017 18:55:17 +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 EE1F22866E for ; Wed, 11 Jan 2017 18:55:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751480AbdAKSzO (ORCPT ); Wed, 11 Jan 2017 13:55:14 -0500 Received: from mx143.netapp.com ([216.240.21.24]:46892 "EHLO mx143.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752882AbdAKSzL (ORCPT ); Wed, 11 Jan 2017 13:55:11 -0500 X-IronPort-AV: E=Sophos;i="5.33,346,1477983600"; d="scan'208";a="168739359" Received: from hioexcmbx05-prd.hq.netapp.com ([10.122.105.38]) by mx143-out.netapp.com with ESMTP; 11 Jan 2017 10:50:10 -0800 Received: from VMWEXCCAS06-PRD.hq.netapp.com (10.122.105.22) by hioexcmbx05-prd.hq.netapp.com (10.122.105.38) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Wed, 11 Jan 2017 10:55:10 -0800 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.120.60.153) by VMWEXCCAS06-PRD.hq.netapp.com (10.122.105.22) with Microsoft SMTP Server (TLS) id 15.0.1210.3 via Frontend Transport; Wed, 11 Jan 2017 10:55:10 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netapp.onmicrosoft.com; s=selector1-netapp-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=qaICKQ4jrdU5A3RmXODWienJlqOpBjI0TDEet814I1M=; b=fapOXOcs3Q9lXEH3V+ZDaH59gicF0abYOUJND6ZQQtrcpgcR7+wd0zzcP0xuC1HTVGQCVChPlXyNC8OJsWL97H8E+b5sECtu/dSqIQhnc/2nIoop2PJTqCeFxsBv190FWZZ2qnq7ZDRDv5BGdtbmi3ZugaZKbj+skySpY+/x1Vc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anna.Schumaker@netapp.com; Received: from gouda.nowheycreamery.com.nowheycreamery.com (99.9.112.69) by CY1PR0601MB1642.namprd06.prod.outlook.com (10.163.232.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7; Wed, 11 Jan 2017 18:55:08 +0000 From: To: Subject: [PATCH 07/11] NFS: Lock the slot table from a single place during setup sequence Date: Wed, 11 Jan 2017 13:54:50 -0500 Message-ID: <20170111185454.9315-8-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170111185454.9315-1-Anna.Schumaker@Netapp.com> References: <20170111185454.9315-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 X-Originating-IP: [99.9.112.69] X-ClientProxiedBy: CY1PR0201CA0001.namprd02.prod.outlook.com (10.163.30.139) To CY1PR0601MB1642.namprd06.prod.outlook.com (10.163.232.16) X-MS-Office365-Filtering-Correlation-Id: 1b23448e-2f0d-444e-03b1-08d43a535d57 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR0601MB1642; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0601MB1642; 3:sPMS2mvy3sUUrUAZJPLXYz95tgH32QlLmiNov/k4Mhp9ElRxYQ8CYKO+wVa1oGHuaQGVceSJyEcVrf1/YjYHalRICrLIrW/Tb14GRG1aCD1WVPNcqNnlsbeLTN5mh6f6/sfL8SMQ+P0i2lljIPrLyxMoMnPgN0L4qKnYy7EdfvxYZlCjRaaRsdNoFFNRr4iez91RP6orWOpQuDKSSd2xJeV0QsMbJ8y7ED07cIM96S3vBceWX1yeZ9IljhXYq0eIIiTe1icHWt74LpELIFjmxQ== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0601MB1642; 25:PadvhPIlGliFemSFTWL6D4tzWkV6FnggQFQEs+pAmYkmrTXBUWxuP6NtVaDHR7aGTMlW4+480BeJvKxgi0nJqGcwjyWRwbqzPverExRItTOKGQYEVmnscbefLfk/8Ztcp6bLiBtmcBv9hwNZ+iPGdxj19dAhNDoiovOQwQl5OJZSwqMOcoELww2P/O3C0tShRAIma6VY48nhpE57/swjISScGNA5ovqfrtK3WmI7WrNLJVvFj15BsKuGLmVMWZp+9MEi1+AWFoW0ROk76TECtpNHxpFlTwJP0/19LO2EOcvPeerPkoHntgTz3bNlrooTTkSwSF1I577U0aE8lFl75UBlZkVshHsoFFrnrsXIS4kuBc9ypzT347A9+IU+WQVzI9YYcyIgJVYvRFIbhep5XCt3nbdp6M4sG7GjIomSxhMyACQ+734NOvGQTCyTx4xUvLa85E5vN//cOfuYsLjjpyMFTFOF2cVDVFkXRYYGgkFwJcEU95b8q0CUBYXPK5rZig3W/mj4+uis1FJB9hNWblo6UjyFQbsmywgX9pT3uMNhMjEYZHebjoOV7AgHB5tji0szho6X8OAjO1H49wSuuNdAON/jAfTrP4/MtJRFPFB0X5arLgHDKJqLY324IKdxStqR9pXS1jOCW3F6R7Eo+dEvqHD/jouNpCOzbUkDwAoYGJkhjG0H/9kiV4LVrUQawdTHjUIZcqscYRES05UIgr4lr1koJC1eZ1De6rIuL+HT5Qh1K2BnrC8lZroVAinLLDlJKoM588DnTTJ8/ES3tA== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0601MB1642; 31:uMVWidFzHlZUK7BDWqS6dNmKUu60vrBwZQmaJBprhTgkSKMl/NFlQvNyI32TR+72z81yF5Ac33qpLmckbDlowpvF4YM0LQ1R2rmXg2lfU2MEyeyyClpJFj79RKsMb0Z1KQ0T3mjSe3Hc9jIX2Lu4IkSfdW0Xz3/MdfTbK94rzgWR/m8PMejejG+LHdC698ucZLMwxCIKAa17GelLALjfsYLbaV0pPMUGI2HLHmP1c4QcEkYobtREh+oYrmIad36z9Yim147WjQasljG13tGOsKdLDcqcPsQ6WBGtBPSMIDI=; 20:3g8qw39CGgYnkmh702vUM5lWZbW2sH1YN4sXSEbVjrGxb3ZZRoGzGD2uLa0KweXKiEDtJiQ938eP/4JKx8130AktCaqRt9ZFXwDurNKted7n+FKWtEIyn35KsEMxYxCVHvI5lqm+qOUNa6LmD35ywiP/QIs061tSlfMALCZOi0NqpDHVz46ExjwOFXC7TLQYH1E4tP2KhR5Vukvlh9Min260EYtKHh/mPtijbzQNKNVxDV3chxyZij/Zr6tc0jTjEDNTbot7XBSAu4VKrffVLRc9s5mtrPETGbQ+K2JJAfHEP2PTmBwKNFYVQ4RZIeE/rkCGk907II0jHtFZmtOOZuv1bh1i5VBieQfTOy9kO/3HTO4rHLppj3xcBL1e6VVNN+Af1+igXzYUYuUvrVsocyAoMn00Q91NjtM0lgJLOF6h90Gf4AUzL0WbToBU/sVktVypTRDFchy2SEfh7HwsFs5HN662mcHLF1/3354K7uL3uZ3HhqN7qPeflAJ4eOFt X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:CY1PR0601MB1642; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0601MB1642; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0601MB1642; 4:HQyyTQkiZMuXltQ6PtZDI1Mz7VfnnHbEkKT3CEs+PpJzozLCQThHCJZgF3Ib6tfW61EM3lf+H4CCuCR/x2GgD0W0L8SkdClo+/GMrZTc8P/aMWs0zKP2qpIeMyyaxGS6iylTG1zDx/W/lBET0mZFV7uzvrjiPkI6OxdIEMfKxgayyw9vaFcX73Tqlbz2FjLxncuJB35EWV6uqt1p3NyCobj27TSpfoNTB7SRms4HENLoJexfIbTdMJYE1mVeYJdTlGbz+xuRJ4UUum6DRw1LMUIPzwxaxdmvXjHDcpI5WpjmLgtJsinw44MabEybkuRMtcOrqlYVCotEhk8sOsINo7pWC4BomiYM4e27uY+lE55KrQSaagAqaP8UZ22a+sC8dc1x8y4LQrvZ3MfvVhDdEolmby+ng/4Ckf9NBnIJXplThoIOYAjly1iEVeWGInkvZa0JkP0loT4OVnR+iG9BjXVJx0ur8VdTP4/2TUXL//uVOyKcoNVG4dpav4TaJNP1/WU9UmhcufVUyJ7+8gG8VJdpMIGKf5TqGd1PaSybljISH4RK8W5kkFySwFoVt4ZPTAcaT5jWa4amCo5EYgbOqw== X-Forefront-PRVS: 01842C458A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(199003)(189002)(50986999)(2950100002)(6666003)(6916009)(101416001)(92566002)(38730400001)(7736002)(76176999)(25786008)(305945005)(86362001)(2351001)(5660300001)(110136003)(6506006)(42186005)(5003940100001)(106356001)(105586002)(86152003)(2906002)(2876002)(6486002)(575784001)(66066001)(1076002)(3846002)(6116002)(189998001)(47776003)(8676002)(107886002)(50466002)(48376002)(97736004)(36756003)(450100001)(81166006)(81156014)(6512007)(50226002)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0601MB1642; H:gouda.nowheycreamery.com.nowheycreamery.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: netapp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0601MB1642; 23:ypAD5gTTZXOQGHKUCFIdy0wokG+FrYi+SS8xI/h?= =?us-ascii?Q?fnWIfisoC11aNGn6ldLjvDVCjPvobCYW8LznmtXv5PhRkLbpOI1eNVc4EiU2?= =?us-ascii?Q?A5zB3lEO7nP89qraZB95tZr8xwQyA4fuFFuvtrNfvGb6b2TbGNkEJ5HCtrU0?= =?us-ascii?Q?4mki0d2Ay6IveNgSTdKmVPQ02JuSZqWJn3IdFu8+/ODzZwmkJJ9MZFrePejI?= =?us-ascii?Q?k21174+xKdKRxAGImNp8EGOM831nw7QGm1/QgF7oGUxR7PXujz+p7NwS5ASK?= =?us-ascii?Q?Rfbaa63BbzxQOV2wXoDsoHNfFtbh1R6T+qWcFNx+FfiJmAYLPvIuGU/aOZ1/?= =?us-ascii?Q?crizMIwUwTqsJbAm9GE1mOZhsB+8uDEUl9t1PeCOFjGwpnXifGPBi7Xnu3GX?= =?us-ascii?Q?T7WHQlqxxf4Zq+9d2eyA84d5nd4+m0nbitnWz9DcirV8mdrFctCKldxe3H0f?= =?us-ascii?Q?wbAS5fjlSxKTPtPjLmM1Fdajg8hmCoBvJI/6EuHlJ4To+JbNOiPVreZbZp4F?= =?us-ascii?Q?gVzAJH2ZxMTeOPJ58Uosm4es7VbG/ccoI+TkU05fb7xUepqPxMkFvs4/G7dQ?= =?us-ascii?Q?AI7q0+5eOQj2Y1B1Qzc9qjLO3qq3of5drpl+3PobA6lHzYFNlVQ7XkmlaARU?= =?us-ascii?Q?qTL6P7X+uMn2nOAk4Bf+P+aSjLq2W6yoJ8ZIZ4Dn1Vx1RdMxON16FNIYhz/o?=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fr44yUPvJtVAL+ZW68+sb/pY/m1rCoSdG89lCTDg=; 5:dBVY7JlQziIvhCEuvGhsrwJ44QQCvgOHIedbBBpSFeqze5pFuMzxu29WCpkc4l12KPKSvkVP/Z46ZewEvX8cQErKdFlxnim7hAaHpolr4bIgBki+qmX8crH666axLXG6AXjz/2hDAVQyOOQT09Q37w==; 24:yfTQPYyaoU0/tOn/3/eLTanSbXDHtp/MjAgfrS0ZhtQqfPM3ytEXnSBnOLScKRt9Nz4+DekZfvlBh8149BgeKc08uxGou1uHh/EiDDmBpDw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0601MB1642; 7:h2hD6NQaKWa3yYZno8DHKtaJD1/MHoIEFuRDiEXAAgmou1bKr3Oak0Twwe6zBFhFNHik81uN0JxiGMZDlAcF89uOqVS+Tmx/BHKaxKMXJG0E4KuMUQSuR1hE6zT32TnVK8ves42qCwrWvRV4v9FUd/eoE5OKCUksQDoWHml31lDv9DpkZ3yIc3CL8Su02DsYz13alzT2uDPdylERuGf95b9tNKQYDvUMfjbckNKMfrNeFLpvFHqbE25BbPOtmgLVVWwRvoFN6gM2iept72H/0pHtQ2dbY2EKaGgnMJ4xkNUW2AlxMe7f3oT1r2kBheKaLZoCqco2iljJ0akV24S0CiGHnIHva8kFaLMg3oTjMFLKgvkcHxd4pWUK2XkPL617ziQUhVPK/7/2sQB8m8xdQZU7a28xq4LXAkAZqk0shIiemrqrP+Ve8l2uYouyjPRcMqjUTsthf4DqMSosMh7Kzw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2017 18:55:08.5299 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0601MB1642 X-OriginatorOrg: netapp.com Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Anna Schumaker Rather than implementing this twice for NFS v4.0 and v4.1 Signed-off-by: Anna Schumaker --- fs/nfs/nfs4proc.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 856d0df8d653..0b409b84b9a2 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -630,7 +630,6 @@ static int nfs40_setup_sequence(struct nfs4_slot_table *tbl, { struct nfs4_slot *slot; - spin_lock(&tbl->slot_tbl_lock); if (nfs4_slot_tbl_draining(tbl) && !args->sa_privileged) goto out_sleep; @@ -640,13 +639,10 @@ static int nfs40_setup_sequence(struct nfs4_slot_table *tbl, task->tk_timeout = HZ >> 2; goto out_sleep; } - spin_unlock(&tbl->slot_tbl_lock); slot->privileged = args->sa_privileged ? 1 : 0; args->sa_slot = slot; res->sr_slot = slot; - - rpc_call_start(task); return 0; out_sleep: @@ -655,7 +651,6 @@ static int nfs40_setup_sequence(struct nfs4_slot_table *tbl, NULL, RPC_PRIORITY_PRIVILEGED); else rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL); - spin_unlock(&tbl->slot_tbl_lock); return -EAGAIN; } @@ -890,7 +885,6 @@ static int nfs41_setup_sequence(struct nfs4_session *session, task->tk_timeout = 0; - spin_lock(&tbl->slot_tbl_lock); if (test_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state) && !args->sa_privileged) { /* The state manager will wait until the slot table is empty */ @@ -906,7 +900,6 @@ static int nfs41_setup_sequence(struct nfs4_session *session, dprintk("<-- %s: no free slots\n", __func__); goto out_sleep; } - spin_unlock(&tbl->slot_tbl_lock); slot->privileged = args->sa_privileged ? 1 : 0; args->sa_slot = slot; @@ -923,7 +916,6 @@ static int nfs41_setup_sequence(struct nfs4_session *session, */ res->sr_status = 1; trace_nfs4_setup_sequence(session, args); - rpc_call_start(task); return 0; out_sleep: /* Privileged tasks are queued with top priority */ @@ -932,7 +924,6 @@ static int nfs41_setup_sequence(struct nfs4_session *session, NULL, RPC_PRIORITY_PRIVILEGED); else rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL); - spin_unlock(&tbl->slot_tbl_lock); return -EAGAIN; } @@ -985,19 +976,27 @@ int nfs4_setup_sequence(const struct nfs_client *client, struct nfs4_sequence_res *res, struct rpc_task *task) { -#if defined(CONFIG_NFS_V4_1) struct nfs4_session *session = nfs4_get_session(client); -#endif /* CONFIG_NFS_V4_1 */ + struct nfs4_slot_table *tbl = session ? &session->fc_slot_table : + client->cl_slot_tbl; + int ret; /* slot already allocated? */ if (res->sr_slot != NULL) goto out_start; + spin_lock(&tbl->slot_tbl_lock); + #if defined(CONFIG_NFS_V4_1) if (session) - return nfs41_setup_sequence(session, args, res, task); + ret = nfs41_setup_sequence(session, args, res, task); + else #endif /* CONFIG_NFS_V4_1 */ - return nfs40_setup_sequence(client->cl_slot_tbl, args, res, task); + ret = nfs40_setup_sequence(client->cl_slot_tbl, args, res, task); + + spin_unlock(&tbl->slot_tbl_lock); + if (ret < 0) + return ret; out_start: rpc_call_start(task);