summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-imx/NFS-allow-nfs-root-mount-to-use-alternate-rpc-ports.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-imx/NFS-allow-nfs-root-mount-to-use-alternate-rpc-ports.patch')
-rw-r--r--recipes-kernel/linux/linux-imx/NFS-allow-nfs-root-mount-to-use-alternate-rpc-ports.patch241
1 files changed, 241 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-imx/NFS-allow-nfs-root-mount-to-use-alternate-rpc-ports.patch b/recipes-kernel/linux/linux-imx/NFS-allow-nfs-root-mount-to-use-alternate-rpc-ports.patch
new file mode 100644
index 0000000..7597fa1
--- /dev/null
+++ b/recipes-kernel/linux/linux-imx/NFS-allow-nfs-root-mount-to-use-alternate-rpc-ports.patch
@@ -0,0 +1,241 @@
1From e85103e27b7591337d3240cf0ab2670d0ab73d52 Mon Sep 17 00:00:00 2001
2From: Jason Wessel <jason.wessel@windriver.com>
3Date: Wed, 7 Jan 2009 00:59:33 -0500
4Subject: [PATCH] NFS: allow nfs root mount to use alternate rpc ports
5
6Allow an nfs root mount to use alternate RPC ports for mountd and nfsd.
7
8Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
9[forward port to 2.6.33+]
10Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
11---
12 fs/nfs/client.c | 10 ++++++++++
13 fs/nfs/internal.h | 4 +++-
14 fs/nfs/mount_clnt.c | 3 ++-
15 fs/nfs/super.c | 33 ++++++++++++++++++++++++++++++++-
16 include/linux/nfs_fs_sb.h | 1 +
17 include/linux/nfs_mount.h | 4 +++-
18 6 files changed, 51 insertions(+), 4 deletions(-)
19
20diff --git a/fs/nfs/client.c b/fs/nfs/client.c
21index d25b525..b706c02 100644
22--- a/fs/nfs/client.c
23+++ b/fs/nfs/client.c
24@@ -105,6 +105,7 @@ struct nfs_client_initdata {
25 const struct nfs_rpc_ops *rpc_ops;
26 int proto;
27 u32 minorversion;
28+ int nfs_prog;
29 };
30
31 /*
32@@ -123,6 +124,7 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_
33 goto error_0;
34
35 clp->rpc_ops = cl_init->rpc_ops;
36+ clp->nfs_prog = cl_init->nfs_prog;
37
38 atomic_set(&clp->cl_count, 1);
39 clp->cl_cons_state = NFS_CS_INITING;
40@@ -448,6 +450,9 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
41 /* Match nfsv4 minorversion */
42 if (clp->cl_minorversion != data->minorversion)
43 continue;
44+ if (clp->nfs_prog != data->nfs_prog)
45+ continue;
46+
47 /* Match the full socket address */
48 if (!nfs_sockaddr_cmp(sap, clap))
49 continue;
50@@ -618,6 +623,10 @@ static int nfs_create_rpc_client(struct nfs_client *clp,
51 if (!IS_ERR(clp->cl_rpcclient))
52 return 0;
53
54+ if (clp->nfs_prog)
55+ nfs_program.number = clp->nfs_prog;
56+ else
57+ nfs_program.number = NFS_PROGRAM;
58 clnt = rpc_create(&args);
59 if (IS_ERR(clnt)) {
60 dprintk("%s: cannot create RPC client. Error = %ld\n",
61@@ -786,6 +795,7 @@ static int nfs_init_server(struct nfs_server *server,
62 .addrlen = data->nfs_server.addrlen,
63 .rpc_ops = &nfs_v2_clientops,
64 .proto = data->nfs_server.protocol,
65+ .nfs_prog = data->nfs_prog,
66 };
67 struct rpc_timeout timeparms;
68 struct nfs_client *clp;
69diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
70index e70f44b..3e2649f 100644
71--- a/fs/nfs/internal.h
72+++ b/fs/nfs/internal.h
73@@ -71,6 +71,8 @@ struct nfs_parsed_mount_data {
74 int timeo, retrans;
75 int acregmin, acregmax,
76 acdirmin, acdirmax;
77+ int nfs_prog;
78+ int mount_prog;
79 int namlen;
80 unsigned int options;
81 unsigned int bsize;
82@@ -116,7 +118,7 @@ struct nfs_mount_request {
83 rpc_authflavor_t *auth_flavs;
84 };
85
86-extern int nfs_mount(struct nfs_mount_request *info);
87+extern int nfs_mount(struct nfs_mount_request *info, int prog);
88 extern void nfs_umount(const struct nfs_mount_request *info);
89
90 /* client.c */
91diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
92index 59047f8..0a2bd63 100644
93--- a/fs/nfs/mount_clnt.c
94+++ b/fs/nfs/mount_clnt.c
95@@ -141,7 +141,7 @@ struct mnt_fhstatus {
96 *
97 * Uses default timeout parameters specified by underlying transport.
98 */
99-int nfs_mount(struct nfs_mount_request *info)
100+int nfs_mount(struct nfs_mount_request *info, int m_prog)
101 {
102 struct mountres result = {
103 .fh = info->fh,
104@@ -171,6 +171,7 @@ int nfs_mount(struct nfs_mount_request *info)
105 if (info->noresvport)
106 args.flags |= RPC_CLNT_CREATE_NONPRIVPORT;
107
108+ mnt_program.number = m_prog;
109 mnt_clnt = rpc_create(&args);
110 if (IS_ERR(mnt_clnt))
111 goto out_clnt_err;
112diff --git a/fs/nfs/super.c b/fs/nfs/super.c
113index f9df16d..0b3bbf8 100644
114--- a/fs/nfs/super.c
115+++ b/fs/nfs/super.c
116@@ -94,6 +94,8 @@ enum {
117 Opt_mountvers,
118 Opt_nfsvers,
119 Opt_minorversion,
120+ Opt_mountprog,
121+ Opt_nfsprog,
122
123 /* Mount options that take string arguments */
124 Opt_sec, Opt_proto, Opt_mountproto, Opt_mounthost,
125@@ -160,6 +162,8 @@ static const match_table_t nfs_mount_option_tokens = {
126 { Opt_nfsvers, "nfsvers=%s" },
127 { Opt_nfsvers, "vers=%s" },
128 { Opt_minorversion, "minorversion=%s" },
129+ { Opt_mountprog, "mountprog=%s" },
130+ { Opt_nfsprog, "nfsprog=%s" },
131
132 { Opt_sec, "sec=%s" },
133 { Opt_proto, "proto=%s" },
134@@ -787,6 +791,8 @@ static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(unsigned int ve
135 data->acregmax = NFS_DEF_ACREGMAX;
136 data->acdirmin = NFS_DEF_ACDIRMIN;
137 data->acdirmax = NFS_DEF_ACDIRMAX;
138+ data->nfs_prog = NFS_PROGRAM;
139+ data->mount_prog = NFS_MNT_PROGRAM;
140 data->mount_server.port = NFS_UNSPEC_PORT;
141 data->nfs_server.port = NFS_UNSPEC_PORT;
142 data->nfs_server.protocol = XPRT_TRANSPORT_TCP;
143@@ -1168,6 +1174,26 @@ static int nfs_parse_mount_options(char *raw,
144 goto out_invalid_value;
145 mnt->acdirmax = option;
146 break;
147+ case Opt_mountprog:
148+ string = match_strdup(args);
149+ if (string == NULL)
150+ goto out_nomem;
151+ rc = strict_strtoul(string, 10, &option);
152+ kfree(string);
153+ if (rc != 0)
154+ goto out_invalid_value;
155+ mnt->mount_prog = option;
156+ break;
157+ case Opt_nfsprog:
158+ string = match_strdup(args);
159+ if (string == NULL)
160+ goto out_nomem;
161+ rc = strict_strtoul(string, 10, &option);
162+ kfree(string);
163+ if (rc != 0)
164+ goto out_invalid_value;
165+ mnt->nfs_prog = option;
166+ break;
167 case Opt_actimeo:
168 string = match_strdup(args);
169 if (string == NULL)
170@@ -1566,7 +1592,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
171 * Now ask the mount server to map our export path
172 * to a file handle.
173 */
174- status = nfs_mount(&request);
175+ status = nfs_mount(&request,args->mount_prog);
176 if (status != 0) {
177 dfprintk(MOUNT, "NFS: unable to mount server %s, error %d\n",
178 request.hostname, status);
179@@ -1739,6 +1765,7 @@ static int nfs_validate_mount_data(void *options,
180 {
181 struct nfs_mount_data *data = (struct nfs_mount_data *)options;
182 struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address;
183+ args->nfs_prog = NFS_PROGRAM;
184
185 if (data == NULL)
186 goto out_no_data;
187@@ -1758,6 +1785,8 @@ static int nfs_validate_mount_data(void *options,
188 goto out_no_sec;
189 case 5:
190 memset(data->context, 0, sizeof(data->context));
191+ case 7:
192+ args->nfs_prog = (data->version >= 7) ? data->nfs_prog : NFS_PROGRAM;
193 case 6:
194 if (data->flags & NFS_MOUNT_VER3) {
195 if (data->root.size > NFS3_FHSIZE || data->root.size == 0)
196@@ -2476,6 +2505,8 @@ static int nfs4_validate_mount_data(void *options,
197 if (data == NULL)
198 goto out_no_data;
199
200+ args->nfs_prog = NFS_PROGRAM;
201+
202 switch (data->version) {
203 case 1:
204 if (data->host_addrlen > sizeof(args->nfs_server.address))
205diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
206index d6e10a4..585cba4 100644
207--- a/include/linux/nfs_fs_sb.h
208+++ b/include/linux/nfs_fs_sb.h
209@@ -41,6 +41,7 @@ struct nfs_client {
210
211 u32 cl_minorversion;/* NFSv4 minorversion */
212 struct rpc_cred *cl_machine_cred;
213+ int nfs_prog;
214
215 #ifdef CONFIG_NFS_V4
216 u64 cl_clientid; /* constant */
217diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h
218index 4499016..86beb0c 100644
219--- a/include/linux/nfs_mount.h
220+++ b/include/linux/nfs_mount.h
221@@ -20,7 +20,7 @@
222 * mount-to-kernel version compatibility. Some of these aren't used yet
223 * but here they are anyway.
224 */
225-#define NFS_MOUNT_VERSION 6
226+#define NFS_MOUNT_VERSION 7
227 #define NFS_MAX_CONTEXT_LEN 256
228
229 struct nfs_mount_data {
230@@ -43,6 +43,8 @@ struct nfs_mount_data {
231 struct nfs3_fh root; /* 4 */
232 int pseudoflavor; /* 5 */
233 char context[NFS_MAX_CONTEXT_LEN + 1]; /* 6 */
234+ int nfs_prog; /* 7 */
235+ int mount_prog; /* 7 */
236 };
237
238 /* bits in the flags field visible to user space */
239--
2401.7.9.1
241