From patchwork Tue Apr 12 19:38:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Schumaker X-Patchwork-Id: 701721 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3CJnCrB007425 for ; Tue, 12 Apr 2011 19:49:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756864Ab1DLTtI (ORCPT ); Tue, 12 Apr 2011 15:49:08 -0400 Received: from mx1.netapp.com ([216.240.18.38]:17616 "EHLO mx1.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756803Ab1DLTtI (ORCPT ); Tue, 12 Apr 2011 15:49:08 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 12 Apr 2011 19:49:15 +0000 (UTC) X-Greylist: delayed 571 seconds by postgrey-1.27 at vger.kernel.org; Tue, 12 Apr 2011 15:49:08 EDT X-IronPort-AV: E=Sophos;i="4.64,198,1301900400"; d="scan'208";a="127808834" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx1-out.netapp.com with ESMTP; 12 Apr 2011 12:39:37 -0700 Received: from [10.30.28.138] (rtmiller1-lxp.hq.netapp.com [10.30.28.138] (may be forged)) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id p3CJcrKM024076; Tue, 12 Apr 2011 12:38:55 -0700 (PDT) Message-ID: <4DA4AA4D.2060702@netapp.com> Date: Tue, 12 Apr 2011 15:38:53 -0400 From: Bryan Schumaker User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Lightning/1.0b2 Lanikai/3.1.9 MIME-Version: 1.0 To: "Myklebust, Trond" CC: "linux-nfs@vger.kernel.org" Subject: [PATCH 1/2] NFS: Attempt AUTH_UNIX style mount before guessing authflavors Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org If an AUTH_UNIX mount returns -EPERM, we guess the authflavor needed to perform the mount. Signed-off-by: Bryan Schumaker --- fs/nfs/nfs4proc.c | 26 +++++++++++++++++--------- 1 files changed, 17 insertions(+), 9 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 8a03ee0..7e27ebf 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2208,19 +2208,15 @@ out: return ret; } -/* - * get the file handle for the "/" directory on the server - */ -static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, +static int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *info) { int i, len, status = 0; - rpc_authflavor_t flav_array[NFS_MAX_SECFLAVORS + 2]; + rpc_authflavor_t flav_array[NFS_MAX_SECFLAVORS]; - flav_array[0] = RPC_AUTH_UNIX; - len = gss_mech_list_pseudoflavors(&flav_array[1]); - flav_array[1+len] = RPC_AUTH_NULL; - len += 2; + len = gss_mech_list_pseudoflavors(&flav_array[0]); + flav_array[len] = RPC_AUTH_NULL; + len += 1; for (i = 0; i < len; i++) { status = nfs4_lookup_root_sec(server, fhandle, info, flav_array[i]); @@ -2228,6 +2224,18 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, continue; break; } + return status; +} + +/* + * get the file handle for the "/" directory on the server + */ +static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, + struct nfs_fsinfo *info) +{ + int status = nfs4_lookup_root(server, fhandle, info); + if (status == -EPERM) + status = nfs4_find_root_sec(server, fhandle, info); if (status == 0) status = nfs4_server_capabilities(server, fhandle); if (status == 0)