Commit 801a16dc authored by Bryan Schumaker's avatar Bryan Schumaker Committed by Trond Myklebust

NFS: Attempt mount with default sec flavor first

nfs4_lookup_root() is already configured to use either RPC_AUTH_UNIX
or a user specified flavor (through -o sec=<whatever>).  We should
use this flavor first, and only attempt negotiation if it fails
with -EPERM.
Signed-off-by: default avatarBryan Schumaker <bjschuma@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 0fabee24
...@@ -2208,19 +2208,15 @@ static int nfs4_lookup_root_sec(struct nfs_server *server, struct nfs_fh *fhandl ...@@ -2208,19 +2208,15 @@ static int nfs4_lookup_root_sec(struct nfs_server *server, struct nfs_fh *fhandl
return ret; return ret;
} }
/* static int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
* 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) struct nfs_fsinfo *info)
{ {
int i, len, status = 0; int i, len, status = 0;
rpc_authflavor_t flav_array[NFS_MAX_SECFLAVORS]; rpc_authflavor_t flav_array[NFS_MAX_SECFLAVORS];
flav_array[0] = RPC_AUTH_UNIX; len = gss_mech_list_pseudoflavors(&flav_array[0]);
len = gss_mech_list_pseudoflavors(&flav_array[1]); flav_array[len] = RPC_AUTH_NULL;
flav_array[1+len] = RPC_AUTH_NULL; len += 1;
len += 2;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
status = nfs4_lookup_root_sec(server, fhandle, info, flav_array[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, ...@@ -2228,6 +2224,18 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
continue; continue;
break; 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) if (status == 0)
status = nfs4_server_capabilities(server, fhandle); status = nfs4_server_capabilities(server, fhandle);
if (status == 0) if (status == 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment