aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2011-04-18 16:52:25 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-04-18 17:06:00 -0400
commitfb8a5ba8114491467c4067ec0330e1c3dcc81d10 (patch)
tree32372368a12658c367daab20202266b4fd27dd8d /fs/nfs/nfs4proc.c
parent468f86134ee515234afe5c5b3f39f266c50e61a5 (diff)
NFSv4: Handle NFS4ERR_WRONGSEC outside of nfs4_handle_exception()
I only want to try other secflavors during an initial mount if NFS4ERR_WRONGSEC is returned. nfs4_handle_exception() could potentially map other errors to EPERM, so we should handle this error specially for correctness. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index e7e2077eebd9..628e35f75307 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2186,9 +2186,14 @@ static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
2186 struct nfs4_exception exception = { }; 2186 struct nfs4_exception exception = { };
2187 int err; 2187 int err;
2188 do { 2188 do {
2189 err = nfs4_handle_exception(server, 2189 err = _nfs4_lookup_root(server, fhandle, info);
2190 _nfs4_lookup_root(server, fhandle, info), 2190 switch (err) {
2191 &exception); 2191 case 0:
2192 case -NFS4ERR_WRONGSEC:
2193 break;
2194 default:
2195 err = nfs4_handle_exception(server, err, &exception);
2196 }
2192 } while (exception.retry); 2197 } while (exception.retry);
2193 return err; 2198 return err;
2194} 2199}
@@ -2221,10 +2226,19 @@ static int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
2221 2226
2222 for (i = 0; i < len; i++) { 2227 for (i = 0; i < len; i++) {
2223 status = nfs4_lookup_root_sec(server, fhandle, info, flav_array[i]); 2228 status = nfs4_lookup_root_sec(server, fhandle, info, flav_array[i]);
2224 if (status == -EPERM || status == -EACCES) 2229 if (status == -NFS4ERR_WRONGSEC || status == -EACCES)
2225 continue; 2230 continue;
2226 break; 2231 break;
2227 } 2232 }
2233 /*
2234 * -EACCESS could mean that the user doesn't have correct permissions
2235 * to access the mount. It could also mean that we tried to mount
2236 * with a gss auth flavor, but rpc.gssd isn't running. Either way,
2237 * existing mount programs don't handle -EACCES very well so it should
2238 * be mapped to -EPERM instead.
2239 */
2240 if (status == -EACCES)
2241 status = -EPERM;
2228 return status; 2242 return status;
2229} 2243}
2230 2244
@@ -2235,7 +2249,11 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
2235 struct nfs_fsinfo *info) 2249 struct nfs_fsinfo *info)
2236{ 2250{
2237 int status = nfs4_lookup_root(server, fhandle, info); 2251 int status = nfs4_lookup_root(server, fhandle, info);
2238 if ((status == -EPERM) && !(server->flags & NFS_MOUNT_SECFLAVOUR)) 2252 if ((status == -NFS4ERR_WRONGSEC) && !(server->flags & NFS_MOUNT_SECFLAVOUR))
2253 /*
2254 * A status of -NFS4ERR_WRONGSEC will be mapped to -EPERM
2255 * by nfs4_map_errors() as this function exits.
2256 */
2239 status = nfs4_find_root_sec(server, fhandle, info); 2257 status = nfs4_find_root_sec(server, fhandle, info);
2240 if (status == 0) 2258 if (status == 0)
2241 status = nfs4_server_capabilities(server, fhandle); 2259 status = nfs4_server_capabilities(server, fhandle);