From patchwork Fri Apr 7 18:15:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 9670103 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 E081360364 for ; Fri, 7 Apr 2017 18:15:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D93AC28634 for ; Fri, 7 Apr 2017 18:15:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE41428636; Fri, 7 Apr 2017 18:15:56 +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 275C228634 for ; Fri, 7 Apr 2017 18:15:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933451AbdDGSPy (ORCPT ); Fri, 7 Apr 2017 14:15:54 -0400 Received: from mx141.netapp.com ([216.240.21.12]:41488 "EHLO mx141.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933010AbdDGSPt (ORCPT ); Fri, 7 Apr 2017 14:15:49 -0400 X-IronPort-AV: E=Sophos;i="5.37,167,1488873600"; d="scan'208";a="194559124" Received: from hioexcmbx03-prd.hq.netapp.com ([10.122.105.36]) by mx141-out.netapp.com with ESMTP; 07 Apr 2017 11:04:21 -0700 Received: from VMWEXCCAS10-PRD.hq.netapp.com (10.122.105.28) by hioexcmbx03-prd.hq.netapp.com (10.122.105.36) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 7 Apr 2017 11:15:47 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (10.120.60.153) by VMWEXCCAS10-PRD.hq.netapp.com (10.122.105.28) with Microsoft SMTP Server (TLS) id 15.0.1210.3 via Frontend Transport; Fri, 7 Apr 2017 11:15:47 -0700 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=+ZTfDeRBpQ3rG93xUqfXQNXIIZ0m1XhQEcYlMfENG1k=; b=Hrm89ZCNxJ4iLuvw8ZBXxuiuXAeUCcLE/FFTV+D1hVpcOgOa6XmQ/AJv8pdjKIEVo8eX3dVS1NCIuRaUwYYYRURTXkAOGe43W2WBwmL3tEcuaegmp8J2/Lzr2kA4sf8C2cxWUX3jdVNrPC+cA2WpHaA6Z6aIQvSQyiQzZP0PfO8= Authentication-Results: primarydata.com; dkim=none (message not signed) header.d=none; primarydata.com; dmarc=none action=none header.from=Netapp.com; Received: from gouda.nowheycreamery.com.nowheycreamery.com (68.40.188.1) by CY4PR06MB2472.namprd06.prod.outlook.com (10.169.186.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17; Fri, 7 Apr 2017 18:15:45 +0000 From: To: , Subject: [PATCH 06/34] NFS: Clean up decode_layoutrecall_args() Date: Fri, 7 Apr 2017 14:15:00 -0400 Message-ID: <20170407181528.2832-7-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170407181528.2832-1-Anna.Schumaker@Netapp.com> References: <20170407181528.2832-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 X-Originating-IP: [68.40.188.1] X-ClientProxiedBy: DM5PR20CA0021.namprd20.prod.outlook.com (10.173.136.159) To CY4PR06MB2472.namprd06.prod.outlook.com (10.169.186.140) X-MS-Office365-Filtering-Correlation-Id: d0626df0-05b1-4574-dcf2-08d47de21c65 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:CY4PR06MB2472; X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2472; 3:oqkbktOtvqSE1/Y61VI10n4O8301xXD9ZFht85ts/Z67ghK+FwJFWxeMdtM+tidv93Sw0pVQkBZPxlyfslidokyjsS8DgNHSRaUNsyKHy63KMqbcDh65DZNR4+1MNF5Ge6V0PHQQhyiTAPOMLpQhGrxzfgoPiaI/8bdG9RxE12a4tbZt/vINjV6izFjtRhvWhV6IIYPr8IDBU/tg+GfTXvbNSFsJoRF5Jo0n/56dzDWYQfvf0TttJNK7KjmowN+1VRuQlRtIRe6fmTm2IRZOPxA0FMufNrShQOZi4GZIG9pcbjZ7K5DhDbHD4W6rroGwTyQHsMmPaxCwA9DDY+WK8g==; 25:Rz6PNo86DTQ8rrfRo5CojlZwQODsIZW6tQy4Nvad0FaesOxOArNDEkPY76DibumS3BKXcKs3u5mZl+Uy57J2+uU8nvEKU0oHHyks6ne0aLOX/EIZxE0ZRIWFsh7amRyJsiWOGdpzNuaGiapOAi8QYoZUUhFU07Fs06uDuhYioiMG5vkY7gQgfUUtresKWli3SgtEqZNS7RFQbTAdIUuZbx/7s7DrirvWlXHOkB0abZnahjzAKSGLaMWXWVQhNjOGNYAs9w8afxcdbgiZ1dseEDQs9T6UoK9eoIltHMakwSS48FznpIwlt3khV4J50Hodn5JblfKZYXpWcfazVdLf+/SIyvCZKCsA2/1gIUq1ea0WpyWoemEuAqOjUxxogM/Ndwnl+NLcBRCGCaKhNpRpKp/IU5qDqy2Y8K9YX0R3WstqC/rQrzfoLv5ULL7Ib1HPoZLjYttWbT0yeigtnXTfHg== X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2472; 31:mF5UHBynflu5Kpz0zKOo97XyDePNgqKa3swxOp5hZ7OOJTfPaXhC3FGXxrSQgzHccppXDnhfuBS6A3TmgO3k4GhzUBNO9ZmMKgJouyNyDaUV50vhwDv3RxfUknLN4OiLA8UW8hzleKyXdlCP6nxpW+PbvtXweve6qWUGUc9dkaXbqYgJQYLURe8rrBbj40e+JKRwUfBdbMeRkcrUg6BBsSVWPJqT9yp+3YtWglyWtIswMy1mVwv1vr+3jMYSVKdDGzUE15i8VqH+908Aa+6HtLEz4o3RX0eiWB6c7v7b3Ro=; 20:+xC04/qU4UEaExSmYfIX0wtxuwIUGfh/9o7Tbfdnhii5R53CNDL8lBYwzFEtE3LHkgnnT23Y8VDFurobpGfPQ2liHV2k+4PURzrD+4ZJHxBQS14WuJRU7KJfkkq1I/JdDJAxVqrTk8qGvCvDLtMJv744nmOm7xtZv8vAquV6ykcijaIuPC597vXQb2UO2ikhaGW/sCuXmjE/SDZhkdyzj9IPAAfISGc2HzI6dMEkZt0oedXEjpyO/PotWb3yDU4Ff04e3I84cmQBv0EVECgKA7bE6T55sbBZFKo5+IwsCsNh9UYEc4Q2U858ZGBM5mtpuQU7Fy8Denp/cZ/NRyUbPtjItmvC3rEfDA98fi/htTN2tOIfaO4oFZAlWKIz6/YXqY+5R+Nw05LSjXnhmaZrnCEYxnaKsNfoSY1NJpMrmFdY0yhSa9xef1eJWAZA//s4gTqsxwSy8A0Yt70dsqFyBV5pTTNTGFIDpEoev7M1Bi8gaslu/LdvU0DiqKXwM47r X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(20161123560025)(20161123564025)(20161123555025)(6072148); SRVR:CY4PR06MB2472; BCL:0; PCL:0; RULEID:; SRVR:CY4PR06MB2472; X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2472; 4:0gjSnPkkNzmxzLjrQkFfOepPgwtK4fsBObucL6A8xnXFSuJC10tbQu/DqP6Kl8u9WyReIexeQTaDbE7OzDTXEFV4q/ngmSqSMFSld8QTrziFt6OAGgt1C5D+aU7bBkhk71tRAg+gO2fODekqbSPtNkYu6DcBODtqGB1t7iZScE8ViPJfQtcYmeIdcQaVtLXteW1DEVWto+JiRvk0EhSQTJ8sFGNPNoyl4fQqKJAeYJjzgBecSpwgAgo2X5xG63/ErrGhwJb9pF/k4SdexsIDy35C8jVgNQohxnhrfp/yK52fqY+kbApU9ORBZsf4eyfkIDJWrqt+LCxROtukOyhgQXgazikDxoU4MV7Lng6+T8HWreMbJXE7XJ5gV9n/gMbwHlOQjQsDB5hoeMjhmeI02+7sto3+hxqg9k8LK/I0a4INeBxkeBb3ntM9JpDhZjsQ99J2dCjRnh/ATqx4E62s+WYzShduOGENoDKaHQga5T4hz/p1TOI4dX2/yUoS21y985Eppb6f/EOp/jcZf2tzS2jvLh4/jGxa4wkrONCECP5Z5gg7lSUujql7SJYmqzMvLThoN2OUZ7qAJI+WSgW8OBQbB8R7kt2w9IEoweJr6+19AzJ2iXAT/aYOHFBYxzPfXcBhdpmM132WFVBMGQna1swiK1bkp0WNt5gacYYq2KdWcRBjNALWc9kCQfzb9PwbqL2jnddJnpsu2Jo45nOQEB5aNChPq1Me61NPG1qQwMU= X-Forefront-PRVS: 0270ED2845 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39840400002)(39400400002)(39410400002)(39850400002)(39450400003)(305945005)(189998001)(2950100002)(5003940100001)(6666003)(7736002)(86152003)(6512007)(2876002)(6506006)(6486002)(36756003)(5660300001)(53936002)(25786009)(38730400002)(76176999)(50466002)(81166006)(8676002)(50226002)(1076002)(6116002)(66066001)(42186005)(48376002)(2906002)(50986999)(47776003)(86362001)(3846002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR06MB2472; H:gouda.nowheycreamery.com.nowheycreamery.com; FPR:; SPF:None; MLV:sfv; LANG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gO6D6iMR38MOG45i5K5vVtl6pSRT2LJCx+wZgARTqhw7cg3zwmeg?= =?us-ascii?Q?DMreVnEu7yuKEj3TYktCJ5nB431/m1al6aTZL/kyg12/RMSMxeqeMwI5tFid?= =?us-ascii?Q?RD4tCRcfIgWPehf0kOt97gLs6Al96ICDUPCIzhP5J07W/WDc9vqlytI0v224?= =?us-ascii?Q?10=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2472; 6:DJfsz5ors7zQRrY0n1Mti2ac7Sdarqr4Hf+he8IZh4vfXsOHbYmUdlMou4CzytmWHBuQDqp1VPlEhGTAHCFRQ1HSPHspjMC20lV6VhXBoE62JHzuRctljfIJ+gP8+bUSMLukT7iH4zFbwhwRBSgt3jPgh00Dj2WgETBehiKPyu99kKVbLw/VS6YLQhLCUUaakFmRt/6q8fg9oUjQFlWXJhuD++F5aStyqO7XIl02U2TU2GvcXpj5VdVYbzETQfnK8MDZxlDEURWyCUj4FLWC8vMw3TsNHO1wrWreNH5tXRJRqbe6qARrORrhu7Se+7P+mubVWiaRtjlfbn41Yhoj2ohYoGowWnftgpuqa+5FqWfEhrRpm7ZbX+OMKsHXhHI8R55uKOdcbKguda8+6CxQqsPbh1lnHeagG4WqNs+lwn4s31UNhq7HyHltLUY1LtfmP2ZFuU/mEQaetSDTjQaN/A==; 5:AnQIProvMlXmjJ4ra08/jIkpkzS4jt0MoP9BrQXZ5jOgL1NHYypeOS+3HEVFZJHWoHXclrvTCqeqNQFwnt1TqvRabeJRCrvPgeKd2LwPPTJcYzgZZow0nW3APlMArqa2B/SQX/zAlLWZ7T0D4hMFBQ==; 24:e74c62lieg61ShIl9Px4pg+ek789SXiyotdQJE6qyVoqZFyeKKGK9YkpJ8UKP2zClktIigLwW4S4QEAzXKFsXeFFwAKtzUEWj5frt+AITT0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2472; 7:YnjTwscQBCU2qvdquaEp3KD+yufonKfsB2aNN/vi63Unn5D28bgojKl32Bub1h2hm08q4CpPkYGFbFhOxmHuOiC/furi5/vG8HaKXyfbUxubqwr8aSvULF0emCM1R/bzD+RjKFC4pLjBUR+bviS4r+oz1RlgMVLQ11P3vCdlNoV8PjNjngb6JafnWdyO2ISVghvIiIxLtaCwx/GX7Qjwsdax84i9BSbC9cNexE5WbRQKbT/ojzJ8DesUwHtXOo8DV9FbLX6WG0hSmOZc97LQ3H8MrJtHQM328e/Y93XOtDHpZzwW9an7juNHd/RwkMHSISU0NI1k4GrBz25YQbJotQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2017 18:15:45.5838 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR06MB2472 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 Additionally, this change lets us cut out the goto by returning errors immediately. Signed-off-by: Anna Schumaker --- fs/nfs/callback_xdr.c | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index 0319230fe1a8..d5ddceb91a9a 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c @@ -227,10 +227,8 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp, uint32_t iomode; p = read_buf(xdr, 4 * sizeof(uint32_t)); - if (unlikely(p == NULL)) { - status = htonl(NFS4ERR_BADXDR); - goto out; - } + if (unlikely(p == NULL)) + return htonl(NFS4ERR_BADXDR); args->cbl_layout_type = ntohl(*p++); /* Depite the spec's xdr, iomode really belongs in the FILE switch, @@ -244,37 +242,23 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp, args->cbl_range.iomode = iomode; status = decode_fh(xdr, &args->cbl_fh); if (unlikely(status != 0)) - goto out; + return status; p = read_buf(xdr, 2 * sizeof(uint64_t)); - if (unlikely(p == NULL)) { - status = htonl(NFS4ERR_BADXDR); - goto out; - } + if (unlikely(p == NULL)) + return htonl(NFS4ERR_BADXDR); p = xdr_decode_hyper(p, &args->cbl_range.offset); p = xdr_decode_hyper(p, &args->cbl_range.length); - status = decode_layout_stateid(xdr, &args->cbl_stateid); - if (unlikely(status != 0)) - goto out; + return decode_layout_stateid(xdr, &args->cbl_stateid); } else if (args->cbl_recall_type == RETURN_FSID) { p = read_buf(xdr, 2 * sizeof(uint64_t)); - if (unlikely(p == NULL)) { - status = htonl(NFS4ERR_BADXDR); - goto out; - } + if (unlikely(p == NULL)) + return htonl(NFS4ERR_BADXDR); p = xdr_decode_hyper(p, &args->cbl_fsid.major); p = xdr_decode_hyper(p, &args->cbl_fsid.minor); - } else if (args->cbl_recall_type != RETURN_ALL) { - status = htonl(NFS4ERR_BADXDR); - goto out; - } - dprintk("%s: ltype 0x%x iomode %d changed %d recall_type %d\n", - __func__, - args->cbl_layout_type, iomode, - args->cbl_layoutchanged, args->cbl_recall_type); -out: - dprintk("%s: exit with status = %d\n", __func__, ntohl(status)); - return status; + } else if (args->cbl_recall_type != RETURN_ALL) + return htonl(NFS4ERR_BADXDR); + return 0; } static