From patchwork Wed Jan 11 18:54:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 9511049 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 03B1F60710 for ; Wed, 11 Jan 2017 18:55:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA8592866E for ; Wed, 11 Jan 2017 18:55:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD28D28675; Wed, 11 Jan 2017 18:55:28 +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 5B2D72866E for ; Wed, 11 Jan 2017 18:55:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754222AbdAKSz1 (ORCPT ); Wed, 11 Jan 2017 13:55:27 -0500 Received: from mx142.netapp.com ([216.240.21.19]:47054 "EHLO mx142.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754062AbdAKSzZ (ORCPT ); Wed, 11 Jan 2017 13:55:25 -0500 X-IronPort-AV: E=Sophos;i="5.33,346,1477983600"; d="scan'208";a="164232067" Received: from vmwexchts02-prd.hq.netapp.com ([10.122.105.23]) by mx142-out.netapp.com with ESMTP; 11 Jan 2017 10:50:19 -0800 Received: from VMWEXCCAS05-PRD.hq.netapp.com (10.122.105.21) by VMWEXCHTS02-PRD.hq.netapp.com (10.122.105.23) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Wed, 11 Jan 2017 10:55:11 -0800 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.120.60.153) by VMWEXCCAS05-PRD.hq.netapp.com (10.122.105.21) with Microsoft SMTP Server (TLS) id 15.0.1210.3 via Frontend Transport; Wed, 11 Jan 2017 10:55:11 -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=8bSsYnbXJzpyCfG9G3SITQuow1qEK7A0Gn+UaL2cmlg=; b=Z+msuArrS2hjhTpU/k/G17B4667nNx7F/TIwyPV00vcFLIqxpY5wd1NxPistoAhZHi/S8W6gUqo+Z2gSPVocwZZAY9K/PZixXDwIfPj+Uky3f74rHivueXW0yFNb4gw5+bzXPbkh/Uu4R3k6BroP5pulq4U7AZl9MCrXQZAIYow= 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:09 +0000 From: To: Subject: [PATCH 08/11] NFS: Handle setup sequence task rescheduling in a single place Date: Wed, 11 Jan 2017 13:54:51 -0500 Message-ID: <20170111185454.9315-9-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: 12e11e1f-30a3-4f6e-326a-08d43a535e18 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR0601MB1642; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0601MB1642; 3:nN+08xoWghTP2aD3NmbC92ZiZCWiCCHTXR6UN5eU4tpeYLAjQ0fxG6vjQRD3AwEIox+7YuYe2cVieyZ375CrjXUiO9uTQqeSETcAfB0jjhoqdqmJf0OKw8x3rahzxg0I5btKjA33q2xKaKyFyTqWs60IOP0fUsZeDBV/WQxoPHWP4moDjmLmQxlLdoF2PC4mM0UJlx2K++XYCxOgXeht4ists8VssiLwPu8EERyWGg6aLY3felPVJKKsZAPpQ/OFu3foYCZpFxHU/R8S0AbTsw==; 25:Pc3JP3x2tQll/ZiqzPPgMeyHTvjvZNjI6josyCvoLTiAVA//fwQOPTmK1XD0fSYK4ucHiWP1Wex2quJ26aOi4CH72kQQ1zJzj5fI3l46Ptg2DbInikcti6tirRzp4l7FxOP/wSDk11HlrQxlkoUGXl9fJub8KaotqVqC1a3lRnR07CPUFyXaK0I0HKJVWiBpcSznN7VjRmsAvrAnD/INzXrvLnQJujf58mT7/l+UWeMte3PwJNu8KPyVrsS2y1o7U8qQqKMr8Z2O91iJYBICsNw3lEjYBSIPG2qlsWhuHaWxZidBgcB19MBtBmTzeWppVURlQ0yh/kLMQaLkleT2/W9taMdFD5EDCAQxjYuowN1cpXIhjR1HAXQWI+unDiwpSRWmnc4Kp6rk6oEUw2q2vyL2rUTJlQdskdPQ6lJT1e744uOfs6q1salqF5s0lK9wbtLA6zaoWMoqZFAuSCjmaw== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0601MB1642; 31:Cg/NgDLnTZFzTAHQgQr3ZXB4lAsxSitrwlD7U/b/2ReP1gKZn6jT22gqyTDTK1wfpNoy42DArm/O64mrE6elnJAqSU/RJl5mEO9uZibUV6LCHaPOq066R0M+Vt4p8860FI/4b6/0YCe23p/mIvxdOqZEJzkoV1I9y+ulupjmo8EquD885fNR5zzq+OSnHunYqMtfVZWpxeX435zINjQU8BaLOxCB62SjaGH6srAHRBkvG3Dbxbadq7WmvdQSzBxCGbDb8CjPGvN1R9W9dJLTZg==; 20:bDMWQphKrs/LZGcpE6LCvkm7CqWh3Gq0nzMELj8WfQNtFvsSb0uvxWji0TOsYL+bHYuIpn/MqkZWPZm2BsjauTLhIKzr/W0GR94e4Ky/s93g4a1Dhy9ok/dCwkDJosdD0QjeOYShIQXvFMUxeXAqUed7xtXEEA9xlljpKdSLwLljZhzqS92MfsC6Y6xJgqlNhe2wFtqJkX6/xu6rXSyCGAj4hT4BtgzOqOeXk2d6cB+ZDPNmN33Q3vqqLhgCmIsCeyWlqVtZzJHfZGEeGZ9gf1PqBuK67qlZtXsrh2L+sIWvM+ZPLCcnvy9UB3WAYqoCPoiHYmw3+AXrLwF61tzmMfH++K4hDbSuy5CjGrGEBSzzl5rht1defGmRGcvGxMBMXezaCaHeDwM/JC8Dvblgn9MOSuYBoB6hI/ujttN2DwzUb6t484vbPbGnbpw2JZMAQcHtgwgr65uzbaGNNjESwb6HlKKIFz1bKbGf1V3maZyFEvXIS/E4wFOVLnbtplXF 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:KCsDy3SkleUIuu5PZjWUo2bKI/pV8aUtHRe72fpN+XNcyjpaJUqXftqwS1mSqYapdkTZlFR7kxX1e98HXdjGt1PUa5RUIUEyR7OBnf7JeGg85Qz2KCaBYrMbKyhf2vm91cS0/YayRMfQyXUSAl0PM2xKfunONlFHzOzNntak77Mo02ISVTSDsKICU+DE3F2p0xoRHj1+XVaKSUs6Ub21SPMPrsz6CRt7c/efpydhe/DncUKL0U/7scn8VTukY4wWjMNxCDJBYokcDuwnYHZBfaT2cylPILDKSvHRRrn4WIyInAFds5KfFCM5rUCSpaAwJvpYEclN2zcjXADbNW0hZpcWC3fGHTloh5w4hAH/8J/CPZ0NxLZo0jR1rPZxO44+k08Py6SE3ozekBTpm7ZQzgEHW+oQiTMuoKvT3WIgYsf7FLUHjpglm8cq593jm0PmSZGM4ridMM+SvcuSARnuwFsALeLR1Z/yym/HbrZadXeUqtHlBRfBO8NgGh4oJRQmnmEKpj3++fUvy3qHfz46k39R1AGCAxb1rhm7BhwXA6Z8skbybfi9Sz7F0gIkMjEYLN0XAz+5LwecDIr+/NCK7Q== 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)(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:FnHP6sz3cQHImfs9i7y/e4hN3Aq92NGgy1qeMO6?= =?us-ascii?Q?ckz3TeyRMxjVGA7J6kKPn+eRPuKsaBYjwIQCZIFfffWrWxk0KIUsOKwyfWcO?= =?us-ascii?Q?m4ondCJi6Ip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?= =?us-ascii?Q?UTHt04lW6pVBX201A4qSOcWvFnejYKei+Vy+XWNjR0h1ndH1j7issSWUTaHr?= =?us-ascii?Q?XzrNJ+LmkHcgo6sevi6FQK70ORFa2lL8omMkQ55pPj1gDNQeG0U5XdOWmw+P?= =?us-ascii?Q?Ht24R5vxZXquz2/ZEMdspNse/BNif8qV59F6uu0NEltCs95Z3ze2JJQ=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0601MB1642; 6:TcwRp5mV5rqdSZCl9MdQkLOlq//PT6LtLK6neYX6XhwId4kRoW2aA75aKUL9l5WOmvqiUJMnxStIsLTfGgpuxV4HjvGAUdhlA68PNp6TLOvCcmTRhaK51cxOzIrySLLiEZIPDcTO09HSIHnt/vvv3fnppClgPShIDv6n7snylQS7DJOUJQkjaTM3/yFZ5L9ilQ4uwQRnoP5EMMufxPq6bE9o+jo3vjFDkDTK3f6/i8n0WoY+clJv3yHz+nwEavLw//sHxTpu7McC50z9CZJZm7wXNgSH9KiNXMamx9m2/OsXB3YACIxvu/geSkwDdpAQtCheygLzZ3hjKd+DOgiP43gsb7kyrkZr/at6h8P5SdE36RouJko70JsBIhXSP/hoSAvzq5tZHK3di9/6ifQxziW/VDPwzFA2TOlSUr40BOY=; 5:4b4O/TKisMQgXEaQXAE1joUSDnrQ+ViMQnoxfFgPjuFcyEZSOfhTUPi4hXNV2Cleg/cUy41x6FfhvoOkmNTxMyNhAZ7cqCX8EGQsQmGhW/YOGAv3l+WI9Eb74/G7zMUoPYcH+rPMcdWX/J55a/EEgA==; 24:PEhsrnjxKmUnahps5FbRysq+xNl7VS0a/8ND4l66+Mq8+AJM1LtsJUweWnnLxYj7nz9sRVrJusWrvGrJmcIml+PyAUW9EAJWPLMIWZ9KIdM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0601MB1642; 7:I8VXGT2P8BUzV31TSUaIiu/UTAJwtvBTPd24x88S9TtKCSfixnXSYmy2f2mrCwrA6iHRnJKTUTNIwhsxS5APc9Z7cEpa4rbL2RmTb7h1OIPSyV07XqYBPN9CjpTD58WImZVjNGiAFJfxGrCHPhi5IKK3xwH2wpOHnqxFDtCIeUXbtN0R3i30hvC8Z8Aqzm7PBkrhBB7+TkjXauh4SKNVesANlWFc78zw1FpwXrFd++Zn/9W3FJksKCblfRNg0vF4R8au88tSZ8ceI3xHa6BdHqPYvZTVPAdJBhlpgb24VZAGWPSTN9P3PcfUFwwKdnCxAGfQBn2UTuXvZz3o8BsZyxvy6tQTNGNO3BGcf7CJMyv91caUzP7kb2KDdxDlHMNs72kftsKgE7L53ndcI64HO7pM5TfpyrHTVrU1e39TrejjmuEbzRjZ4xaLb8TN+ypeo1DFpVEopX1HV8rngAlm/g== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2017 18:55:09.6278 (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 Signed-off-by: Anna Schumaker --- fs/nfs/nfs4proc.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 0b409b84b9a2..56e8c9e04f4a 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -631,27 +631,19 @@ static int nfs40_setup_sequence(struct nfs4_slot_table *tbl, struct nfs4_slot *slot; if (nfs4_slot_tbl_draining(tbl) && !args->sa_privileged) - goto out_sleep; + return -EAGAIN; slot = nfs4_alloc_slot(tbl); if (IS_ERR(slot)) { if (slot == ERR_PTR(-ENOMEM)) task->tk_timeout = HZ >> 2; - goto out_sleep; + return -EAGAIN; } slot->privileged = args->sa_privileged ? 1 : 0; args->sa_slot = slot; res->sr_slot = slot; return 0; - -out_sleep: - if (args->sa_privileged) - rpc_sleep_on_priority(&tbl->slot_tbl_waitq, task, - NULL, RPC_PRIORITY_PRIVILEGED); - else - rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL); - return -EAGAIN; } static void nfs40_sequence_free_slot(struct nfs4_sequence_res *res) @@ -889,7 +881,7 @@ static int nfs41_setup_sequence(struct nfs4_session *session, !args->sa_privileged) { /* The state manager will wait until the slot table is empty */ dprintk("%s session is draining\n", __func__); - goto out_sleep; + return -EAGAIN; } slot = nfs4_alloc_slot(tbl); @@ -898,7 +890,7 @@ static int nfs41_setup_sequence(struct nfs4_session *session, if (slot == ERR_PTR(-ENOMEM)) task->tk_timeout = HZ >> 2; dprintk("<-- %s: no free slots\n", __func__); - goto out_sleep; + return -EAGAIN; } slot->privileged = args->sa_privileged ? 1 : 0; @@ -917,14 +909,6 @@ static int nfs41_setup_sequence(struct nfs4_session *session, res->sr_status = 1; trace_nfs4_setup_sequence(session, args); return 0; -out_sleep: - /* Privileged tasks are queued with top priority */ - if (args->sa_privileged) - rpc_sleep_on_priority(&tbl->slot_tbl_waitq, task, - NULL, RPC_PRIORITY_PRIVILEGED); - else - rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL); - return -EAGAIN; } static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata) @@ -994,13 +978,22 @@ int nfs4_setup_sequence(const struct nfs_client *client, #endif /* CONFIG_NFS_V4_1 */ ret = nfs40_setup_sequence(client->cl_slot_tbl, args, res, task); + if (ret == -EAGAIN) + goto out_sleep; spin_unlock(&tbl->slot_tbl_lock); - if (ret < 0) - return ret; out_start: rpc_call_start(task); return 0; + +out_sleep: + if (args->sa_privileged) + rpc_sleep_on_priority(&tbl->slot_tbl_waitq, task, + NULL, RPC_PRIORITY_PRIVILEGED); + else + rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL); + spin_unlock(&tbl->slot_tbl_lock); + return -EAGAIN; } EXPORT_SYMBOL_GPL(nfs4_setup_sequence);