From patchwork Sat Mar 16 19:55:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 2282741 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 31DE23FC8F for ; Sat, 16 Mar 2013 19:55:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753934Ab3CPTzr (ORCPT ); Sat, 16 Mar 2013 15:55:47 -0400 Received: from mail-ia0-f181.google.com ([209.85.210.181]:58254 "EHLO mail-ia0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751439Ab3CPTzr (ORCPT ); Sat, 16 Mar 2013 15:55:47 -0400 Received: by mail-ia0-f181.google.com with SMTP id o25so1906226iad.26 for ; Sat, 16 Mar 2013 12:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:subject:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=+t3Y3VAWybr6vemsnd1Dt/y0U7xtmgqDhjBcV81Jfok=; b=npRrpMKke8wkfgkiIajKQkrW2ptlHS7ugx5Q/cdsYNo+NErbU1hlFruXfjtn4vm+x2 zvWZzr9LCrK74TgucTBrOaI7bb+gwYAgABLijz5+7VfhpTz3h60sXxyuhkEy2n2D3DSA tZqU+pvr28WNdTNjGy9wCxjvWGu6iY9k/jZxP4YILF2hHnuCjuJGn9P6uDAYH8Y7pJWl t9M3y1qeWjxJ/zTQCcJcI3F4A/TLVOkIIR1Adp8828dfudkzIT/SGaEux9TVplaxr4+X VHEKEugO8J9oIBSOKvVNFmBJnGx5KAQ0mIUnoMiPcKfe0bf8qQyMkvdJWca23ubE6pzq Q5zw== X-Received: by 10.50.222.129 with SMTP id qm1mr3805849igc.76.1363463746684; Sat, 16 Mar 2013 12:55:46 -0700 (PDT) Received: from seurat.1015granger.net ([99.26.161.222]) by mx.google.com with ESMTPS id in10sm3802741igc.1.2013.03.16.12.55.45 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 16 Mar 2013 12:55:46 -0700 (PDT) From: Chuck Lever Subject: [PATCH v1 11/15] NFS: Clean up nfs4_proc_get_rootfh To: trond.myklebust@netapp.com Cc: linux-nfs@vger.kernel.org, Chuck Lever , Bryan Schumaker Date: Sat, 16 Mar 2013 15:55:45 -0400 Message-ID: <20130316195545.27329.86881.stgit@seurat.1015granger.net> In-Reply-To: <20130316195044.27329.11666.stgit@seurat.1015granger.net> References: <20130316195044.27329.11666.stgit@seurat.1015granger.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org The long lines with no vertical white space make this function difficult for humans to read. Add a proper documenting comment while we're here. Signed-off-by: Chuck Lever Cc: Bryan Schumaker --- fs/nfs/nfs4proc.c | 32 ++++++++++++++++++++++---------- 1 files changed, 22 insertions(+), 10 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index c05e78b..addcdaf 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2484,24 +2484,36 @@ static int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle, return status; } -/* - * get the file handle for the "/" directory on the server +static int nfs4_do_find_root_sec(struct nfs_server *server, + struct nfs_fh *fhandle, struct nfs_fsinfo *info) +{ + int mv = server->nfs_client->cl_minorversion; + return nfs_v4_minor_ops[mv]->find_root_sec(server, fhandle, info); +} + +/** + * nfs4_proc_get_rootfh - get file handle for server's pseudoroot + * @server: initialized nfs_server handle + * @fhandle: we fill in the pseudo-fs root file handle + * @info: we fill in an FSINFO struct + * + * Returns zero on success, or a negative errno. */ int nfs4_proc_get_rootfh(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *info) { - int minor_version = server->nfs_client->cl_minorversion; - int status = nfs4_lookup_root(server, fhandle, info); - if ((status == -NFS4ERR_WRONGSEC) && !(server->flags & NFS_MOUNT_SECFLAVOUR)) - /* - * A status of -NFS4ERR_WRONGSEC will be mapped to -EPERM - * by nfs4_map_errors() as this function exits. - */ - status = nfs_v4_minor_ops[minor_version]->find_root_sec(server, fhandle, info); + int status; + + status = nfs4_lookup_root(server, fhandle, info); + if ((status == -NFS4ERR_WRONGSEC) && + !(server->flags & NFS_MOUNT_SECFLAVOUR)) + status = nfs4_do_find_root_sec(server, fhandle, info); + if (status == 0) status = nfs4_server_capabilities(server, fhandle); if (status == 0) status = nfs4_do_fsinfo(server, fhandle, info); + return nfs4_map_errors(status); }