From patchwork Wed Jan 11 18:54:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 9511047 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 19A6660762 for ; Wed, 11 Jan 2017 18:55:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E38A2866E for ; Wed, 11 Jan 2017 18:55:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 031F028675; Wed, 11 Jan 2017 18:55:20 +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 750BF28673 for ; Wed, 11 Jan 2017 18:55:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752914AbdAKSzT (ORCPT ); Wed, 11 Jan 2017 13:55:19 -0500 Received: from mx143.netapp.com ([216.240.21.24]:63323 "EHLO mx143.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753434AbdAKSzN (ORCPT ); Wed, 11 Jan 2017 13:55:13 -0500 X-IronPort-AV: E=Sophos;i="5.33,346,1477983600"; d="scan'208";a="168739362" Received: from hioexcmbx01-prd.hq.netapp.com ([10.122.105.34]) by mx143-out.netapp.com with ESMTP; 11 Jan 2017 10:50:12 -0800 Received: from VMWEXCCAS05-PRD.hq.netapp.com (10.122.105.21) by hioexcmbx01-prd.hq.netapp.com (10.122.105.34) 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=6Wu3O+2B4ekliZl9x9PNPDb1EHnbUB8zbLQGL12mnN0=; b=a2Ilc+O47oal5mju9lasA2NYoz5iGabKrz0SEAK78JO8FwReSX10kTL8hsxYqXhN2wc41iA+Vz68DZ6YG/6UOBkIr9oV80bYKlZtic4cuWPEw9bcWemXxbSuU3F/2zAg+0UPPYK6EI0q+gMRhIQofe24Hfe8ZJOik+LM1vpaPRk= 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:11 +0000 From: To: Subject: [PATCH 10/11] NFS: Merge the remaining setup_sequence functions Date: Wed, 11 Jan 2017 13:54:53 -0500 Message-ID: <20170111185454.9315-11-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: b069345c-f6a0-49bf-233d-08d43a535ec6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR0601MB1642; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0601MB1642; 3:B82Mck5DUVy7Ls++xUG4QsyhIJNHWNNL7M7OcczNDXIm4hdI1zIp6vLyYZQY2lHmZ9d1951/BHWvXt7VNlmK4XAkVsdcMONL+kJk46FppH2/z/8+XjVcMkspovCLXyywVxPVLAlAbTWL4FfFKqpwwtTRGDb7qF38l2R8ZEwcZMR2QzC/HvHpFZwHzRa8WRxqdbQlY7WhCUDZJP+3mgz9X8mjBRTMHPY5IEyAjmDJ6hBc4yy0kgyarUakNpOEA5LWA6qh+0MGrTI/qje0pES6iQ==; 25:72+E7sV9OtgbeB5K46SAnn6RugnNjYoeGrAGOFMv/nyicnUr28ZeqFcn1AFQtAb/6ub7dTHAH3mtMMkpaRNtf7NAPyAzE6a/9KCZeJjjzrrvUHjYXGqljO96+c5ubLSW8zFzswlevyvYG1NknGyx5+J5RUupbqIxmAIWnfquGvQGt2szj93XYkDlxtKiKs6GA7Vu4gbw3eEBp/82STcv6nsADW3Q/WJvAVok2NpnJfMz8G01Sh2SrmGa5aBzmaPAXrzVh3UJfCGVfCiLNd95nLWf9sf0zEl6m5z3h593NLgHoWlXBd0wXQ/UmbtH+OIEfEfh9QBw6jf2XSzE/X6dPl4P93M5ubxnvOXVIt+hMJoHLeRxzB4tmW11gSQQ5vmwVSj2waKviiJcL30oyfOgAw1ABlOgElUhfLpxAFJkJX8mUYr+9ZVmODBpE7iHXG+xiT8fo5pzNUfSSozIkfnseg== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0601MB1642; 31:lmBoPPhv/aiYJlM1At2XQeKKvEmkY77rYE/Um85gv6cth5FDE/cc9vGzd+T0CzlpP0355W9ziGvmB92Vq486onTPl+0N2x2aovZTkRm2pLmsUIT3O220i5LGcUOnoTKht8pT43Z7PWpWc8+lN9EQiJef3y5e1PxQkMGoYq7q61aU+jWzcdKINCIbqYSPq0Ti9Tvq7S8c2I/KrRlHKtwkqZozPePapRADiSqDWII2R0BGwkAQkzcNXEvbwkJkHx5b1OxBVSZlVEOpugSHPAwI4IFtknT7SieoBPyp8aUnLUU=; 20:RXVVaYof9DiBi7J6qj1YPGDEWNSYE73uP95z7jbXVMgQwvrPoNzAGOKLOuDGSTw7/OM8e9SAbsZCRsP96M05NYlq2yg6eGOZj5PoZoMpweY0KdPUx1T5XvlODf8yT96taN3OsIC3Y8xD0RPWuDZy6VRrXsHL1risNtlKcl9iQEJTGmwGCth1q3iZdnDokZtaeDnDU5Hjt0XDCD3rMhcu/7O7rWSQo06aEbAdLhF8gP8BtuU6Ob2MdM5oJhvBYI0tIf2cPsoeI+Rv54vhBTNJ44czZUnrf1oqfa9UiAzG+AxQFNL23iRrWcExuyHSVWd9wh7KYo3s0RRbw3Rr/vSlRh6GX7T/eyilGydLCIzSokFsBzRCQLjwTmymiCChKs4Fi37crLA4j+4WOHy1SSLA3BOumnAHW6dNpG6bwvadia9tCsx+FoIMgZSqdnDBe46DUu2jFtj4vgI8FkK8dQ+od1+W7nEvOhMzuHk69H5UiNlLIiB1vsK1Nhpfk/47v9ZL 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:ZvFKtDq1pGFMZqfeW6/H1AmEzaar/nJaFkr8oMLmAZG7NwD+sEN+ug7gh+rlawU4JWQ2tfv9+Ti8oleeJ9sTHhZQNsBbnc81FdWfeBgyyFcyC1anyuzxljYjOdWUKopcJjicPasp1vB5b/lcOZgXvLCEKdPx9EWN3Vmm7w3eQsjDVCYrYzQFlh2RaiBmCtjESoCUjULM7gNJBU4rFeEP2VNeHTVo3eMjkEvae0cl6MSQRN9MaEIhYgWaumtTJAdyyMLxPUiHcixxNmknej7fiRnTQzv4Z4gx69XsyDX7DwJExzRxh044bSpHDN5hwel76vvF06VLYff65leRcLduepMhYyjUlXy743Jpe1qqUY2XEFDMDbJuFq2LIg53VrHGnJ6X6NzFGrPIys9bd4Anir3ZbJ7Ym3BcMNlBodp+OmorfmW8xnmCEcqztImMvjsD3hi9GyDreG7knjNHT2El0GI2zafS7IHKILPQpCauEKeRV/xgDyusz27z08H1sgMp+ekMDEyFpsFUdQyV8dM6GLoOHbtPkV7y59E66dx+SdWNn4JXLFdCFVh2dMDAoa2XDN5N5CTf02e/Bea5wdX0bA== 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:CNQFpf3Se4wx1jI7SjVW3LiMOcex8BdSaiBGZnW?= =?us-ascii?Q?gm4r435xeR+fpr1RLT9xTl8gHnDvkfohG1C1etTe9Z8+wgm8JT2dSaivAEsv?= =?us-ascii?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nWKZkqjIB?= =?us-ascii?Q?3Am7JzOL605rws2FrnZvxYRlxK54nAcQdx9Rg65Ewg7up9iSzF4TrbRt5UQH?= =?us-ascii?Q?xA8424JD9buKp+sqZhHK4m/A51+bR8AbY+ZfKLOdtL1I2w7jR+btj+vdRMk7?= =?us-ascii?Q?/hudMWJ0LWXinn87tgYICbpAtat0JIfmRPNAynVdTS9srcOSP0KlgRw=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0601MB1642; 6:we7yOSb5Wlnd6wRiuAFBxKzHaagm7c9cDKYKLDiD3+Pti0xXqAWCqwRdJEKVYPTVSWSghGkO3sPeSr0HGYCKQEEF3JkPgbEeJSoVJMDRr/JqX+Y3zNyTID/GXH73C6C/8f/W8pSlYOT0W2QHdyyXbLT8WiNe7IfdFhWpx5phyLS/ASkzOXmJOOJqIRbhHvj8hA/ZKm4B+w/CHnEtImpzD/55LCtnM6pVcwK510mrr0yIfAGt7pzieu/aRIsrZ6kIyiBS9bwk1phh6U7nRQkuM8SN727uqQnuBj+aB4qUS1BPicm08uPV+f9a5fvq6Rk2MPusxzmlXeTil06f4nqC5bppLi6xQp6vum+X2HcuGNnfsRkgZmcPxHK81Gf09SNecJM3SxmfPGCaUrX/XBOILRZyLUIfon1EqONHf7u6L5o=; 5:+oWWKuJLfSwRapfL2XqM6yO9Kp51wVJrXGpwAzXfMhqbk1KCp+W/cB5Qyh8Qjsn7u+GsgwKDCvVht4w/KTbCL/gftljLuGp7kBHmRkkkmU09anHPed6rHN+bRAUYXjN6ESThr22U3keBN6DSgwVGuQ==; 24:HWKN6dTYELedIx5ymcOI2VzmyqJyi7Bt0Y160rAJ4TqwL2Mrtj9XuS8QvR6FRw+NEeZq7Y8q+VWqmC45FduZe8GNPbzUekw+9hEV33zK3j8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0601MB1642; 7:pIjggK73LkMoZYKz/Or4WTASDEbRqMphhAk1Ww67bwT8DftwKW68o2kUOiu/33tt4bcY5iIHl2ZZKAXo2dQBctJxB2IJJt1yDFBxhsg1YezZAJBn4CvGifYrEJ6X09Hu/jVrAKpEISIefPGtoGZemg7dJST+WTcZfU5ehiJXpqK8ZJU+dQrfagmuJ8fh1qgPW8Xd/4Qt0ergBGEKIxm0fFODK3UNwgkZWgGaAD2PlP9qz2KKX5FDEf5KqFX/yML/fKabXfWRHVYBH5DYPlCwVfF+iBhZ5s5c0zB0lm6GspvIRPsGVz/o4sy6x83lHP+brMQy5zuymjr5Ex1PV911qq0urN7LF+Wfog+plMwx9z2jFHvkG2KUybBMNaLTHNghHzGv+IX9tPOlhrroqS0fY4NXPyG25h0tpqu3fXJdKGtV4ep4PF5/oCoKjuFpdMLN+R/R5f6XVKdwOf4DtCZ//Q== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2017 18:55:11.0560 (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 This creates a single place for all the work to happen, using the presence of a session to determine if extra values need to be set. Signed-off-by: Anna Schumaker --- fs/nfs/nfs4proc.c | 87 +++++++++++++------------------------------------------ 1 file changed, 20 insertions(+), 67 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index aaa87f4eacf2..31edcf07ac93 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -623,26 +623,6 @@ static void nfs4_set_sequence_privileged(struct nfs4_sequence_args *args) args->sa_privileged = 1; } -static int nfs40_setup_sequence(struct nfs4_slot_table *tbl, - struct nfs4_sequence_args *args, - struct nfs4_sequence_res *res, - struct rpc_task *task) -{ - struct nfs4_slot *slot; - - slot = nfs4_alloc_slot(tbl); - if (IS_ERR(slot)) { - if (slot == ERR_PTR(-ENOMEM)) - task->tk_timeout = HZ >> 2; - return -EAGAIN; - } - - slot->privileged = args->sa_privileged ? 1 : 0; - args->sa_slot = slot; - res->sr_slot = slot; - return 0; -} - static void nfs40_sequence_free_slot(struct nfs4_sequence_res *res) { struct nfs4_slot *slot = res->sr_slot; @@ -861,44 +841,6 @@ int nfs4_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res) } EXPORT_SYMBOL_GPL(nfs4_sequence_done); -static int nfs41_setup_sequence(struct nfs4_session *session, - struct nfs4_sequence_args *args, - struct nfs4_sequence_res *res, - struct rpc_task *task) -{ - struct nfs4_slot *slot; - struct nfs4_slot_table *tbl; - - dprintk("--> %s\n", __func__); - tbl = &session->fc_slot_table; - - slot = nfs4_alloc_slot(tbl); - if (IS_ERR(slot)) { - /* If out of memory, try again in 1/4 second */ - if (slot == ERR_PTR(-ENOMEM)) - task->tk_timeout = HZ >> 2; - dprintk("<-- %s: no free slots\n", __func__); - return -EAGAIN; - } - - slot->privileged = args->sa_privileged ? 1 : 0; - args->sa_slot = slot; - - dprintk("<-- %s slotid=%u seqid=%u\n", __func__, - slot->slot_nr, slot->seq_nr); - - res->sr_slot = slot; - res->sr_timestamp = jiffies; - res->sr_status_flags = 0; - /* - * sr_status is only set in decode_sequence, and so will remain - * set to 1 if an rpc level failure occurs. - */ - res->sr_status = 1; - trace_nfs4_setup_sequence(session, args); - return 0; -} - static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata) { struct nfs4_call_sync_data *data = calldata; @@ -950,7 +892,7 @@ int nfs4_setup_sequence(const struct nfs_client *client, { struct nfs4_session *session = nfs4_get_session(client); struct nfs4_slot_table *tbl = client->cl_slot_tbl; - int ret; + struct nfs4_slot *slot; /* slot already allocated? */ if (res->sr_slot != NULL) @@ -966,17 +908,28 @@ int nfs4_setup_sequence(const struct nfs_client *client, if (nfs4_slot_tbl_draining(tbl) && !args->sa_privileged) goto out_sleep; -#if defined(CONFIG_NFS_V4_1) - if (session) - ret = nfs41_setup_sequence(session, args, res, task); - else -#endif /* CONFIG_NFS_V4_1 */ - ret = nfs40_setup_sequence(client->cl_slot_tbl, args, res, task); - - if (ret == -EAGAIN) + slot = nfs4_alloc_slot(tbl); + if (IS_ERR(slot)) { + /* Try again in 1/4 second */ + if (slot == ERR_PTR(-ENOMEM)) + 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; + if (session) { + res->sr_timestamp = jiffies; + res->sr_status_flags = 0; + res->sr_status = 1; +#ifdef CONFIG_NFS_V4_1 + trace_nfs4_setup_sequence(session, args); +#endif /* CONFIG_NFS_V4_1 */ + } + out_start: rpc_call_start(task); return 0;