aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2011-04-13 14:31:30 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-04-13 15:12:23 -0400
commit801a16dc7b5c146f7980a0c61c30cef3ba93344d (patch)
tree959e354fe7e13525efa8e4313176550dbcc3fe99 /fs
parent0fabee243a2c6edd66284a4d8948ccbe6727e3bb (diff)
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: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4proc.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 8833472c09a9..7e27ebf5be5d 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2208,19 +2208,15 @@ out:
2208 return ret; 2208 return ret;
2209} 2209}
2210 2210
2211/* 2211static int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
2212 * get the file handle for the "/" directory on the server
2213 */
2214static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
2215 struct nfs_fsinfo *info) 2212 struct nfs_fsinfo *info)
2216{ 2213{
2217 int i, len, status = 0; 2214 int i, len, status = 0;
2218 rpc_authflavor_t flav_array[NFS_MAX_SECFLAVORS]; 2215 rpc_authflavor_t flav_array[NFS_MAX_SECFLAVORS];
2219 2216
2220 flav_array[0] = RPC_AUTH_UNIX; 2217 len = gss_mech_list_pseudoflavors(&flav_array[0]);
2221 len = gss_mech_list_pseudoflavors(&flav_array[1]); 2218 flav_array[len] = RPC_AUTH_NULL;
2222 flav_array[1+len] = RPC_AUTH_NULL; 2219 len += 1;
2223 len += 2;
2224 2220
2225 for (i = 0; i < len; i++) { 2221 for (i = 0; i < len; i++) {
2226 status = nfs4_lookup_root_sec(server, fhandle, info, flav_array[i]); 2222 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 continue; 2224 continue;
2229 break; 2225 break;
2230 } 2226 }
2227 return status;
2228}
2229
2230/*
2231 * get the file handle for the "/" directory on the server
2232 */
2233static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
2234 struct nfs_fsinfo *info)
2235{
2236 int status = nfs4_lookup_root(server, fhandle, info);
2237 if (status == -EPERM)
2238 status = nfs4_find_root_sec(server, fhandle, info);
2231 if (status == 0) 2239 if (status == 0)
2232 status = nfs4_server_capabilities(server, fhandle); 2240 status = nfs4_server_capabilities(server, fhandle);
2233 if (status == 0) 2241 if (status == 0)