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>
This commit is contained in:
parent
468f86134e
commit
fb8a5ba811
1 changed files with 23 additions and 5 deletions
|
@ -2186,9 +2186,14 @@ static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
|
||||||
struct nfs4_exception exception = { };
|
struct nfs4_exception exception = { };
|
||||||
int err;
|
int err;
|
||||||
do {
|
do {
|
||||||
err = nfs4_handle_exception(server,
|
err = _nfs4_lookup_root(server, fhandle, info);
|
||||||
_nfs4_lookup_root(server, fhandle, info),
|
switch (err) {
|
||||||
&exception);
|
case 0:
|
||||||
|
case -NFS4ERR_WRONGSEC:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
err = nfs4_handle_exception(server, err, &exception);
|
||||||
|
}
|
||||||
} while (exception.retry);
|
} while (exception.retry);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -2221,10 +2226,19 @@ static int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
|
||||||
|
|
||||||
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]);
|
||||||
if (status == -EPERM || status == -EACCES)
|
if (status == -NFS4ERR_WRONGSEC || status == -EACCES)
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* -EACCESS could mean that the user doesn't have correct permissions
|
||||||
|
* to access the mount. It could also mean that we tried to mount
|
||||||
|
* with a gss auth flavor, but rpc.gssd isn't running. Either way,
|
||||||
|
* existing mount programs don't handle -EACCES very well so it should
|
||||||
|
* be mapped to -EPERM instead.
|
||||||
|
*/
|
||||||
|
if (status == -EACCES)
|
||||||
|
status = -EPERM;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2235,7 +2249,11 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
|
||||||
struct nfs_fsinfo *info)
|
struct nfs_fsinfo *info)
|
||||||
{
|
{
|
||||||
int status = nfs4_lookup_root(server, fhandle, info);
|
int status = nfs4_lookup_root(server, fhandle, info);
|
||||||
if ((status == -EPERM) && !(server->flags & NFS_MOUNT_SECFLAVOUR))
|
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 = nfs4_find_root_sec(server, fhandle, info);
|
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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue