Commit 50a737f8 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

NFS: "[no]resvport" mount option changes mountd client too

If the admin has specified the "noresvport" option for an NFS mount
point, the kernel's NFS client uses an unprivileged source port for
the main NFS transport.  The kernel's mountd client should use an
unprivileged port in this case as well.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent d740351b
...@@ -72,6 +72,7 @@ struct nfs_mount_request { ...@@ -72,6 +72,7 @@ struct nfs_mount_request {
u32 version; u32 version;
unsigned short protocol; unsigned short protocol;
struct nfs_fh *fh; struct nfs_fh *fh;
int noresvport;
}; };
extern int nfs_mount(struct nfs_mount_request *info); extern int nfs_mount(struct nfs_mount_request *info);
......
...@@ -50,7 +50,6 @@ int nfs_mount(struct nfs_mount_request *info) ...@@ -50,7 +50,6 @@ int nfs_mount(struct nfs_mount_request *info)
.program = &mnt_program, .program = &mnt_program,
.version = info->version, .version = info->version,
.authflavor = RPC_AUTH_UNIX, .authflavor = RPC_AUTH_UNIX,
.flags = 0,
}; };
struct rpc_clnt *mnt_clnt; struct rpc_clnt *mnt_clnt;
int status; int status;
...@@ -59,6 +58,9 @@ int nfs_mount(struct nfs_mount_request *info) ...@@ -59,6 +58,9 @@ int nfs_mount(struct nfs_mount_request *info)
(info->hostname ? info->hostname : "server"), (info->hostname ? info->hostname : "server"),
info->dirpath); info->dirpath);
if (info->noresvport)
args.flags |= RPC_CLNT_CREATE_NONPRIVPORT;
mnt_clnt = rpc_create(&args); mnt_clnt = rpc_create(&args);
if (IS_ERR(mnt_clnt)) if (IS_ERR(mnt_clnt))
goto out_clnt_err; goto out_clnt_err;
......
...@@ -1345,6 +1345,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args, ...@@ -1345,6 +1345,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
.dirpath = args->nfs_server.export_path, .dirpath = args->nfs_server.export_path,
.protocol = args->mount_server.protocol, .protocol = args->mount_server.protocol,
.fh = root_fh, .fh = root_fh,
.noresvport = args->flags & NFS_MOUNT_NORESVPORT,
}; };
int status; int status;
......
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