From patchwork Wed Feb 6 23:30:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 2108931 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 27100DF2A1 for ; Wed, 6 Feb 2013 23:30:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757952Ab3BFXaS (ORCPT ); Wed, 6 Feb 2013 18:30:18 -0500 Received: from mail-ie0-f177.google.com ([209.85.223.177]:36338 "EHLO mail-ie0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757907Ab3BFXaR (ORCPT ); Wed, 6 Feb 2013 18:30:17 -0500 Received: by mail-ie0-f177.google.com with SMTP id 16so2626405iea.8 for ; Wed, 06 Feb 2013 15:30:17 -0800 (PST) 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=jnsc/wYJiJkJWHxWiWklHWAR+TkiGeKjnnpdhU9Ciso=; b=EAHkdKHXkFNYC5KSXfbh02t7re18+femLoQmFuovT1TJR1+3Fa0Gmc/WU/OD8OPFgx 4jPURtsmluxpDFBJlkrdQuWZ4knhjf+2n8UCO5vZnND9Ii/VBDv8qUtnI7kd4iIYPJ5l JO680u3XPwuW+2KhnozfLsC+Zru6eTo3Rp/A2+Ey5AmrSrFVkE4hlxp848cxPO7kW97h cUpJAoxJfXmvW7qAciXPaepq0mY73H23u0lBbJLfk9m6HQy/2u9oTYHYvpfJRbVa/NmJ ti6/QSEUcDkeEf5Ha5v3S/zQEu9I5ux3uui0n/j8tcZt+vSzC+h9D1cip+3ODBqE4vHx MAxQ== X-Received: by 10.43.62.12 with SMTP id wy12mr32275906icb.19.1360193416944; Wed, 06 Feb 2013 15:30:16 -0800 (PST) Received: from seurat.1015granger.net (adsl-99-26-161-222.dsl.sfldmi.sbcglobal.net. [99.26.161.222]) by mx.google.com with ESMTPS id kf2sm6097668igc.0.2013.02.06.15.30.15 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 06 Feb 2013 15:30:16 -0800 (PST) From: Chuck Lever Subject: [PATCH v1 2/4] NFS: Clean up nfs4_proc_get_rootfh To: linux-nfs@vger.kernel.org Cc: Chuck Lever , Bryan Schumaker Date: Wed, 06 Feb 2013 18:30:15 -0500 Message-ID: <20130206233015.1535.8265.stgit@seurat.1015granger.net> In-Reply-To: <20130206230045.1535.48770.stgit@seurat.1015granger.net> References: <20130206230045.1535.48770.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 debeb2d..ad86cfa 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2449,24 +2449,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); }