]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
NFS: "[no]resvport" mount option changes mountd client too
authorChuck Lever <chuck.lever@oracle.com>
Tue, 23 Dec 2008 20:21:37 +0000 (15:21 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 23 Dec 2008 20:21:37 +0000 (15:21 -0500)
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: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/internal.h
fs/nfs/mount_clnt.c
fs/nfs/super.c

index 4e983961346ed576b1e906f8f1b128260c17a4c2..340ede8f608fe3402952890e7d82f26c004cbb65 100644 (file)
@@ -72,6 +72,7 @@ struct nfs_mount_request {
        u32                     version;
        unsigned short          protocol;
        struct nfs_fh           *fh;
+       int                     noresvport;
 };
 
 extern int nfs_mount(struct nfs_mount_request *info);
index 7e37113d37e350546ed68b87349ff7378ca38558..ca905a5bb1ba7457270953e18e06cd2b3b7596de 100644 (file)
@@ -50,7 +50,6 @@ int nfs_mount(struct nfs_mount_request *info)
                .program        = &mnt_program,
                .version        = info->version,
                .authflavor     = RPC_AUTH_UNIX,
-               .flags          = 0,
        };
        struct rpc_clnt         *mnt_clnt;
        int                     status;
@@ -59,6 +58,9 @@ int nfs_mount(struct nfs_mount_request *info)
                (info->hostname ? info->hostname : "server"),
                        info->dirpath);
 
+       if (info->noresvport)
+               args.flags |= RPC_CLNT_CREATE_NONPRIVPORT;
+
        mnt_clnt = rpc_create(&args);
        if (IS_ERR(mnt_clnt))
                goto out_clnt_err;
index e05a77be306850a484212e39aeda4b24daebbc87..d8e062fe76b110a5cc66c8f0098e427e483c49f7 100644 (file)
@@ -1345,6 +1345,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
                .dirpath        = args->nfs_server.export_path,
                .protocol       = args->mount_server.protocol,
                .fh             = root_fh,
+               .noresvport     = args->flags & NFS_MOUNT_NORESVPORT,
        };
        int status;