diff options
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/callback.h | 10 | ||||
-rw-r--r-- | fs/nfs/callback_proc.c | 6 | ||||
-rw-r--r-- | fs/nfs/callback_xdr.c | 106 | ||||
-rw-r--r-- | fs/nfs/client.c | 29 | ||||
-rw-r--r-- | fs/nfs/dir.c | 47 | ||||
-rw-r--r-- | fs/nfs/direct.c | 45 | ||||
-rw-r--r-- | fs/nfs/file.c | 42 | ||||
-rw-r--r-- | fs/nfs/getroot.c | 2 | ||||
-rw-r--r-- | fs/nfs/idmap.c | 2 | ||||
-rw-r--r-- | fs/nfs/inode.c | 44 | ||||
-rw-r--r-- | fs/nfs/internal.h | 24 | ||||
-rw-r--r-- | fs/nfs/mount_clnt.c | 6 | ||||
-rw-r--r-- | fs/nfs/namespace.c | 8 | ||||
-rw-r--r-- | fs/nfs/nfs2xdr.c | 78 | ||||
-rw-r--r-- | fs/nfs/nfs3proc.c | 56 | ||||
-rw-r--r-- | fs/nfs/nfs3xdr.c | 118 | ||||
-rw-r--r-- | fs/nfs/nfs4_fs.h | 4 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 115 | ||||
-rw-r--r-- | fs/nfs/nfs4renewd.c | 5 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 360 | ||||
-rw-r--r-- | fs/nfs/nfsroot.c | 13 | ||||
-rw-r--r-- | fs/nfs/pagelist.c | 71 | ||||
-rw-r--r-- | fs/nfs/proc.c | 33 | ||||
-rw-r--r-- | fs/nfs/read.c | 183 | ||||
-rw-r--r-- | fs/nfs/super.c | 2 | ||||
-rw-r--r-- | fs/nfs/symlink.c | 2 | ||||
-rw-r--r-- | fs/nfs/sysctl.c | 5 | ||||
-rw-r--r-- | fs/nfs/write.c | 616 |
28 files changed, 962 insertions, 1070 deletions
diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h index 5676163d26e8..db3d7919c601 100644 --- a/fs/nfs/callback.h +++ b/fs/nfs/callback.h | |||
@@ -31,10 +31,10 @@ struct cb_compound_hdr_arg { | |||
31 | }; | 31 | }; |
32 | 32 | ||
33 | struct cb_compound_hdr_res { | 33 | struct cb_compound_hdr_res { |
34 | uint32_t *status; | 34 | __be32 *status; |
35 | int taglen; | 35 | int taglen; |
36 | const char *tag; | 36 | const char *tag; |
37 | uint32_t *nops; | 37 | __be32 *nops; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | struct cb_getattrargs { | 40 | struct cb_getattrargs { |
@@ -44,7 +44,7 @@ struct cb_getattrargs { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | struct cb_getattrres { | 46 | struct cb_getattrres { |
47 | uint32_t status; | 47 | __be32 status; |
48 | uint32_t bitmap[2]; | 48 | uint32_t bitmap[2]; |
49 | uint64_t size; | 49 | uint64_t size; |
50 | uint64_t change_attr; | 50 | uint64_t change_attr; |
@@ -59,8 +59,8 @@ struct cb_recallargs { | |||
59 | uint32_t truncate; | 59 | uint32_t truncate; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | extern unsigned nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res); | 62 | extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res); |
63 | extern unsigned nfs4_callback_recall(struct cb_recallargs *args, void *dummy); | 63 | extern __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy); |
64 | 64 | ||
65 | #ifdef CONFIG_NFS_V4 | 65 | #ifdef CONFIG_NFS_V4 |
66 | extern int nfs_callback_up(void); | 66 | extern int nfs_callback_up(void); |
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 97cf8f71451f..72e55d83756d 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c | |||
@@ -14,7 +14,7 @@ | |||
14 | 14 | ||
15 | #define NFSDBG_FACILITY NFSDBG_CALLBACK | 15 | #define NFSDBG_FACILITY NFSDBG_CALLBACK |
16 | 16 | ||
17 | unsigned nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res) | 17 | __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res) |
18 | { | 18 | { |
19 | struct nfs_client *clp; | 19 | struct nfs_client *clp; |
20 | struct nfs_delegation *delegation; | 20 | struct nfs_delegation *delegation; |
@@ -55,11 +55,11 @@ out: | |||
55 | return res->status; | 55 | return res->status; |
56 | } | 56 | } |
57 | 57 | ||
58 | unsigned nfs4_callback_recall(struct cb_recallargs *args, void *dummy) | 58 | __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy) |
59 | { | 59 | { |
60 | struct nfs_client *clp; | 60 | struct nfs_client *clp; |
61 | struct inode *inode; | 61 | struct inode *inode; |
62 | unsigned res; | 62 | __be32 res; |
63 | 63 | ||
64 | res = htonl(NFS4ERR_BADHANDLE); | 64 | res = htonl(NFS4ERR_BADHANDLE); |
65 | clp = nfs_find_client(args->addr, 4); | 65 | clp = nfs_find_client(args->addr, 4); |
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index 29f932192054..f8ea1f51f590 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c | |||
@@ -22,9 +22,9 @@ | |||
22 | 22 | ||
23 | #define NFSDBG_FACILITY NFSDBG_CALLBACK | 23 | #define NFSDBG_FACILITY NFSDBG_CALLBACK |
24 | 24 | ||
25 | typedef unsigned (*callback_process_op_t)(void *, void *); | 25 | typedef __be32 (*callback_process_op_t)(void *, void *); |
26 | typedef unsigned (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *); | 26 | typedef __be32 (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *); |
27 | typedef unsigned (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *); | 27 | typedef __be32 (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *); |
28 | 28 | ||
29 | 29 | ||
30 | struct callback_op { | 30 | struct callback_op { |
@@ -36,24 +36,24 @@ struct callback_op { | |||
36 | 36 | ||
37 | static struct callback_op callback_ops[]; | 37 | static struct callback_op callback_ops[]; |
38 | 38 | ||
39 | static int nfs4_callback_null(struct svc_rqst *rqstp, void *argp, void *resp) | 39 | static __be32 nfs4_callback_null(struct svc_rqst *rqstp, void *argp, void *resp) |
40 | { | 40 | { |
41 | return htonl(NFS4_OK); | 41 | return htonl(NFS4_OK); |
42 | } | 42 | } |
43 | 43 | ||
44 | static int nfs4_decode_void(struct svc_rqst *rqstp, uint32_t *p, void *dummy) | 44 | static int nfs4_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) |
45 | { | 45 | { |
46 | return xdr_argsize_check(rqstp, p); | 46 | return xdr_argsize_check(rqstp, p); |
47 | } | 47 | } |
48 | 48 | ||
49 | static int nfs4_encode_void(struct svc_rqst *rqstp, uint32_t *p, void *dummy) | 49 | static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) |
50 | { | 50 | { |
51 | return xdr_ressize_check(rqstp, p); | 51 | return xdr_ressize_check(rqstp, p); |
52 | } | 52 | } |
53 | 53 | ||
54 | static uint32_t *read_buf(struct xdr_stream *xdr, int nbytes) | 54 | static __be32 *read_buf(struct xdr_stream *xdr, int nbytes) |
55 | { | 55 | { |
56 | uint32_t *p; | 56 | __be32 *p; |
57 | 57 | ||
58 | p = xdr_inline_decode(xdr, nbytes); | 58 | p = xdr_inline_decode(xdr, nbytes); |
59 | if (unlikely(p == NULL)) | 59 | if (unlikely(p == NULL)) |
@@ -61,9 +61,9 @@ static uint32_t *read_buf(struct xdr_stream *xdr, int nbytes) | |||
61 | return p; | 61 | return p; |
62 | } | 62 | } |
63 | 63 | ||
64 | static unsigned decode_string(struct xdr_stream *xdr, unsigned int *len, const char **str) | 64 | static __be32 decode_string(struct xdr_stream *xdr, unsigned int *len, const char **str) |
65 | { | 65 | { |
66 | uint32_t *p; | 66 | __be32 *p; |
67 | 67 | ||
68 | p = read_buf(xdr, 4); | 68 | p = read_buf(xdr, 4); |
69 | if (unlikely(p == NULL)) | 69 | if (unlikely(p == NULL)) |
@@ -81,9 +81,9 @@ static unsigned decode_string(struct xdr_stream *xdr, unsigned int *len, const c | |||
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
83 | 83 | ||
84 | static unsigned decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh) | 84 | static __be32 decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh) |
85 | { | 85 | { |
86 | uint32_t *p; | 86 | __be32 *p; |
87 | 87 | ||
88 | p = read_buf(xdr, 4); | 88 | p = read_buf(xdr, 4); |
89 | if (unlikely(p == NULL)) | 89 | if (unlikely(p == NULL)) |
@@ -99,9 +99,9 @@ static unsigned decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh) | |||
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | 101 | ||
102 | static unsigned decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) | 102 | static __be32 decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) |
103 | { | 103 | { |
104 | uint32_t *p; | 104 | __be32 *p; |
105 | unsigned int attrlen; | 105 | unsigned int attrlen; |
106 | 106 | ||
107 | p = read_buf(xdr, 4); | 107 | p = read_buf(xdr, 4); |
@@ -118,9 +118,9 @@ static unsigned decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) | |||
118 | return 0; | 118 | return 0; |
119 | } | 119 | } |
120 | 120 | ||
121 | static unsigned decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid) | 121 | static __be32 decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid) |
122 | { | 122 | { |
123 | uint32_t *p; | 123 | __be32 *p; |
124 | 124 | ||
125 | p = read_buf(xdr, 16); | 125 | p = read_buf(xdr, 16); |
126 | if (unlikely(p == NULL)) | 126 | if (unlikely(p == NULL)) |
@@ -129,11 +129,11 @@ static unsigned decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid) | |||
129 | return 0; | 129 | return 0; |
130 | } | 130 | } |
131 | 131 | ||
132 | static unsigned decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr) | 132 | static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr) |
133 | { | 133 | { |
134 | uint32_t *p; | 134 | __be32 *p; |
135 | unsigned int minor_version; | 135 | unsigned int minor_version; |
136 | unsigned status; | 136 | __be32 status; |
137 | 137 | ||
138 | status = decode_string(xdr, &hdr->taglen, &hdr->tag); | 138 | status = decode_string(xdr, &hdr->taglen, &hdr->tag); |
139 | if (unlikely(status != 0)) | 139 | if (unlikely(status != 0)) |
@@ -159,9 +159,9 @@ static unsigned decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compou | |||
159 | return 0; | 159 | return 0; |
160 | } | 160 | } |
161 | 161 | ||
162 | static unsigned decode_op_hdr(struct xdr_stream *xdr, unsigned int *op) | 162 | static __be32 decode_op_hdr(struct xdr_stream *xdr, unsigned int *op) |
163 | { | 163 | { |
164 | uint32_t *p; | 164 | __be32 *p; |
165 | p = read_buf(xdr, 4); | 165 | p = read_buf(xdr, 4); |
166 | if (unlikely(p == NULL)) | 166 | if (unlikely(p == NULL)) |
167 | return htonl(NFS4ERR_RESOURCE); | 167 | return htonl(NFS4ERR_RESOURCE); |
@@ -169,9 +169,9 @@ static unsigned decode_op_hdr(struct xdr_stream *xdr, unsigned int *op) | |||
169 | return 0; | 169 | return 0; |
170 | } | 170 | } |
171 | 171 | ||
172 | static unsigned decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args) | 172 | static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args) |
173 | { | 173 | { |
174 | unsigned status; | 174 | __be32 status; |
175 | 175 | ||
176 | status = decode_fh(xdr, &args->fh); | 176 | status = decode_fh(xdr, &args->fh); |
177 | if (unlikely(status != 0)) | 177 | if (unlikely(status != 0)) |
@@ -183,10 +183,10 @@ out: | |||
183 | return status; | 183 | return status; |
184 | } | 184 | } |
185 | 185 | ||
186 | static unsigned decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args) | 186 | static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args) |
187 | { | 187 | { |
188 | uint32_t *p; | 188 | __be32 *p; |
189 | unsigned status; | 189 | __be32 status; |
190 | 190 | ||
191 | args->addr = &rqstp->rq_addr; | 191 | args->addr = &rqstp->rq_addr; |
192 | status = decode_stateid(xdr, &args->stateid); | 192 | status = decode_stateid(xdr, &args->stateid); |
@@ -204,9 +204,9 @@ out: | |||
204 | return status; | 204 | return status; |
205 | } | 205 | } |
206 | 206 | ||
207 | static unsigned encode_string(struct xdr_stream *xdr, unsigned int len, const char *str) | 207 | static __be32 encode_string(struct xdr_stream *xdr, unsigned int len, const char *str) |
208 | { | 208 | { |
209 | uint32_t *p; | 209 | __be32 *p; |
210 | 210 | ||
211 | p = xdr_reserve_space(xdr, 4 + len); | 211 | p = xdr_reserve_space(xdr, 4 + len); |
212 | if (unlikely(p == NULL)) | 212 | if (unlikely(p == NULL)) |
@@ -217,10 +217,10 @@ static unsigned encode_string(struct xdr_stream *xdr, unsigned int len, const ch | |||
217 | 217 | ||
218 | #define CB_SUPPORTED_ATTR0 (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE) | 218 | #define CB_SUPPORTED_ATTR0 (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE) |
219 | #define CB_SUPPORTED_ATTR1 (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY) | 219 | #define CB_SUPPORTED_ATTR1 (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY) |
220 | static unsigned encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, uint32_t **savep) | 220 | static __be32 encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, __be32 **savep) |
221 | { | 221 | { |
222 | uint32_t bm[2]; | 222 | __be32 bm[2]; |
223 | uint32_t *p; | 223 | __be32 *p; |
224 | 224 | ||
225 | bm[0] = htonl(bitmap[0] & CB_SUPPORTED_ATTR0); | 225 | bm[0] = htonl(bitmap[0] & CB_SUPPORTED_ATTR0); |
226 | bm[1] = htonl(bitmap[1] & CB_SUPPORTED_ATTR1); | 226 | bm[1] = htonl(bitmap[1] & CB_SUPPORTED_ATTR1); |
@@ -247,9 +247,9 @@ static unsigned encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitma | |||
247 | return 0; | 247 | return 0; |
248 | } | 248 | } |
249 | 249 | ||
250 | static unsigned encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t change) | 250 | static __be32 encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t change) |
251 | { | 251 | { |
252 | uint32_t *p; | 252 | __be32 *p; |
253 | 253 | ||
254 | if (!(bitmap[0] & FATTR4_WORD0_CHANGE)) | 254 | if (!(bitmap[0] & FATTR4_WORD0_CHANGE)) |
255 | return 0; | 255 | return 0; |
@@ -260,9 +260,9 @@ static unsigned encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitma | |||
260 | return 0; | 260 | return 0; |
261 | } | 261 | } |
262 | 262 | ||
263 | static unsigned encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t size) | 263 | static __be32 encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t size) |
264 | { | 264 | { |
265 | uint32_t *p; | 265 | __be32 *p; |
266 | 266 | ||
267 | if (!(bitmap[0] & FATTR4_WORD0_SIZE)) | 267 | if (!(bitmap[0] & FATTR4_WORD0_SIZE)) |
268 | return 0; | 268 | return 0; |
@@ -273,9 +273,9 @@ static unsigned encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, | |||
273 | return 0; | 273 | return 0; |
274 | } | 274 | } |
275 | 275 | ||
276 | static unsigned encode_attr_time(struct xdr_stream *xdr, const struct timespec *time) | 276 | static __be32 encode_attr_time(struct xdr_stream *xdr, const struct timespec *time) |
277 | { | 277 | { |
278 | uint32_t *p; | 278 | __be32 *p; |
279 | 279 | ||
280 | p = xdr_reserve_space(xdr, 12); | 280 | p = xdr_reserve_space(xdr, 12); |
281 | if (unlikely(p == 0)) | 281 | if (unlikely(p == 0)) |
@@ -285,23 +285,23 @@ static unsigned encode_attr_time(struct xdr_stream *xdr, const struct timespec * | |||
285 | return 0; | 285 | return 0; |
286 | } | 286 | } |
287 | 287 | ||
288 | static unsigned encode_attr_ctime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) | 288 | static __be32 encode_attr_ctime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) |
289 | { | 289 | { |
290 | if (!(bitmap[1] & FATTR4_WORD1_TIME_METADATA)) | 290 | if (!(bitmap[1] & FATTR4_WORD1_TIME_METADATA)) |
291 | return 0; | 291 | return 0; |
292 | return encode_attr_time(xdr,time); | 292 | return encode_attr_time(xdr,time); |
293 | } | 293 | } |
294 | 294 | ||
295 | static unsigned encode_attr_mtime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) | 295 | static __be32 encode_attr_mtime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) |
296 | { | 296 | { |
297 | if (!(bitmap[1] & FATTR4_WORD1_TIME_MODIFY)) | 297 | if (!(bitmap[1] & FATTR4_WORD1_TIME_MODIFY)) |
298 | return 0; | 298 | return 0; |
299 | return encode_attr_time(xdr,time); | 299 | return encode_attr_time(xdr,time); |
300 | } | 300 | } |
301 | 301 | ||
302 | static unsigned encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound_hdr_res *hdr) | 302 | static __be32 encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound_hdr_res *hdr) |
303 | { | 303 | { |
304 | unsigned status; | 304 | __be32 status; |
305 | 305 | ||
306 | hdr->status = xdr_reserve_space(xdr, 4); | 306 | hdr->status = xdr_reserve_space(xdr, 4); |
307 | if (unlikely(hdr->status == NULL)) | 307 | if (unlikely(hdr->status == NULL)) |
@@ -315,9 +315,9 @@ static unsigned encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compou | |||
315 | return 0; | 315 | return 0; |
316 | } | 316 | } |
317 | 317 | ||
318 | static unsigned encode_op_hdr(struct xdr_stream *xdr, uint32_t op, uint32_t res) | 318 | static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res) |
319 | { | 319 | { |
320 | uint32_t *p; | 320 | __be32 *p; |
321 | 321 | ||
322 | p = xdr_reserve_space(xdr, 8); | 322 | p = xdr_reserve_space(xdr, 8); |
323 | if (unlikely(p == NULL)) | 323 | if (unlikely(p == NULL)) |
@@ -327,10 +327,10 @@ static unsigned encode_op_hdr(struct xdr_stream *xdr, uint32_t op, uint32_t res) | |||
327 | return 0; | 327 | return 0; |
328 | } | 328 | } |
329 | 329 | ||
330 | static unsigned encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res) | 330 | static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res) |
331 | { | 331 | { |
332 | uint32_t *savep = NULL; | 332 | __be32 *savep = NULL; |
333 | unsigned status = res->status; | 333 | __be32 status = res->status; |
334 | 334 | ||
335 | if (unlikely(status != 0)) | 335 | if (unlikely(status != 0)) |
336 | goto out; | 336 | goto out; |
@@ -353,15 +353,15 @@ out: | |||
353 | return status; | 353 | return status; |
354 | } | 354 | } |
355 | 355 | ||
356 | static unsigned process_op(struct svc_rqst *rqstp, | 356 | static __be32 process_op(struct svc_rqst *rqstp, |
357 | struct xdr_stream *xdr_in, void *argp, | 357 | struct xdr_stream *xdr_in, void *argp, |
358 | struct xdr_stream *xdr_out, void *resp) | 358 | struct xdr_stream *xdr_out, void *resp) |
359 | { | 359 | { |
360 | struct callback_op *op = &callback_ops[0]; | 360 | struct callback_op *op = &callback_ops[0]; |
361 | unsigned int op_nr = OP_CB_ILLEGAL; | 361 | unsigned int op_nr = OP_CB_ILLEGAL; |
362 | unsigned int status = 0; | 362 | __be32 status = 0; |
363 | long maxlen; | 363 | long maxlen; |
364 | unsigned res; | 364 | __be32 res; |
365 | 365 | ||
366 | dprintk("%s: start\n", __FUNCTION__); | 366 | dprintk("%s: start\n", __FUNCTION__); |
367 | status = decode_op_hdr(xdr_in, &op_nr); | 367 | status = decode_op_hdr(xdr_in, &op_nr); |
@@ -399,20 +399,20 @@ static unsigned process_op(struct svc_rqst *rqstp, | |||
399 | /* | 399 | /* |
400 | * Decode, process and encode a COMPOUND | 400 | * Decode, process and encode a COMPOUND |
401 | */ | 401 | */ |
402 | static int nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp) | 402 | static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp) |
403 | { | 403 | { |
404 | struct cb_compound_hdr_arg hdr_arg; | 404 | struct cb_compound_hdr_arg hdr_arg; |
405 | struct cb_compound_hdr_res hdr_res; | 405 | struct cb_compound_hdr_res hdr_res; |
406 | struct xdr_stream xdr_in, xdr_out; | 406 | struct xdr_stream xdr_in, xdr_out; |
407 | uint32_t *p; | 407 | __be32 *p; |
408 | unsigned int status; | 408 | __be32 status; |
409 | unsigned int nops = 1; | 409 | unsigned int nops = 1; |
410 | 410 | ||
411 | dprintk("%s: start\n", __FUNCTION__); | 411 | dprintk("%s: start\n", __FUNCTION__); |
412 | 412 | ||
413 | xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base); | 413 | xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base); |
414 | 414 | ||
415 | p = (uint32_t*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len); | 415 | p = (__be32*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len); |
416 | xdr_init_encode(&xdr_out, &rqstp->rq_res, p); | 416 | xdr_init_encode(&xdr_out, &rqstp->rq_res, p); |
417 | 417 | ||
418 | decode_compound_hdr_arg(&xdr_in, &hdr_arg); | 418 | decode_compound_hdr_arg(&xdr_in, &hdr_arg); |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 34c3996bd0f5..23ab145daa2d 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -143,7 +143,7 @@ static struct nfs_client *nfs_alloc_client(const char *hostname, | |||
143 | INIT_LIST_HEAD(&clp->cl_state_owners); | 143 | INIT_LIST_HEAD(&clp->cl_state_owners); |
144 | INIT_LIST_HEAD(&clp->cl_unused); | 144 | INIT_LIST_HEAD(&clp->cl_unused); |
145 | spin_lock_init(&clp->cl_lock); | 145 | spin_lock_init(&clp->cl_lock); |
146 | INIT_WORK(&clp->cl_renewd, nfs4_renew_state, clp); | 146 | INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state); |
147 | rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client"); | 147 | rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client"); |
148 | clp->cl_boot_time = CURRENT_TIME; | 148 | clp->cl_boot_time = CURRENT_TIME; |
149 | clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED; | 149 | clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED; |
@@ -232,11 +232,15 @@ void nfs_put_client(struct nfs_client *clp) | |||
232 | * Find a client by address | 232 | * Find a client by address |
233 | * - caller must hold nfs_client_lock | 233 | * - caller must hold nfs_client_lock |
234 | */ | 234 | */ |
235 | static struct nfs_client *__nfs_find_client(const struct sockaddr_in *addr, int nfsversion) | 235 | static struct nfs_client *__nfs_find_client(const struct sockaddr_in *addr, int nfsversion, int match_port) |
236 | { | 236 | { |
237 | struct nfs_client *clp; | 237 | struct nfs_client *clp; |
238 | 238 | ||
239 | list_for_each_entry(clp, &nfs_client_list, cl_share_link) { | 239 | list_for_each_entry(clp, &nfs_client_list, cl_share_link) { |
240 | /* Don't match clients that failed to initialise properly */ | ||
241 | if (clp->cl_cons_state < 0) | ||
242 | continue; | ||
243 | |||
240 | /* Different NFS versions cannot share the same nfs_client */ | 244 | /* Different NFS versions cannot share the same nfs_client */ |
241 | if (clp->cl_nfsversion != nfsversion) | 245 | if (clp->cl_nfsversion != nfsversion) |
242 | continue; | 246 | continue; |
@@ -245,7 +249,7 @@ static struct nfs_client *__nfs_find_client(const struct sockaddr_in *addr, int | |||
245 | sizeof(clp->cl_addr.sin_addr)) != 0) | 249 | sizeof(clp->cl_addr.sin_addr)) != 0) |
246 | continue; | 250 | continue; |
247 | 251 | ||
248 | if (clp->cl_addr.sin_port == addr->sin_port) | 252 | if (!match_port || clp->cl_addr.sin_port == addr->sin_port) |
249 | goto found; | 253 | goto found; |
250 | } | 254 | } |
251 | 255 | ||
@@ -265,11 +269,12 @@ struct nfs_client *nfs_find_client(const struct sockaddr_in *addr, int nfsversio | |||
265 | struct nfs_client *clp; | 269 | struct nfs_client *clp; |
266 | 270 | ||
267 | spin_lock(&nfs_client_lock); | 271 | spin_lock(&nfs_client_lock); |
268 | clp = __nfs_find_client(addr, nfsversion); | 272 | clp = __nfs_find_client(addr, nfsversion, 0); |
269 | spin_unlock(&nfs_client_lock); | 273 | spin_unlock(&nfs_client_lock); |
270 | 274 | if (clp != NULL && clp->cl_cons_state != NFS_CS_READY) { | |
271 | BUG_ON(clp && clp->cl_cons_state == 0); | 275 | nfs_put_client(clp); |
272 | 276 | clp = NULL; | |
277 | } | ||
273 | return clp; | 278 | return clp; |
274 | } | 279 | } |
275 | 280 | ||
@@ -292,7 +297,7 @@ static struct nfs_client *nfs_get_client(const char *hostname, | |||
292 | do { | 297 | do { |
293 | spin_lock(&nfs_client_lock); | 298 | spin_lock(&nfs_client_lock); |
294 | 299 | ||
295 | clp = __nfs_find_client(addr, nfsversion); | 300 | clp = __nfs_find_client(addr, nfsversion, 1); |
296 | if (clp) | 301 | if (clp) |
297 | goto found_client; | 302 | goto found_client; |
298 | if (new) | 303 | if (new) |
@@ -849,6 +854,7 @@ error: | |||
849 | */ | 854 | */ |
850 | static int nfs4_init_client(struct nfs_client *clp, | 855 | static int nfs4_init_client(struct nfs_client *clp, |
851 | int proto, int timeo, int retrans, | 856 | int proto, int timeo, int retrans, |
857 | const char *ip_addr, | ||
852 | rpc_authflavor_t authflavour) | 858 | rpc_authflavor_t authflavour) |
853 | { | 859 | { |
854 | int error; | 860 | int error; |
@@ -865,6 +871,7 @@ static int nfs4_init_client(struct nfs_client *clp, | |||
865 | error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour); | 871 | error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour); |
866 | if (error < 0) | 872 | if (error < 0) |
867 | goto error; | 873 | goto error; |
874 | memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr)); | ||
868 | 875 | ||
869 | error = nfs_idmap_new(clp); | 876 | error = nfs_idmap_new(clp); |
870 | if (error < 0) { | 877 | if (error < 0) { |
@@ -888,6 +895,7 @@ error: | |||
888 | */ | 895 | */ |
889 | static int nfs4_set_client(struct nfs_server *server, | 896 | static int nfs4_set_client(struct nfs_server *server, |
890 | const char *hostname, const struct sockaddr_in *addr, | 897 | const char *hostname, const struct sockaddr_in *addr, |
898 | const char *ip_addr, | ||
891 | rpc_authflavor_t authflavour, | 899 | rpc_authflavor_t authflavour, |
892 | int proto, int timeo, int retrans) | 900 | int proto, int timeo, int retrans) |
893 | { | 901 | { |
@@ -902,7 +910,7 @@ static int nfs4_set_client(struct nfs_server *server, | |||
902 | error = PTR_ERR(clp); | 910 | error = PTR_ERR(clp); |
903 | goto error; | 911 | goto error; |
904 | } | 912 | } |
905 | error = nfs4_init_client(clp, proto, timeo, retrans, authflavour); | 913 | error = nfs4_init_client(clp, proto, timeo, retrans, ip_addr, authflavour); |
906 | if (error < 0) | 914 | if (error < 0) |
907 | goto error_put; | 915 | goto error_put; |
908 | 916 | ||
@@ -971,7 +979,7 @@ struct nfs_server *nfs4_create_server(const struct nfs4_mount_data *data, | |||
971 | return ERR_PTR(-ENOMEM); | 979 | return ERR_PTR(-ENOMEM); |
972 | 980 | ||
973 | /* Get a client record */ | 981 | /* Get a client record */ |
974 | error = nfs4_set_client(server, hostname, addr, authflavour, | 982 | error = nfs4_set_client(server, hostname, addr, ip_addr, authflavour, |
975 | data->proto, data->timeo, data->retrans); | 983 | data->proto, data->timeo, data->retrans); |
976 | if (error < 0) | 984 | if (error < 0) |
977 | goto error; | 985 | goto error; |
@@ -1041,6 +1049,7 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data, | |||
1041 | /* Get a client representation. | 1049 | /* Get a client representation. |
1042 | * Note: NFSv4 always uses TCP, */ | 1050 | * Note: NFSv4 always uses TCP, */ |
1043 | error = nfs4_set_client(server, data->hostname, data->addr, | 1051 | error = nfs4_set_client(server, data->hostname, data->addr, |
1052 | parent_client->cl_ipaddr, | ||
1044 | data->authflavor, | 1053 | data->authflavor, |
1045 | parent_server->client->cl_xprt->prot, | 1054 | parent_server->client->cl_xprt->prot, |
1046 | parent_client->retrans_timeo, | 1055 | parent_client->retrans_timeo, |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 481f8892a919..dee3d6c0f194 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -142,12 +142,12 @@ nfs_opendir(struct inode *inode, struct file *filp) | |||
142 | return res; | 142 | return res; |
143 | } | 143 | } |
144 | 144 | ||
145 | typedef u32 * (*decode_dirent_t)(u32 *, struct nfs_entry *, int); | 145 | typedef __be32 * (*decode_dirent_t)(__be32 *, struct nfs_entry *, int); |
146 | typedef struct { | 146 | typedef struct { |
147 | struct file *file; | 147 | struct file *file; |
148 | struct page *page; | 148 | struct page *page; |
149 | unsigned long page_index; | 149 | unsigned long page_index; |
150 | u32 *ptr; | 150 | __be32 *ptr; |
151 | u64 *dir_cookie; | 151 | u64 *dir_cookie; |
152 | loff_t current_index; | 152 | loff_t current_index; |
153 | struct nfs_entry *entry; | 153 | struct nfs_entry *entry; |
@@ -172,7 +172,7 @@ static | |||
172 | int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page) | 172 | int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page) |
173 | { | 173 | { |
174 | struct file *file = desc->file; | 174 | struct file *file = desc->file; |
175 | struct inode *inode = file->f_dentry->d_inode; | 175 | struct inode *inode = file->f_path.dentry->d_inode; |
176 | struct rpc_cred *cred = nfs_file_cred(file); | 176 | struct rpc_cred *cred = nfs_file_cred(file); |
177 | unsigned long timestamp; | 177 | unsigned long timestamp; |
178 | int error; | 178 | int error; |
@@ -183,7 +183,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page) | |||
183 | 183 | ||
184 | again: | 184 | again: |
185 | timestamp = jiffies; | 185 | timestamp = jiffies; |
186 | error = NFS_PROTO(inode)->readdir(file->f_dentry, cred, desc->entry->cookie, page, | 186 | error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, desc->entry->cookie, page, |
187 | NFS_SERVER(inode)->dtsize, desc->plus); | 187 | NFS_SERVER(inode)->dtsize, desc->plus); |
188 | if (error < 0) { | 188 | if (error < 0) { |
189 | /* We requested READDIRPLUS, but the server doesn't grok it */ | 189 | /* We requested READDIRPLUS, but the server doesn't grok it */ |
@@ -203,8 +203,10 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page) | |||
203 | * Note: assumes we have exclusive access to this mapping either | 203 | * Note: assumes we have exclusive access to this mapping either |
204 | * through inode->i_mutex or some other mechanism. | 204 | * through inode->i_mutex or some other mechanism. |
205 | */ | 205 | */ |
206 | if (page->index == 0) | 206 | if (page->index == 0 && invalidate_inode_pages2_range(inode->i_mapping, PAGE_CACHE_SIZE, -1) < 0) { |
207 | invalidate_inode_pages2_range(inode->i_mapping, PAGE_CACHE_SIZE, -1); | 207 | /* Should never happen */ |
208 | nfs_zap_mapping(inode, inode->i_mapping); | ||
209 | } | ||
208 | unlock_page(page); | 210 | unlock_page(page); |
209 | return 0; | 211 | return 0; |
210 | error: | 212 | error: |
@@ -218,7 +220,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page) | |||
218 | static inline | 220 | static inline |
219 | int dir_decode(nfs_readdir_descriptor_t *desc) | 221 | int dir_decode(nfs_readdir_descriptor_t *desc) |
220 | { | 222 | { |
221 | u32 *p = desc->ptr; | 223 | __be32 *p = desc->ptr; |
222 | p = desc->decode(p, desc->entry, desc->plus); | 224 | p = desc->decode(p, desc->entry, desc->plus); |
223 | if (IS_ERR(p)) | 225 | if (IS_ERR(p)) |
224 | return PTR_ERR(p); | 226 | return PTR_ERR(p); |
@@ -306,7 +308,7 @@ int find_dirent_index(nfs_readdir_descriptor_t *desc) | |||
306 | static inline | 308 | static inline |
307 | int find_dirent_page(nfs_readdir_descriptor_t *desc) | 309 | int find_dirent_page(nfs_readdir_descriptor_t *desc) |
308 | { | 310 | { |
309 | struct inode *inode = desc->file->f_dentry->d_inode; | 311 | struct inode *inode = desc->file->f_path.dentry->d_inode; |
310 | struct page *page; | 312 | struct page *page; |
311 | int status; | 313 | int status; |
312 | 314 | ||
@@ -462,7 +464,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent, | |||
462 | filldir_t filldir) | 464 | filldir_t filldir) |
463 | { | 465 | { |
464 | struct file *file = desc->file; | 466 | struct file *file = desc->file; |
465 | struct inode *inode = file->f_dentry->d_inode; | 467 | struct inode *inode = file->f_path.dentry->d_inode; |
466 | struct rpc_cred *cred = nfs_file_cred(file); | 468 | struct rpc_cred *cred = nfs_file_cred(file); |
467 | struct page *page = NULL; | 469 | struct page *page = NULL; |
468 | int status; | 470 | int status; |
@@ -475,7 +477,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent, | |||
475 | status = -ENOMEM; | 477 | status = -ENOMEM; |
476 | goto out; | 478 | goto out; |
477 | } | 479 | } |
478 | desc->error = NFS_PROTO(inode)->readdir(file->f_dentry, cred, *desc->dir_cookie, | 480 | desc->error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, *desc->dir_cookie, |
479 | page, | 481 | page, |
480 | NFS_SERVER(inode)->dtsize, | 482 | NFS_SERVER(inode)->dtsize, |
481 | desc->plus); | 483 | desc->plus); |
@@ -514,7 +516,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent, | |||
514 | */ | 516 | */ |
515 | static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 517 | static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
516 | { | 518 | { |
517 | struct dentry *dentry = filp->f_dentry; | 519 | struct dentry *dentry = filp->f_path.dentry; |
518 | struct inode *inode = dentry->d_inode; | 520 | struct inode *inode = dentry->d_inode; |
519 | nfs_readdir_descriptor_t my_desc, | 521 | nfs_readdir_descriptor_t my_desc, |
520 | *desc = &my_desc; | 522 | *desc = &my_desc; |
@@ -597,7 +599,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
597 | 599 | ||
598 | loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) | 600 | loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) |
599 | { | 601 | { |
600 | mutex_lock(&filp->f_dentry->d_inode->i_mutex); | 602 | mutex_lock(&filp->f_path.dentry->d_inode->i_mutex); |
601 | switch (origin) { | 603 | switch (origin) { |
602 | case 1: | 604 | case 1: |
603 | offset += filp->f_pos; | 605 | offset += filp->f_pos; |
@@ -613,7 +615,7 @@ loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) | |||
613 | ((struct nfs_open_context *)filp->private_data)->dir_cookie = 0; | 615 | ((struct nfs_open_context *)filp->private_data)->dir_cookie = 0; |
614 | } | 616 | } |
615 | out: | 617 | out: |
616 | mutex_unlock(&filp->f_dentry->d_inode->i_mutex); | 618 | mutex_unlock(&filp->f_path.dentry->d_inode->i_mutex); |
617 | return offset; | 619 | return offset; |
618 | } | 620 | } |
619 | 621 | ||
@@ -933,8 +935,17 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru | |||
933 | 935 | ||
934 | no_entry: | 936 | no_entry: |
935 | res = d_materialise_unique(dentry, inode); | 937 | res = d_materialise_unique(dentry, inode); |
936 | if (res != NULL) | 938 | if (res != NULL) { |
939 | struct dentry *parent; | ||
940 | if (IS_ERR(res)) | ||
941 | goto out_unlock; | ||
942 | /* Was a directory renamed! */ | ||
943 | parent = dget_parent(res); | ||
944 | if (!IS_ROOT(parent)) | ||
945 | nfs_mark_for_revalidate(parent->d_inode); | ||
946 | dput(parent); | ||
937 | dentry = res; | 947 | dentry = res; |
948 | } | ||
938 | nfs_renew_times(dentry); | 949 | nfs_renew_times(dentry); |
939 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | 950 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); |
940 | out_unlock: | 951 | out_unlock: |
@@ -1091,7 +1102,7 @@ no_open: | |||
1091 | 1102 | ||
1092 | static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc) | 1103 | static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc) |
1093 | { | 1104 | { |
1094 | struct dentry *parent = desc->file->f_dentry; | 1105 | struct dentry *parent = desc->file->f_path.dentry; |
1095 | struct inode *dir = parent->d_inode; | 1106 | struct inode *dir = parent->d_inode; |
1096 | struct nfs_entry *entry = desc->entry; | 1107 | struct nfs_entry *entry = desc->entry; |
1097 | struct dentry *dentry, *alias; | 1108 | struct dentry *dentry, *alias; |
@@ -1130,6 +1141,8 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc) | |||
1130 | alias = d_materialise_unique(dentry, inode); | 1141 | alias = d_materialise_unique(dentry, inode); |
1131 | if (alias != NULL) { | 1142 | if (alias != NULL) { |
1132 | dput(dentry); | 1143 | dput(dentry); |
1144 | if (IS_ERR(alias)) | ||
1145 | return NULL; | ||
1133 | dentry = alias; | 1146 | dentry = alias; |
1134 | } | 1147 | } |
1135 | 1148 | ||
@@ -1517,8 +1530,8 @@ static int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *sym | |||
1517 | pagevec_init(&lru_pvec, 0); | 1530 | pagevec_init(&lru_pvec, 0); |
1518 | if (!add_to_page_cache(page, dentry->d_inode->i_mapping, 0, | 1531 | if (!add_to_page_cache(page, dentry->d_inode->i_mapping, 0, |
1519 | GFP_KERNEL)) { | 1532 | GFP_KERNEL)) { |
1520 | if (!pagevec_add(&lru_pvec, page)) | 1533 | pagevec_add(&lru_pvec, page); |
1521 | __pagevec_lru_add(&lru_pvec); | 1534 | pagevec_lru_add(&lru_pvec); |
1522 | SetPageUptodate(page); | 1535 | SetPageUptodate(page); |
1523 | unlock_page(page); | 1536 | unlock_page(page); |
1524 | } else | 1537 | } else |
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 9f7f8b9ea1e2..bd21d7fde650 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | #define NFSDBG_FACILITY NFSDBG_VFS | 59 | #define NFSDBG_FACILITY NFSDBG_VFS |
60 | 60 | ||
61 | static kmem_cache_t *nfs_direct_cachep; | 61 | static struct kmem_cache *nfs_direct_cachep; |
62 | 62 | ||
63 | /* | 63 | /* |
64 | * This represents a set of asynchronous requests that we're waiting on | 64 | * This represents a set of asynchronous requests that we're waiting on |
@@ -116,7 +116,7 @@ static inline int put_dreq(struct nfs_direct_req *dreq) | |||
116 | ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs) | 116 | ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs) |
117 | { | 117 | { |
118 | dprintk("NFS: nfs_direct_IO (%s) off/no(%Ld/%lu) EINVAL\n", | 118 | dprintk("NFS: nfs_direct_IO (%s) off/no(%Ld/%lu) EINVAL\n", |
119 | iocb->ki_filp->f_dentry->d_name.name, | 119 | iocb->ki_filp->f_path.dentry->d_name.name, |
120 | (long long) pos, nr_segs); | 120 | (long long) pos, nr_segs); |
121 | 121 | ||
122 | return -EINVAL; | 122 | return -EINVAL; |
@@ -143,7 +143,7 @@ static inline struct nfs_direct_req *nfs_direct_req_alloc(void) | |||
143 | { | 143 | { |
144 | struct nfs_direct_req *dreq; | 144 | struct nfs_direct_req *dreq; |
145 | 145 | ||
146 | dreq = kmem_cache_alloc(nfs_direct_cachep, SLAB_KERNEL); | 146 | dreq = kmem_cache_alloc(nfs_direct_cachep, GFP_KERNEL); |
147 | if (!dreq) | 147 | if (!dreq) |
148 | return NULL; | 148 | return NULL; |
149 | 149 | ||
@@ -307,9 +307,7 @@ static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned lo | |||
307 | 307 | ||
308 | data->task.tk_cookie = (unsigned long) inode; | 308 | data->task.tk_cookie = (unsigned long) inode; |
309 | 309 | ||
310 | lock_kernel(); | ||
311 | rpc_execute(&data->task); | 310 | rpc_execute(&data->task); |
312 | unlock_kernel(); | ||
313 | 311 | ||
314 | dfprintk(VFS, "NFS: %5u initiated direct read call (req %s/%Ld, %zu bytes @ offset %Lu)\n", | 312 | dfprintk(VFS, "NFS: %5u initiated direct read call (req %s/%Ld, %zu bytes @ offset %Lu)\n", |
315 | data->task.tk_pid, | 313 | data->task.tk_pid, |
@@ -475,9 +473,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq) | |||
475 | 473 | ||
476 | dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid); | 474 | dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid); |
477 | 475 | ||
478 | lock_kernel(); | ||
479 | rpc_execute(&data->task); | 476 | rpc_execute(&data->task); |
480 | unlock_kernel(); | ||
481 | } | 477 | } |
482 | 478 | ||
483 | static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode) | 479 | static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode) |
@@ -497,6 +493,7 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode | |||
497 | if (dreq->commit_data != NULL) | 493 | if (dreq->commit_data != NULL) |
498 | nfs_commit_free(dreq->commit_data); | 494 | nfs_commit_free(dreq->commit_data); |
499 | nfs_direct_free_writedata(dreq); | 495 | nfs_direct_free_writedata(dreq); |
496 | nfs_zap_mapping(inode, inode->i_mapping); | ||
500 | nfs_direct_complete(dreq); | 497 | nfs_direct_complete(dreq); |
501 | } | 498 | } |
502 | } | 499 | } |
@@ -517,6 +514,7 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode | |||
517 | { | 514 | { |
518 | nfs_end_data_update(inode); | 515 | nfs_end_data_update(inode); |
519 | nfs_direct_free_writedata(dreq); | 516 | nfs_direct_free_writedata(dreq); |
517 | nfs_zap_mapping(inode, inode->i_mapping); | ||
520 | nfs_direct_complete(dreq); | 518 | nfs_direct_complete(dreq); |
521 | } | 519 | } |
522 | #endif | 520 | #endif |
@@ -532,10 +530,12 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata) | |||
532 | 530 | ||
533 | spin_lock(&dreq->lock); | 531 | spin_lock(&dreq->lock); |
534 | 532 | ||
535 | if (likely(status >= 0)) | 533 | if (unlikely(status < 0)) { |
536 | dreq->count += data->res.count; | 534 | dreq->error = status; |
537 | else | 535 | goto out_unlock; |
538 | dreq->error = task->tk_status; | 536 | } |
537 | |||
538 | dreq->count += data->res.count; | ||
539 | 539 | ||
540 | if (data->res.verf->committed != NFS_FILE_SYNC) { | 540 | if (data->res.verf->committed != NFS_FILE_SYNC) { |
541 | switch (dreq->flags) { | 541 | switch (dreq->flags) { |
@@ -550,7 +550,7 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata) | |||
550 | } | 550 | } |
551 | } | 551 | } |
552 | } | 552 | } |
553 | 553 | out_unlock: | |
554 | spin_unlock(&dreq->lock); | 554 | spin_unlock(&dreq->lock); |
555 | } | 555 | } |
556 | 556 | ||
@@ -637,9 +637,7 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l | |||
637 | data->task.tk_priority = RPC_PRIORITY_NORMAL; | 637 | data->task.tk_priority = RPC_PRIORITY_NORMAL; |
638 | data->task.tk_cookie = (unsigned long) inode; | 638 | data->task.tk_cookie = (unsigned long) inode; |
639 | 639 | ||
640 | lock_kernel(); | ||
641 | rpc_execute(&data->task); | 640 | rpc_execute(&data->task); |
642 | unlock_kernel(); | ||
643 | 641 | ||
644 | dfprintk(VFS, "NFS: %5u initiated direct write call (req %s/%Ld, %zu bytes @ offset %Lu)\n", | 642 | dfprintk(VFS, "NFS: %5u initiated direct write call (req %s/%Ld, %zu bytes @ offset %Lu)\n", |
645 | data->task.tk_pid, | 643 | data->task.tk_pid, |
@@ -736,8 +734,8 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov, | |||
736 | size_t count = iov[0].iov_len; | 734 | size_t count = iov[0].iov_len; |
737 | 735 | ||
738 | dprintk("nfs: direct read(%s/%s, %lu@%Ld)\n", | 736 | dprintk("nfs: direct read(%s/%s, %lu@%Ld)\n", |
739 | file->f_dentry->d_parent->d_name.name, | 737 | file->f_path.dentry->d_parent->d_name.name, |
740 | file->f_dentry->d_name.name, | 738 | file->f_path.dentry->d_name.name, |
741 | (unsigned long) count, (long long) pos); | 739 | (unsigned long) count, (long long) pos); |
742 | 740 | ||
743 | if (nr_segs != 1) | 741 | if (nr_segs != 1) |
@@ -800,8 +798,8 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov, | |||
800 | size_t count = iov[0].iov_len; | 798 | size_t count = iov[0].iov_len; |
801 | 799 | ||
802 | dfprintk(VFS, "nfs: direct write(%s/%s, %lu@%Ld)\n", | 800 | dfprintk(VFS, "nfs: direct write(%s/%s, %lu@%Ld)\n", |
803 | file->f_dentry->d_parent->d_name.name, | 801 | file->f_path.dentry->d_parent->d_name.name, |
804 | file->f_dentry->d_name.name, | 802 | file->f_path.dentry->d_name.name, |
805 | (unsigned long) count, (long long) pos); | 803 | (unsigned long) count, (long long) pos); |
806 | 804 | ||
807 | if (nr_segs != 1) | 805 | if (nr_segs != 1) |
@@ -828,17 +826,6 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov, | |||
828 | 826 | ||
829 | retval = nfs_direct_write(iocb, (unsigned long) buf, count, pos); | 827 | retval = nfs_direct_write(iocb, (unsigned long) buf, count, pos); |
830 | 828 | ||
831 | /* | ||
832 | * XXX: nfs_end_data_update() already ensures this file's | ||
833 | * cached data is subsequently invalidated. Do we really | ||
834 | * need to call invalidate_inode_pages2() again here? | ||
835 | * | ||
836 | * For aio writes, this invalidation will almost certainly | ||
837 | * occur before the writes complete. Kind of racey. | ||
838 | */ | ||
839 | if (mapping->nrpages) | ||
840 | invalidate_inode_pages2(mapping); | ||
841 | |||
842 | if (retval > 0) | 829 | if (retval > 0) |
843 | iocb->ki_pos = pos + retval; | 830 | iocb->ki_pos = pos + retval; |
844 | 831 | ||
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index cc93865cea93..0dd6be346aa7 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -176,7 +176,7 @@ static int | |||
176 | nfs_file_flush(struct file *file, fl_owner_t id) | 176 | nfs_file_flush(struct file *file, fl_owner_t id) |
177 | { | 177 | { |
178 | struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; | 178 | struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; |
179 | struct inode *inode = file->f_dentry->d_inode; | 179 | struct inode *inode = file->f_path.dentry->d_inode; |
180 | int status; | 180 | int status; |
181 | 181 | ||
182 | dfprintk(VFS, "nfs: flush(%s/%ld)\n", inode->i_sb->s_id, inode->i_ino); | 182 | dfprintk(VFS, "nfs: flush(%s/%ld)\n", inode->i_sb->s_id, inode->i_ino); |
@@ -201,7 +201,7 @@ static ssize_t | |||
201 | nfs_file_read(struct kiocb *iocb, const struct iovec *iov, | 201 | nfs_file_read(struct kiocb *iocb, const struct iovec *iov, |
202 | unsigned long nr_segs, loff_t pos) | 202 | unsigned long nr_segs, loff_t pos) |
203 | { | 203 | { |
204 | struct dentry * dentry = iocb->ki_filp->f_dentry; | 204 | struct dentry * dentry = iocb->ki_filp->f_path.dentry; |
205 | struct inode * inode = dentry->d_inode; | 205 | struct inode * inode = dentry->d_inode; |
206 | ssize_t result; | 206 | ssize_t result; |
207 | size_t count = iov_length(iov, nr_segs); | 207 | size_t count = iov_length(iov, nr_segs); |
@@ -226,7 +226,7 @@ static ssize_t | |||
226 | nfs_file_sendfile(struct file *filp, loff_t *ppos, size_t count, | 226 | nfs_file_sendfile(struct file *filp, loff_t *ppos, size_t count, |
227 | read_actor_t actor, void *target) | 227 | read_actor_t actor, void *target) |
228 | { | 228 | { |
229 | struct dentry *dentry = filp->f_dentry; | 229 | struct dentry *dentry = filp->f_path.dentry; |
230 | struct inode *inode = dentry->d_inode; | 230 | struct inode *inode = dentry->d_inode; |
231 | ssize_t res; | 231 | ssize_t res; |
232 | 232 | ||
@@ -243,7 +243,7 @@ nfs_file_sendfile(struct file *filp, loff_t *ppos, size_t count, | |||
243 | static int | 243 | static int |
244 | nfs_file_mmap(struct file * file, struct vm_area_struct * vma) | 244 | nfs_file_mmap(struct file * file, struct vm_area_struct * vma) |
245 | { | 245 | { |
246 | struct dentry *dentry = file->f_dentry; | 246 | struct dentry *dentry = file->f_path.dentry; |
247 | struct inode *inode = dentry->d_inode; | 247 | struct inode *inode = dentry->d_inode; |
248 | int status; | 248 | int status; |
249 | 249 | ||
@@ -307,28 +307,28 @@ static int nfs_commit_write(struct file *file, struct page *page, unsigned offse | |||
307 | 307 | ||
308 | static void nfs_invalidate_page(struct page *page, unsigned long offset) | 308 | static void nfs_invalidate_page(struct page *page, unsigned long offset) |
309 | { | 309 | { |
310 | struct inode *inode = page->mapping->host; | 310 | if (offset != 0) |
311 | 311 | return; | |
312 | /* Cancel any unstarted writes on this page */ | 312 | /* Cancel any unstarted writes on this page */ |
313 | if (offset == 0) | 313 | nfs_wb_page_priority(page->mapping->host, page, FLUSH_INVALIDATE); |
314 | nfs_sync_inode_wait(inode, page->index, 1, FLUSH_INVALIDATE); | ||
315 | } | 314 | } |
316 | 315 | ||
317 | static int nfs_release_page(struct page *page, gfp_t gfp) | 316 | static int nfs_release_page(struct page *page, gfp_t gfp) |
318 | { | 317 | { |
319 | if (gfp & __GFP_FS) | 318 | /* |
320 | return !nfs_wb_page(page->mapping->host, page); | 319 | * Avoid deadlock on nfs_wait_on_request(). |
321 | else | 320 | */ |
322 | /* | 321 | if (!(gfp & __GFP_FS)) |
323 | * Avoid deadlock on nfs_wait_on_request(). | ||
324 | */ | ||
325 | return 0; | 322 | return 0; |
323 | /* Hack... Force nfs_wb_page() to write out the page */ | ||
324 | SetPageDirty(page); | ||
325 | return !nfs_wb_page(page->mapping->host, page); | ||
326 | } | 326 | } |
327 | 327 | ||
328 | const struct address_space_operations nfs_file_aops = { | 328 | const struct address_space_operations nfs_file_aops = { |
329 | .readpage = nfs_readpage, | 329 | .readpage = nfs_readpage, |
330 | .readpages = nfs_readpages, | 330 | .readpages = nfs_readpages, |
331 | .set_page_dirty = __set_page_dirty_nobuffers, | 331 | .set_page_dirty = nfs_set_page_dirty, |
332 | .writepage = nfs_writepage, | 332 | .writepage = nfs_writepage, |
333 | .writepages = nfs_writepages, | 333 | .writepages = nfs_writepages, |
334 | .prepare_write = nfs_prepare_write, | 334 | .prepare_write = nfs_prepare_write, |
@@ -343,7 +343,7 @@ const struct address_space_operations nfs_file_aops = { | |||
343 | static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov, | 343 | static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov, |
344 | unsigned long nr_segs, loff_t pos) | 344 | unsigned long nr_segs, loff_t pos) |
345 | { | 345 | { |
346 | struct dentry * dentry = iocb->ki_filp->f_dentry; | 346 | struct dentry * dentry = iocb->ki_filp->f_path.dentry; |
347 | struct inode * inode = dentry->d_inode; | 347 | struct inode * inode = dentry->d_inode; |
348 | ssize_t result; | 348 | ssize_t result; |
349 | size_t count = iov_length(iov, nr_segs); | 349 | size_t count = iov_length(iov, nr_segs); |
@@ -375,6 +375,12 @@ static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov, | |||
375 | 375 | ||
376 | nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, count); | 376 | nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, count); |
377 | result = generic_file_aio_write(iocb, iov, nr_segs, pos); | 377 | result = generic_file_aio_write(iocb, iov, nr_segs, pos); |
378 | /* Return error values for O_SYNC and IS_SYNC() */ | ||
379 | if (result >= 0 && (IS_SYNC(inode) || (iocb->ki_filp->f_flags & O_SYNC))) { | ||
380 | int err = nfs_fsync(iocb->ki_filp, dentry, 1); | ||
381 | if (err < 0) | ||
382 | result = err; | ||
383 | } | ||
378 | out: | 384 | out: |
379 | return result; | 385 | return result; |
380 | 386 | ||
@@ -529,8 +535,8 @@ static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl) | |||
529 | static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl) | 535 | static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl) |
530 | { | 536 | { |
531 | dprintk("NFS: nfs_flock(f=%s/%ld, t=%x, fl=%x)\n", | 537 | dprintk("NFS: nfs_flock(f=%s/%ld, t=%x, fl=%x)\n", |
532 | filp->f_dentry->d_inode->i_sb->s_id, | 538 | filp->f_path.dentry->d_inode->i_sb->s_id, |
533 | filp->f_dentry->d_inode->i_ino, | 539 | filp->f_path.dentry->d_inode->i_ino, |
534 | fl->fl_type, fl->fl_flags); | 540 | fl->fl_type, fl->fl_flags); |
535 | 541 | ||
536 | /* | 542 | /* |
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index 20c6f39ea38a..8391bd7a83ce 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/nfs_idmap.h> | 31 | #include <linux/nfs_idmap.h> |
32 | #include <linux/vfs.h> | 32 | #include <linux/vfs.h> |
33 | #include <linux/namei.h> | 33 | #include <linux/namei.h> |
34 | #include <linux/namespace.h> | 34 | #include <linux/mnt_namespace.h> |
35 | #include <linux/security.h> | 35 | #include <linux/security.h> |
36 | 36 | ||
37 | #include <asm/system.h> | 37 | #include <asm/system.h> |
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index 82ad7110a1c0..9d4a6b2d1996 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
@@ -377,7 +377,7 @@ idmap_pipe_upcall(struct file *filp, struct rpc_pipe_msg *msg, | |||
377 | static ssize_t | 377 | static ssize_t |
378 | idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | 378 | idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) |
379 | { | 379 | { |
380 | struct rpc_inode *rpci = RPC_I(filp->f_dentry->d_inode); | 380 | struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode); |
381 | struct idmap *idmap = (struct idmap *)rpci->private; | 381 | struct idmap *idmap = (struct idmap *)rpci->private; |
382 | struct idmap_msg im_in, *im = &idmap->idmap_im; | 382 | struct idmap_msg im_in, *im = &idmap->idmap_im; |
383 | struct idmap_hashtable *h; | 383 | struct idmap_hashtable *h; |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index bc9376ca86cd..63e470279309 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -55,7 +55,7 @@ static int nfs_update_inode(struct inode *, struct nfs_fattr *); | |||
55 | 55 | ||
56 | static void nfs_zap_acl_cache(struct inode *); | 56 | static void nfs_zap_acl_cache(struct inode *); |
57 | 57 | ||
58 | static kmem_cache_t * nfs_inode_cachep; | 58 | static struct kmem_cache * nfs_inode_cachep; |
59 | 59 | ||
60 | static inline unsigned long | 60 | static inline unsigned long |
61 | nfs_fattr_to_ino_t(struct nfs_fattr *fattr) | 61 | nfs_fattr_to_ino_t(struct nfs_fattr *fattr) |
@@ -131,6 +131,15 @@ void nfs_zap_caches(struct inode *inode) | |||
131 | spin_unlock(&inode->i_lock); | 131 | spin_unlock(&inode->i_lock); |
132 | } | 132 | } |
133 | 133 | ||
134 | void nfs_zap_mapping(struct inode *inode, struct address_space *mapping) | ||
135 | { | ||
136 | if (mapping->nrpages != 0) { | ||
137 | spin_lock(&inode->i_lock); | ||
138 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA; | ||
139 | spin_unlock(&inode->i_lock); | ||
140 | } | ||
141 | } | ||
142 | |||
134 | static void nfs_zap_acl_cache(struct inode *inode) | 143 | static void nfs_zap_acl_cache(struct inode *inode) |
135 | { | 144 | { |
136 | void (*clear_acl_cache)(struct inode *); | 145 | void (*clear_acl_cache)(struct inode *); |
@@ -413,7 +422,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | |||
413 | int err; | 422 | int err; |
414 | 423 | ||
415 | /* Flush out writes to the server in order to update c/mtime */ | 424 | /* Flush out writes to the server in order to update c/mtime */ |
416 | nfs_sync_inode_wait(inode, 0, 0, FLUSH_NOCOMMIT); | 425 | nfs_sync_mapping_range(inode->i_mapping, 0, 0, FLUSH_NOCOMMIT); |
417 | 426 | ||
418 | /* | 427 | /* |
419 | * We may force a getattr if the user cares about atime. | 428 | * We may force a getattr if the user cares about atime. |
@@ -487,7 +496,7 @@ void put_nfs_open_context(struct nfs_open_context *ctx) | |||
487 | */ | 496 | */ |
488 | static void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx) | 497 | static void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx) |
489 | { | 498 | { |
490 | struct inode *inode = filp->f_dentry->d_inode; | 499 | struct inode *inode = filp->f_path.dentry->d_inode; |
491 | struct nfs_inode *nfsi = NFS_I(inode); | 500 | struct nfs_inode *nfsi = NFS_I(inode); |
492 | 501 | ||
493 | filp->private_data = get_nfs_open_context(ctx); | 502 | filp->private_data = get_nfs_open_context(ctx); |
@@ -519,7 +528,7 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_c | |||
519 | 528 | ||
520 | static void nfs_file_clear_open_context(struct file *filp) | 529 | static void nfs_file_clear_open_context(struct file *filp) |
521 | { | 530 | { |
522 | struct inode *inode = filp->f_dentry->d_inode; | 531 | struct inode *inode = filp->f_path.dentry->d_inode; |
523 | struct nfs_open_context *ctx = (struct nfs_open_context *)filp->private_data; | 532 | struct nfs_open_context *ctx = (struct nfs_open_context *)filp->private_data; |
524 | 533 | ||
525 | if (ctx) { | 534 | if (ctx) { |
@@ -542,7 +551,7 @@ int nfs_open(struct inode *inode, struct file *filp) | |||
542 | cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0); | 551 | cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0); |
543 | if (IS_ERR(cred)) | 552 | if (IS_ERR(cred)) |
544 | return PTR_ERR(cred); | 553 | return PTR_ERR(cred); |
545 | ctx = alloc_nfs_open_context(filp->f_vfsmnt, filp->f_dentry, cred); | 554 | ctx = alloc_nfs_open_context(filp->f_path.mnt, filp->f_path.dentry, cred); |
546 | put_rpccred(cred); | 555 | put_rpccred(cred); |
547 | if (ctx == NULL) | 556 | if (ctx == NULL) |
548 | return -ENOMEM; | 557 | return -ENOMEM; |
@@ -574,7 +583,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) | |||
574 | 583 | ||
575 | nfs_inc_stats(inode, NFSIOS_INODEREVALIDATE); | 584 | nfs_inc_stats(inode, NFSIOS_INODEREVALIDATE); |
576 | lock_kernel(); | 585 | lock_kernel(); |
577 | if (!inode || is_bad_inode(inode)) | 586 | if (is_bad_inode(inode)) |
578 | goto out_nowait; | 587 | goto out_nowait; |
579 | if (NFS_STALE(inode)) | 588 | if (NFS_STALE(inode)) |
580 | goto out_nowait; | 589 | goto out_nowait; |
@@ -671,13 +680,20 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | |||
671 | if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) | 680 | if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) |
672 | || nfs_attribute_timeout(inode)) | 681 | || nfs_attribute_timeout(inode)) |
673 | ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode); | 682 | ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode); |
683 | if (ret < 0) | ||
684 | goto out; | ||
674 | 685 | ||
675 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { | 686 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { |
676 | nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); | 687 | if (mapping->nrpages != 0) { |
677 | if (S_ISREG(inode->i_mode)) | 688 | if (S_ISREG(inode->i_mode)) { |
678 | nfs_sync_mapping(mapping); | 689 | ret = nfs_sync_mapping(mapping); |
679 | invalidate_inode_pages2(mapping); | 690 | if (ret < 0) |
680 | 691 | goto out; | |
692 | } | ||
693 | ret = invalidate_inode_pages2(mapping); | ||
694 | if (ret < 0) | ||
695 | goto out; | ||
696 | } | ||
681 | spin_lock(&inode->i_lock); | 697 | spin_lock(&inode->i_lock); |
682 | nfsi->cache_validity &= ~NFS_INO_INVALID_DATA; | 698 | nfsi->cache_validity &= ~NFS_INO_INVALID_DATA; |
683 | if (S_ISDIR(inode->i_mode)) { | 699 | if (S_ISDIR(inode->i_mode)) { |
@@ -687,10 +703,12 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | |||
687 | } | 703 | } |
688 | spin_unlock(&inode->i_lock); | 704 | spin_unlock(&inode->i_lock); |
689 | 705 | ||
706 | nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); | ||
690 | dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n", | 707 | dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n", |
691 | inode->i_sb->s_id, | 708 | inode->i_sb->s_id, |
692 | (long long)NFS_FILEID(inode)); | 709 | (long long)NFS_FILEID(inode)); |
693 | } | 710 | } |
711 | out: | ||
694 | return ret; | 712 | return ret; |
695 | } | 713 | } |
696 | 714 | ||
@@ -1062,7 +1080,7 @@ void nfs4_clear_inode(struct inode *inode) | |||
1062 | struct inode *nfs_alloc_inode(struct super_block *sb) | 1080 | struct inode *nfs_alloc_inode(struct super_block *sb) |
1063 | { | 1081 | { |
1064 | struct nfs_inode *nfsi; | 1082 | struct nfs_inode *nfsi; |
1065 | nfsi = (struct nfs_inode *)kmem_cache_alloc(nfs_inode_cachep, SLAB_KERNEL); | 1083 | nfsi = (struct nfs_inode *)kmem_cache_alloc(nfs_inode_cachep, GFP_KERNEL); |
1066 | if (!nfsi) | 1084 | if (!nfsi) |
1067 | return NULL; | 1085 | return NULL; |
1068 | nfsi->flags = 0UL; | 1086 | nfsi->flags = 0UL; |
@@ -1093,7 +1111,7 @@ static inline void nfs4_init_once(struct nfs_inode *nfsi) | |||
1093 | #endif | 1111 | #endif |
1094 | } | 1112 | } |
1095 | 1113 | ||
1096 | static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) | 1114 | static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) |
1097 | { | 1115 | { |
1098 | struct nfs_inode *nfsi = (struct nfs_inode *) foo; | 1116 | struct nfs_inode *nfsi = (struct nfs_inode *) foo; |
1099 | 1117 | ||
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index bea0b016bd70..a28f6ce2e131 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -93,15 +93,15 @@ extern void nfs_destroy_directcache(void); | |||
93 | /* nfs2xdr.c */ | 93 | /* nfs2xdr.c */ |
94 | extern int nfs_stat_to_errno(int); | 94 | extern int nfs_stat_to_errno(int); |
95 | extern struct rpc_procinfo nfs_procedures[]; | 95 | extern struct rpc_procinfo nfs_procedures[]; |
96 | extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int); | 96 | extern __be32 * nfs_decode_dirent(__be32 *, struct nfs_entry *, int); |
97 | 97 | ||
98 | /* nfs3xdr.c */ | 98 | /* nfs3xdr.c */ |
99 | extern struct rpc_procinfo nfs3_procedures[]; | 99 | extern struct rpc_procinfo nfs3_procedures[]; |
100 | extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); | 100 | extern __be32 *nfs3_decode_dirent(__be32 *, struct nfs_entry *, int); |
101 | 101 | ||
102 | /* nfs4xdr.c */ | 102 | /* nfs4xdr.c */ |
103 | #ifdef CONFIG_NFS_V4 | 103 | #ifdef CONFIG_NFS_V4 |
104 | extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus); | 104 | extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus); |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | /* nfs4proc.c */ | 107 | /* nfs4proc.c */ |
@@ -217,3 +217,21 @@ void nfs_super_set_maxbytes(struct super_block *sb, __u64 maxfilesize) | |||
217 | if (sb->s_maxbytes > MAX_LFS_FILESIZE || sb->s_maxbytes <= 0) | 217 | if (sb->s_maxbytes > MAX_LFS_FILESIZE || sb->s_maxbytes <= 0) |
218 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 218 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
219 | } | 219 | } |
220 | |||
221 | /* | ||
222 | * Determine the number of bytes of data the page contains | ||
223 | */ | ||
224 | static inline | ||
225 | unsigned int nfs_page_length(struct page *page) | ||
226 | { | ||
227 | loff_t i_size = i_size_read(page->mapping->host); | ||
228 | |||
229 | if (i_size > 0) { | ||
230 | pgoff_t end_index = (i_size - 1) >> PAGE_CACHE_SHIFT; | ||
231 | if (page->index < end_index) | ||
232 | return PAGE_CACHE_SIZE; | ||
233 | if (page->index == end_index) | ||
234 | return ((i_size - 1) & ~PAGE_CACHE_MASK) + 1; | ||
235 | } | ||
236 | return 0; | ||
237 | } | ||
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index d507b021207f..f75fe72b4160 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c | |||
@@ -95,7 +95,7 @@ mnt_create(char *hostname, struct sockaddr_in *srvaddr, int version, | |||
95 | * XDR encode/decode functions for MOUNT | 95 | * XDR encode/decode functions for MOUNT |
96 | */ | 96 | */ |
97 | static int | 97 | static int |
98 | xdr_encode_dirpath(struct rpc_rqst *req, u32 *p, const char *path) | 98 | xdr_encode_dirpath(struct rpc_rqst *req, __be32 *p, const char *path) |
99 | { | 99 | { |
100 | p = xdr_encode_string(p, path); | 100 | p = xdr_encode_string(p, path); |
101 | 101 | ||
@@ -104,7 +104,7 @@ xdr_encode_dirpath(struct rpc_rqst *req, u32 *p, const char *path) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | static int | 106 | static int |
107 | xdr_decode_fhstatus(struct rpc_rqst *req, u32 *p, struct mnt_fhstatus *res) | 107 | xdr_decode_fhstatus(struct rpc_rqst *req, __be32 *p, struct mnt_fhstatus *res) |
108 | { | 108 | { |
109 | struct nfs_fh *fh = res->fh; | 109 | struct nfs_fh *fh = res->fh; |
110 | 110 | ||
@@ -116,7 +116,7 @@ xdr_decode_fhstatus(struct rpc_rqst *req, u32 *p, struct mnt_fhstatus *res) | |||
116 | } | 116 | } |
117 | 117 | ||
118 | static int | 118 | static int |
119 | xdr_decode_fhstatus3(struct rpc_rqst *req, u32 *p, struct mnt_fhstatus *res) | 119 | xdr_decode_fhstatus3(struct rpc_rqst *req, __be32 *p, struct mnt_fhstatus *res) |
120 | { | 120 | { |
121 | struct nfs_fh *fh = res->fh; | 121 | struct nfs_fh *fh = res->fh; |
122 | 122 | ||
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index ec1114b33d89..371b804e7cc8 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
@@ -18,10 +18,10 @@ | |||
18 | 18 | ||
19 | #define NFSDBG_FACILITY NFSDBG_VFS | 19 | #define NFSDBG_FACILITY NFSDBG_VFS |
20 | 20 | ||
21 | static void nfs_expire_automounts(void *list); | 21 | static void nfs_expire_automounts(struct work_struct *work); |
22 | 22 | ||
23 | LIST_HEAD(nfs_automount_list); | 23 | LIST_HEAD(nfs_automount_list); |
24 | static DECLARE_WORK(nfs_automount_task, nfs_expire_automounts, &nfs_automount_list); | 24 | static DECLARE_DELAYED_WORK(nfs_automount_task, nfs_expire_automounts); |
25 | int nfs_mountpoint_expiry_timeout = 500 * HZ; | 25 | int nfs_mountpoint_expiry_timeout = 500 * HZ; |
26 | 26 | ||
27 | static struct vfsmount *nfs_do_submount(const struct vfsmount *mnt_parent, | 27 | static struct vfsmount *nfs_do_submount(const struct vfsmount *mnt_parent, |
@@ -164,9 +164,9 @@ struct inode_operations nfs_referral_inode_operations = { | |||
164 | .follow_link = nfs_follow_mountpoint, | 164 | .follow_link = nfs_follow_mountpoint, |
165 | }; | 165 | }; |
166 | 166 | ||
167 | static void nfs_expire_automounts(void *data) | 167 | static void nfs_expire_automounts(struct work_struct *work) |
168 | { | 168 | { |
169 | struct list_head *list = (struct list_head *)data; | 169 | struct list_head *list = &nfs_automount_list; |
170 | 170 | ||
171 | mark_mounts_for_expiry(list); | 171 | mark_mounts_for_expiry(list); |
172 | if (!list_empty(list)) | 172 | if (!list_empty(list)) |
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index b49501fc0a79..3be4e72a0227 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c | |||
@@ -66,15 +66,15 @@ | |||
66 | /* | 66 | /* |
67 | * Common NFS XDR functions as inlines | 67 | * Common NFS XDR functions as inlines |
68 | */ | 68 | */ |
69 | static inline u32 * | 69 | static inline __be32 * |
70 | xdr_encode_fhandle(u32 *p, struct nfs_fh *fhandle) | 70 | xdr_encode_fhandle(__be32 *p, struct nfs_fh *fhandle) |
71 | { | 71 | { |
72 | memcpy(p, fhandle->data, NFS2_FHSIZE); | 72 | memcpy(p, fhandle->data, NFS2_FHSIZE); |
73 | return p + XDR_QUADLEN(NFS2_FHSIZE); | 73 | return p + XDR_QUADLEN(NFS2_FHSIZE); |
74 | } | 74 | } |
75 | 75 | ||
76 | static inline u32 * | 76 | static inline __be32 * |
77 | xdr_decode_fhandle(u32 *p, struct nfs_fh *fhandle) | 77 | xdr_decode_fhandle(__be32 *p, struct nfs_fh *fhandle) |
78 | { | 78 | { |
79 | /* NFSv2 handles have a fixed length */ | 79 | /* NFSv2 handles have a fixed length */ |
80 | fhandle->size = NFS2_FHSIZE; | 80 | fhandle->size = NFS2_FHSIZE; |
@@ -82,8 +82,8 @@ xdr_decode_fhandle(u32 *p, struct nfs_fh *fhandle) | |||
82 | return p + XDR_QUADLEN(NFS2_FHSIZE); | 82 | return p + XDR_QUADLEN(NFS2_FHSIZE); |
83 | } | 83 | } |
84 | 84 | ||
85 | static inline u32* | 85 | static inline __be32* |
86 | xdr_encode_time(u32 *p, struct timespec *timep) | 86 | xdr_encode_time(__be32 *p, struct timespec *timep) |
87 | { | 87 | { |
88 | *p++ = htonl(timep->tv_sec); | 88 | *p++ = htonl(timep->tv_sec); |
89 | /* Convert nanoseconds into microseconds */ | 89 | /* Convert nanoseconds into microseconds */ |
@@ -91,8 +91,8 @@ xdr_encode_time(u32 *p, struct timespec *timep) | |||
91 | return p; | 91 | return p; |
92 | } | 92 | } |
93 | 93 | ||
94 | static inline u32* | 94 | static inline __be32* |
95 | xdr_encode_current_server_time(u32 *p, struct timespec *timep) | 95 | xdr_encode_current_server_time(__be32 *p, struct timespec *timep) |
96 | { | 96 | { |
97 | /* | 97 | /* |
98 | * Passing the invalid value useconds=1000000 is a | 98 | * Passing the invalid value useconds=1000000 is a |
@@ -108,8 +108,8 @@ xdr_encode_current_server_time(u32 *p, struct timespec *timep) | |||
108 | return p; | 108 | return p; |
109 | } | 109 | } |
110 | 110 | ||
111 | static inline u32* | 111 | static inline __be32* |
112 | xdr_decode_time(u32 *p, struct timespec *timep) | 112 | xdr_decode_time(__be32 *p, struct timespec *timep) |
113 | { | 113 | { |
114 | timep->tv_sec = ntohl(*p++); | 114 | timep->tv_sec = ntohl(*p++); |
115 | /* Convert microseconds into nanoseconds */ | 115 | /* Convert microseconds into nanoseconds */ |
@@ -117,8 +117,8 @@ xdr_decode_time(u32 *p, struct timespec *timep) | |||
117 | return p; | 117 | return p; |
118 | } | 118 | } |
119 | 119 | ||
120 | static u32 * | 120 | static __be32 * |
121 | xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr) | 121 | xdr_decode_fattr(__be32 *p, struct nfs_fattr *fattr) |
122 | { | 122 | { |
123 | u32 rdev; | 123 | u32 rdev; |
124 | fattr->type = (enum nfs_ftype) ntohl(*p++); | 124 | fattr->type = (enum nfs_ftype) ntohl(*p++); |
@@ -146,10 +146,10 @@ xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr) | |||
146 | return p; | 146 | return p; |
147 | } | 147 | } |
148 | 148 | ||
149 | static inline u32 * | 149 | static inline __be32 * |
150 | xdr_encode_sattr(u32 *p, struct iattr *attr) | 150 | xdr_encode_sattr(__be32 *p, struct iattr *attr) |
151 | { | 151 | { |
152 | const u32 not_set = __constant_htonl(0xFFFFFFFF); | 152 | const __be32 not_set = __constant_htonl(0xFFFFFFFF); |
153 | 153 | ||
154 | *p++ = (attr->ia_valid & ATTR_MODE) ? htonl(attr->ia_mode) : not_set; | 154 | *p++ = (attr->ia_valid & ATTR_MODE) ? htonl(attr->ia_mode) : not_set; |
155 | *p++ = (attr->ia_valid & ATTR_UID) ? htonl(attr->ia_uid) : not_set; | 155 | *p++ = (attr->ia_valid & ATTR_UID) ? htonl(attr->ia_uid) : not_set; |
@@ -184,7 +184,7 @@ xdr_encode_sattr(u32 *p, struct iattr *attr) | |||
184 | * GETATTR, READLINK, STATFS | 184 | * GETATTR, READLINK, STATFS |
185 | */ | 185 | */ |
186 | static int | 186 | static int |
187 | nfs_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh) | 187 | nfs_xdr_fhandle(struct rpc_rqst *req, __be32 *p, struct nfs_fh *fh) |
188 | { | 188 | { |
189 | p = xdr_encode_fhandle(p, fh); | 189 | p = xdr_encode_fhandle(p, fh); |
190 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); | 190 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); |
@@ -195,7 +195,7 @@ nfs_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh) | |||
195 | * Encode SETATTR arguments | 195 | * Encode SETATTR arguments |
196 | */ | 196 | */ |
197 | static int | 197 | static int |
198 | nfs_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs_sattrargs *args) | 198 | nfs_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs_sattrargs *args) |
199 | { | 199 | { |
200 | p = xdr_encode_fhandle(p, args->fh); | 200 | p = xdr_encode_fhandle(p, args->fh); |
201 | p = xdr_encode_sattr(p, args->sattr); | 201 | p = xdr_encode_sattr(p, args->sattr); |
@@ -208,7 +208,7 @@ nfs_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs_sattrargs *args) | |||
208 | * LOOKUP, REMOVE, RMDIR | 208 | * LOOKUP, REMOVE, RMDIR |
209 | */ | 209 | */ |
210 | static int | 210 | static int |
211 | nfs_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs_diropargs *args) | 211 | nfs_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs_diropargs *args) |
212 | { | 212 | { |
213 | p = xdr_encode_fhandle(p, args->fh); | 213 | p = xdr_encode_fhandle(p, args->fh); |
214 | p = xdr_encode_array(p, args->name, args->len); | 214 | p = xdr_encode_array(p, args->name, args->len); |
@@ -222,7 +222,7 @@ nfs_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs_diropargs *args) | |||
222 | * exactly to the page we want to fetch. | 222 | * exactly to the page we want to fetch. |
223 | */ | 223 | */ |
224 | static int | 224 | static int |
225 | nfs_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args) | 225 | nfs_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) |
226 | { | 226 | { |
227 | struct rpc_auth *auth = req->rq_task->tk_auth; | 227 | struct rpc_auth *auth = req->rq_task->tk_auth; |
228 | unsigned int replen; | 228 | unsigned int replen; |
@@ -246,7 +246,7 @@ nfs_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args) | |||
246 | * Decode READ reply | 246 | * Decode READ reply |
247 | */ | 247 | */ |
248 | static int | 248 | static int |
249 | nfs_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res) | 249 | nfs_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res) |
250 | { | 250 | { |
251 | struct kvec *iov = req->rq_rcv_buf.head; | 251 | struct kvec *iov = req->rq_rcv_buf.head; |
252 | int status, count, recvd, hdrlen; | 252 | int status, count, recvd, hdrlen; |
@@ -286,7 +286,7 @@ nfs_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res) | |||
286 | * Write arguments. Splice the buffer to be written into the iovec. | 286 | * Write arguments. Splice the buffer to be written into the iovec. |
287 | */ | 287 | */ |
288 | static int | 288 | static int |
289 | nfs_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) | 289 | nfs_xdr_writeargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args) |
290 | { | 290 | { |
291 | struct xdr_buf *sndbuf = &req->rq_snd_buf; | 291 | struct xdr_buf *sndbuf = &req->rq_snd_buf; |
292 | u32 offset = (u32)args->offset; | 292 | u32 offset = (u32)args->offset; |
@@ -309,7 +309,7 @@ nfs_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) | |||
309 | * CREATE, MKDIR | 309 | * CREATE, MKDIR |
310 | */ | 310 | */ |
311 | static int | 311 | static int |
312 | nfs_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs_createargs *args) | 312 | nfs_xdr_createargs(struct rpc_rqst *req, __be32 *p, struct nfs_createargs *args) |
313 | { | 313 | { |
314 | p = xdr_encode_fhandle(p, args->fh); | 314 | p = xdr_encode_fhandle(p, args->fh); |
315 | p = xdr_encode_array(p, args->name, args->len); | 315 | p = xdr_encode_array(p, args->name, args->len); |
@@ -322,7 +322,7 @@ nfs_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs_createargs *args) | |||
322 | * Encode RENAME arguments | 322 | * Encode RENAME arguments |
323 | */ | 323 | */ |
324 | static int | 324 | static int |
325 | nfs_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs_renameargs *args) | 325 | nfs_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs_renameargs *args) |
326 | { | 326 | { |
327 | p = xdr_encode_fhandle(p, args->fromfh); | 327 | p = xdr_encode_fhandle(p, args->fromfh); |
328 | p = xdr_encode_array(p, args->fromname, args->fromlen); | 328 | p = xdr_encode_array(p, args->fromname, args->fromlen); |
@@ -336,7 +336,7 @@ nfs_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs_renameargs *args) | |||
336 | * Encode LINK arguments | 336 | * Encode LINK arguments |
337 | */ | 337 | */ |
338 | static int | 338 | static int |
339 | nfs_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs_linkargs *args) | 339 | nfs_xdr_linkargs(struct rpc_rqst *req, __be32 *p, struct nfs_linkargs *args) |
340 | { | 340 | { |
341 | p = xdr_encode_fhandle(p, args->fromfh); | 341 | p = xdr_encode_fhandle(p, args->fromfh); |
342 | p = xdr_encode_fhandle(p, args->tofh); | 342 | p = xdr_encode_fhandle(p, args->tofh); |
@@ -349,7 +349,7 @@ nfs_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs_linkargs *args) | |||
349 | * Encode SYMLINK arguments | 349 | * Encode SYMLINK arguments |
350 | */ | 350 | */ |
351 | static int | 351 | static int |
352 | nfs_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_symlinkargs *args) | 352 | nfs_xdr_symlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs_symlinkargs *args) |
353 | { | 353 | { |
354 | struct xdr_buf *sndbuf = &req->rq_snd_buf; | 354 | struct xdr_buf *sndbuf = &req->rq_snd_buf; |
355 | size_t pad; | 355 | size_t pad; |
@@ -378,7 +378,7 @@ nfs_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_symlinkargs *args) | |||
378 | * Encode arguments to readdir call | 378 | * Encode arguments to readdir call |
379 | */ | 379 | */ |
380 | static int | 380 | static int |
381 | nfs_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs_readdirargs *args) | 381 | nfs_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs_readdirargs *args) |
382 | { | 382 | { |
383 | struct rpc_task *task = req->rq_task; | 383 | struct rpc_task *task = req->rq_task; |
384 | struct rpc_auth *auth = task->tk_auth; | 384 | struct rpc_auth *auth = task->tk_auth; |
@@ -404,7 +404,7 @@ nfs_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs_readdirargs *args) | |||
404 | * from nfs_readdir for each entry. | 404 | * from nfs_readdir for each entry. |
405 | */ | 405 | */ |
406 | static int | 406 | static int |
407 | nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, void *dummy) | 407 | nfs_xdr_readdirres(struct rpc_rqst *req, __be32 *p, void *dummy) |
408 | { | 408 | { |
409 | struct xdr_buf *rcvbuf = &req->rq_rcv_buf; | 409 | struct xdr_buf *rcvbuf = &req->rq_rcv_buf; |
410 | struct kvec *iov = rcvbuf->head; | 410 | struct kvec *iov = rcvbuf->head; |
@@ -412,7 +412,7 @@ nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, void *dummy) | |||
412 | int hdrlen, recvd; | 412 | int hdrlen, recvd; |
413 | int status, nr; | 413 | int status, nr; |
414 | unsigned int len, pglen; | 414 | unsigned int len, pglen; |
415 | u32 *end, *entry, *kaddr; | 415 | __be32 *end, *entry, *kaddr; |
416 | 416 | ||
417 | if ((status = ntohl(*p++))) | 417 | if ((status = ntohl(*p++))) |
418 | return -nfs_stat_to_errno(status); | 418 | return -nfs_stat_to_errno(status); |
@@ -432,8 +432,8 @@ nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, void *dummy) | |||
432 | if (pglen > recvd) | 432 | if (pglen > recvd) |
433 | pglen = recvd; | 433 | pglen = recvd; |
434 | page = rcvbuf->pages; | 434 | page = rcvbuf->pages; |
435 | kaddr = p = (u32 *)kmap_atomic(*page, KM_USER0); | 435 | kaddr = p = kmap_atomic(*page, KM_USER0); |
436 | end = (u32 *)((char *)p + pglen); | 436 | end = (__be32 *)((char *)p + pglen); |
437 | entry = p; | 437 | entry = p; |
438 | for (nr = 0; *p++; nr++) { | 438 | for (nr = 0; *p++; nr++) { |
439 | if (p + 2 > end) | 439 | if (p + 2 > end) |
@@ -468,8 +468,8 @@ err_unmap: | |||
468 | goto out; | 468 | goto out; |
469 | } | 469 | } |
470 | 470 | ||
471 | u32 * | 471 | __be32 * |
472 | nfs_decode_dirent(u32 *p, struct nfs_entry *entry, int plus) | 472 | nfs_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus) |
473 | { | 473 | { |
474 | if (!*p++) { | 474 | if (!*p++) { |
475 | if (!*p) | 475 | if (!*p) |
@@ -496,7 +496,7 @@ nfs_decode_dirent(u32 *p, struct nfs_entry *entry, int plus) | |||
496 | * Decode simple status reply | 496 | * Decode simple status reply |
497 | */ | 497 | */ |
498 | static int | 498 | static int |
499 | nfs_xdr_stat(struct rpc_rqst *req, u32 *p, void *dummy) | 499 | nfs_xdr_stat(struct rpc_rqst *req, __be32 *p, void *dummy) |
500 | { | 500 | { |
501 | int status; | 501 | int status; |
502 | 502 | ||
@@ -510,7 +510,7 @@ nfs_xdr_stat(struct rpc_rqst *req, u32 *p, void *dummy) | |||
510 | * GETATTR, SETATTR, WRITE | 510 | * GETATTR, SETATTR, WRITE |
511 | */ | 511 | */ |
512 | static int | 512 | static int |
513 | nfs_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) | 513 | nfs_xdr_attrstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr) |
514 | { | 514 | { |
515 | int status; | 515 | int status; |
516 | 516 | ||
@@ -525,7 +525,7 @@ nfs_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) | |||
525 | * LOOKUP, CREATE, MKDIR | 525 | * LOOKUP, CREATE, MKDIR |
526 | */ | 526 | */ |
527 | static int | 527 | static int |
528 | nfs_xdr_diropres(struct rpc_rqst *req, u32 *p, struct nfs_diropok *res) | 528 | nfs_xdr_diropres(struct rpc_rqst *req, __be32 *p, struct nfs_diropok *res) |
529 | { | 529 | { |
530 | int status; | 530 | int status; |
531 | 531 | ||
@@ -540,7 +540,7 @@ nfs_xdr_diropres(struct rpc_rqst *req, u32 *p, struct nfs_diropok *res) | |||
540 | * Encode READLINK args | 540 | * Encode READLINK args |
541 | */ | 541 | */ |
542 | static int | 542 | static int |
543 | nfs_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_readlinkargs *args) | 543 | nfs_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs_readlinkargs *args) |
544 | { | 544 | { |
545 | struct rpc_auth *auth = req->rq_task->tk_auth; | 545 | struct rpc_auth *auth = req->rq_task->tk_auth; |
546 | unsigned int replen; | 546 | unsigned int replen; |
@@ -558,7 +558,7 @@ nfs_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_readlinkargs *args | |||
558 | * Decode READLINK reply | 558 | * Decode READLINK reply |
559 | */ | 559 | */ |
560 | static int | 560 | static int |
561 | nfs_xdr_readlinkres(struct rpc_rqst *req, u32 *p, void *dummy) | 561 | nfs_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, void *dummy) |
562 | { | 562 | { |
563 | struct xdr_buf *rcvbuf = &req->rq_rcv_buf; | 563 | struct xdr_buf *rcvbuf = &req->rq_rcv_buf; |
564 | struct kvec *iov = rcvbuf->head; | 564 | struct kvec *iov = rcvbuf->head; |
@@ -601,7 +601,7 @@ nfs_xdr_readlinkres(struct rpc_rqst *req, u32 *p, void *dummy) | |||
601 | * Decode WRITE reply | 601 | * Decode WRITE reply |
602 | */ | 602 | */ |
603 | static int | 603 | static int |
604 | nfs_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) | 604 | nfs_xdr_writeres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res) |
605 | { | 605 | { |
606 | res->verf->committed = NFS_FILE_SYNC; | 606 | res->verf->committed = NFS_FILE_SYNC; |
607 | return nfs_xdr_attrstat(req, p, res->fattr); | 607 | return nfs_xdr_attrstat(req, p, res->fattr); |
@@ -611,7 +611,7 @@ nfs_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) | |||
611 | * Decode STATFS reply | 611 | * Decode STATFS reply |
612 | */ | 612 | */ |
613 | static int | 613 | static int |
614 | nfs_xdr_statfsres(struct rpc_rqst *req, u32 *p, struct nfs2_fsstat *res) | 614 | nfs_xdr_statfsres(struct rpc_rqst *req, __be32 *p, struct nfs2_fsstat *res) |
615 | { | 615 | { |
616 | int status; | 616 | int status; |
617 | 617 | ||
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 3b234d4601e7..acd8fe9762d3 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -276,51 +276,6 @@ static int nfs3_proc_read(struct nfs_read_data *rdata) | |||
276 | return status; | 276 | return status; |
277 | } | 277 | } |
278 | 278 | ||
279 | static int nfs3_proc_write(struct nfs_write_data *wdata) | ||
280 | { | ||
281 | int rpcflags = wdata->flags; | ||
282 | struct inode * inode = wdata->inode; | ||
283 | struct nfs_fattr * fattr = wdata->res.fattr; | ||
284 | struct rpc_message msg = { | ||
285 | .rpc_proc = &nfs3_procedures[NFS3PROC_WRITE], | ||
286 | .rpc_argp = &wdata->args, | ||
287 | .rpc_resp = &wdata->res, | ||
288 | .rpc_cred = wdata->cred, | ||
289 | }; | ||
290 | int status; | ||
291 | |||
292 | dprintk("NFS call write %d @ %Ld\n", wdata->args.count, | ||
293 | (long long) wdata->args.offset); | ||
294 | nfs_fattr_init(fattr); | ||
295 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, rpcflags); | ||
296 | if (status >= 0) | ||
297 | nfs_post_op_update_inode(inode, fattr); | ||
298 | dprintk("NFS reply write: %d\n", status); | ||
299 | return status < 0? status : wdata->res.count; | ||
300 | } | ||
301 | |||
302 | static int nfs3_proc_commit(struct nfs_write_data *cdata) | ||
303 | { | ||
304 | struct inode * inode = cdata->inode; | ||
305 | struct nfs_fattr * fattr = cdata->res.fattr; | ||
306 | struct rpc_message msg = { | ||
307 | .rpc_proc = &nfs3_procedures[NFS3PROC_COMMIT], | ||
308 | .rpc_argp = &cdata->args, | ||
309 | .rpc_resp = &cdata->res, | ||
310 | .rpc_cred = cdata->cred, | ||
311 | }; | ||
312 | int status; | ||
313 | |||
314 | dprintk("NFS call commit %d @ %Ld\n", cdata->args.count, | ||
315 | (long long) cdata->args.offset); | ||
316 | nfs_fattr_init(fattr); | ||
317 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); | ||
318 | if (status >= 0) | ||
319 | nfs_post_op_update_inode(inode, fattr); | ||
320 | dprintk("NFS reply commit: %d\n", status); | ||
321 | return status; | ||
322 | } | ||
323 | |||
324 | /* | 279 | /* |
325 | * Create a regular file. | 280 | * Create a regular file. |
326 | * For now, we don't implement O_EXCL. | 281 | * For now, we don't implement O_EXCL. |
@@ -369,7 +324,7 @@ again: | |||
369 | 324 | ||
370 | /* If the server doesn't support the exclusive creation semantics, | 325 | /* If the server doesn't support the exclusive creation semantics, |
371 | * try again with simple 'guarded' mode. */ | 326 | * try again with simple 'guarded' mode. */ |
372 | if (status == NFSERR_NOTSUPP) { | 327 | if (status == -ENOTSUPP) { |
373 | switch (arg.createmode) { | 328 | switch (arg.createmode) { |
374 | case NFS3_CREATE_EXCLUSIVE: | 329 | case NFS3_CREATE_EXCLUSIVE: |
375 | arg.createmode = NFS3_CREATE_GUARDED; | 330 | arg.createmode = NFS3_CREATE_GUARDED; |
@@ -668,7 +623,7 @@ nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | |||
668 | { | 623 | { |
669 | struct inode *dir = dentry->d_inode; | 624 | struct inode *dir = dentry->d_inode; |
670 | struct nfs_fattr dir_attr; | 625 | struct nfs_fattr dir_attr; |
671 | u32 *verf = NFS_COOKIEVERF(dir); | 626 | __be32 *verf = NFS_COOKIEVERF(dir); |
672 | struct nfs3_readdirargs arg = { | 627 | struct nfs3_readdirargs arg = { |
673 | .fh = NFS_FH(dir), | 628 | .fh = NFS_FH(dir), |
674 | .cookie = cookie, | 629 | .cookie = cookie, |
@@ -690,8 +645,6 @@ nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | |||
690 | }; | 645 | }; |
691 | int status; | 646 | int status; |
692 | 647 | ||
693 | lock_kernel(); | ||
694 | |||
695 | if (plus) | 648 | if (plus) |
696 | msg.rpc_proc = &nfs3_procedures[NFS3PROC_READDIRPLUS]; | 649 | msg.rpc_proc = &nfs3_procedures[NFS3PROC_READDIRPLUS]; |
697 | 650 | ||
@@ -702,7 +655,6 @@ nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | |||
702 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); | 655 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); |
703 | nfs_refresh_inode(dir, &dir_attr); | 656 | nfs_refresh_inode(dir, &dir_attr); |
704 | dprintk("NFS reply readdir: %d\n", status); | 657 | dprintk("NFS reply readdir: %d\n", status); |
705 | unlock_kernel(); | ||
706 | return status; | 658 | return status; |
707 | } | 659 | } |
708 | 660 | ||
@@ -889,7 +841,7 @@ static void nfs3_proc_commit_setup(struct nfs_write_data *data, int how) | |||
889 | static int | 841 | static int |
890 | nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl) | 842 | nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl) |
891 | { | 843 | { |
892 | return nlmclnt_proc(filp->f_dentry->d_inode, cmd, fl); | 844 | return nlmclnt_proc(filp->f_path.dentry->d_inode, cmd, fl); |
893 | } | 845 | } |
894 | 846 | ||
895 | const struct nfs_rpc_ops nfs_v3_clientops = { | 847 | const struct nfs_rpc_ops nfs_v3_clientops = { |
@@ -904,8 +856,6 @@ const struct nfs_rpc_ops nfs_v3_clientops = { | |||
904 | .access = nfs3_proc_access, | 856 | .access = nfs3_proc_access, |
905 | .readlink = nfs3_proc_readlink, | 857 | .readlink = nfs3_proc_readlink, |
906 | .read = nfs3_proc_read, | 858 | .read = nfs3_proc_read, |
907 | .write = nfs3_proc_write, | ||
908 | .commit = nfs3_proc_commit, | ||
909 | .create = nfs3_proc_create, | 859 | .create = nfs3_proc_create, |
910 | .remove = nfs3_proc_remove, | 860 | .remove = nfs3_proc_remove, |
911 | .unlink_setup = nfs3_proc_unlink_setup, | 861 | .unlink_setup = nfs3_proc_unlink_setup, |
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index 16556fa4effb..0ace092d126f 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c | |||
@@ -105,14 +105,14 @@ static struct { | |||
105 | /* | 105 | /* |
106 | * Common NFS XDR functions as inlines | 106 | * Common NFS XDR functions as inlines |
107 | */ | 107 | */ |
108 | static inline u32 * | 108 | static inline __be32 * |
109 | xdr_encode_fhandle(u32 *p, struct nfs_fh *fh) | 109 | xdr_encode_fhandle(__be32 *p, struct nfs_fh *fh) |
110 | { | 110 | { |
111 | return xdr_encode_array(p, fh->data, fh->size); | 111 | return xdr_encode_array(p, fh->data, fh->size); |
112 | } | 112 | } |
113 | 113 | ||
114 | static inline u32 * | 114 | static inline __be32 * |
115 | xdr_decode_fhandle(u32 *p, struct nfs_fh *fh) | 115 | xdr_decode_fhandle(__be32 *p, struct nfs_fh *fh) |
116 | { | 116 | { |
117 | if ((fh->size = ntohl(*p++)) <= NFS3_FHSIZE) { | 117 | if ((fh->size = ntohl(*p++)) <= NFS3_FHSIZE) { |
118 | memcpy(fh->data, p, fh->size); | 118 | memcpy(fh->data, p, fh->size); |
@@ -124,24 +124,24 @@ xdr_decode_fhandle(u32 *p, struct nfs_fh *fh) | |||
124 | /* | 124 | /* |
125 | * Encode/decode time. | 125 | * Encode/decode time. |
126 | */ | 126 | */ |
127 | static inline u32 * | 127 | static inline __be32 * |
128 | xdr_encode_time3(u32 *p, struct timespec *timep) | 128 | xdr_encode_time3(__be32 *p, struct timespec *timep) |
129 | { | 129 | { |
130 | *p++ = htonl(timep->tv_sec); | 130 | *p++ = htonl(timep->tv_sec); |
131 | *p++ = htonl(timep->tv_nsec); | 131 | *p++ = htonl(timep->tv_nsec); |
132 | return p; | 132 | return p; |
133 | } | 133 | } |
134 | 134 | ||
135 | static inline u32 * | 135 | static inline __be32 * |
136 | xdr_decode_time3(u32 *p, struct timespec *timep) | 136 | xdr_decode_time3(__be32 *p, struct timespec *timep) |
137 | { | 137 | { |
138 | timep->tv_sec = ntohl(*p++); | 138 | timep->tv_sec = ntohl(*p++); |
139 | timep->tv_nsec = ntohl(*p++); | 139 | timep->tv_nsec = ntohl(*p++); |
140 | return p; | 140 | return p; |
141 | } | 141 | } |
142 | 142 | ||
143 | static u32 * | 143 | static __be32 * |
144 | xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr) | 144 | xdr_decode_fattr(__be32 *p, struct nfs_fattr *fattr) |
145 | { | 145 | { |
146 | unsigned int type, major, minor; | 146 | unsigned int type, major, minor; |
147 | int fmode; | 147 | int fmode; |
@@ -177,8 +177,8 @@ xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr) | |||
177 | return p; | 177 | return p; |
178 | } | 178 | } |
179 | 179 | ||
180 | static inline u32 * | 180 | static inline __be32 * |
181 | xdr_encode_sattr(u32 *p, struct iattr *attr) | 181 | xdr_encode_sattr(__be32 *p, struct iattr *attr) |
182 | { | 182 | { |
183 | if (attr->ia_valid & ATTR_MODE) { | 183 | if (attr->ia_valid & ATTR_MODE) { |
184 | *p++ = xdr_one; | 184 | *p++ = xdr_one; |
@@ -223,8 +223,8 @@ xdr_encode_sattr(u32 *p, struct iattr *attr) | |||
223 | return p; | 223 | return p; |
224 | } | 224 | } |
225 | 225 | ||
226 | static inline u32 * | 226 | static inline __be32 * |
227 | xdr_decode_wcc_attr(u32 *p, struct nfs_fattr *fattr) | 227 | xdr_decode_wcc_attr(__be32 *p, struct nfs_fattr *fattr) |
228 | { | 228 | { |
229 | p = xdr_decode_hyper(p, &fattr->pre_size); | 229 | p = xdr_decode_hyper(p, &fattr->pre_size); |
230 | p = xdr_decode_time3(p, &fattr->pre_mtime); | 230 | p = xdr_decode_time3(p, &fattr->pre_mtime); |
@@ -233,16 +233,16 @@ xdr_decode_wcc_attr(u32 *p, struct nfs_fattr *fattr) | |||
233 | return p; | 233 | return p; |
234 | } | 234 | } |
235 | 235 | ||
236 | static inline u32 * | 236 | static inline __be32 * |
237 | xdr_decode_post_op_attr(u32 *p, struct nfs_fattr *fattr) | 237 | xdr_decode_post_op_attr(__be32 *p, struct nfs_fattr *fattr) |
238 | { | 238 | { |
239 | if (*p++) | 239 | if (*p++) |
240 | p = xdr_decode_fattr(p, fattr); | 240 | p = xdr_decode_fattr(p, fattr); |
241 | return p; | 241 | return p; |
242 | } | 242 | } |
243 | 243 | ||
244 | static inline u32 * | 244 | static inline __be32 * |
245 | xdr_decode_pre_op_attr(u32 *p, struct nfs_fattr *fattr) | 245 | xdr_decode_pre_op_attr(__be32 *p, struct nfs_fattr *fattr) |
246 | { | 246 | { |
247 | if (*p++) | 247 | if (*p++) |
248 | return xdr_decode_wcc_attr(p, fattr); | 248 | return xdr_decode_wcc_attr(p, fattr); |
@@ -250,8 +250,8 @@ xdr_decode_pre_op_attr(u32 *p, struct nfs_fattr *fattr) | |||
250 | } | 250 | } |
251 | 251 | ||
252 | 252 | ||
253 | static inline u32 * | 253 | static inline __be32 * |
254 | xdr_decode_wcc_data(u32 *p, struct nfs_fattr *fattr) | 254 | xdr_decode_wcc_data(__be32 *p, struct nfs_fattr *fattr) |
255 | { | 255 | { |
256 | p = xdr_decode_pre_op_attr(p, fattr); | 256 | p = xdr_decode_pre_op_attr(p, fattr); |
257 | return xdr_decode_post_op_attr(p, fattr); | 257 | return xdr_decode_post_op_attr(p, fattr); |
@@ -265,7 +265,7 @@ xdr_decode_wcc_data(u32 *p, struct nfs_fattr *fattr) | |||
265 | * Encode file handle argument | 265 | * Encode file handle argument |
266 | */ | 266 | */ |
267 | static int | 267 | static int |
268 | nfs3_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh) | 268 | nfs3_xdr_fhandle(struct rpc_rqst *req, __be32 *p, struct nfs_fh *fh) |
269 | { | 269 | { |
270 | p = xdr_encode_fhandle(p, fh); | 270 | p = xdr_encode_fhandle(p, fh); |
271 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); | 271 | req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); |
@@ -276,7 +276,7 @@ nfs3_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh) | |||
276 | * Encode SETATTR arguments | 276 | * Encode SETATTR arguments |
277 | */ | 277 | */ |
278 | static int | 278 | static int |
279 | nfs3_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs3_sattrargs *args) | 279 | nfs3_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs3_sattrargs *args) |
280 | { | 280 | { |
281 | p = xdr_encode_fhandle(p, args->fh); | 281 | p = xdr_encode_fhandle(p, args->fh); |
282 | p = xdr_encode_sattr(p, args->sattr); | 282 | p = xdr_encode_sattr(p, args->sattr); |
@@ -291,7 +291,7 @@ nfs3_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs3_sattrargs *args) | |||
291 | * Encode directory ops argument | 291 | * Encode directory ops argument |
292 | */ | 292 | */ |
293 | static int | 293 | static int |
294 | nfs3_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs3_diropargs *args) | 294 | nfs3_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs3_diropargs *args) |
295 | { | 295 | { |
296 | p = xdr_encode_fhandle(p, args->fh); | 296 | p = xdr_encode_fhandle(p, args->fh); |
297 | p = xdr_encode_array(p, args->name, args->len); | 297 | p = xdr_encode_array(p, args->name, args->len); |
@@ -303,7 +303,7 @@ nfs3_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs3_diropargs *args) | |||
303 | * Encode access() argument | 303 | * Encode access() argument |
304 | */ | 304 | */ |
305 | static int | 305 | static int |
306 | nfs3_xdr_accessargs(struct rpc_rqst *req, u32 *p, struct nfs3_accessargs *args) | 306 | nfs3_xdr_accessargs(struct rpc_rqst *req, __be32 *p, struct nfs3_accessargs *args) |
307 | { | 307 | { |
308 | p = xdr_encode_fhandle(p, args->fh); | 308 | p = xdr_encode_fhandle(p, args->fh); |
309 | *p++ = htonl(args->access); | 309 | *p++ = htonl(args->access); |
@@ -317,7 +317,7 @@ nfs3_xdr_accessargs(struct rpc_rqst *req, u32 *p, struct nfs3_accessargs *args) | |||
317 | * exactly to the page we want to fetch. | 317 | * exactly to the page we want to fetch. |
318 | */ | 318 | */ |
319 | static int | 319 | static int |
320 | nfs3_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args) | 320 | nfs3_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) |
321 | { | 321 | { |
322 | struct rpc_auth *auth = req->rq_task->tk_auth; | 322 | struct rpc_auth *auth = req->rq_task->tk_auth; |
323 | unsigned int replen; | 323 | unsigned int replen; |
@@ -339,7 +339,7 @@ nfs3_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args) | |||
339 | * Write arguments. Splice the buffer to be written into the iovec. | 339 | * Write arguments. Splice the buffer to be written into the iovec. |
340 | */ | 340 | */ |
341 | static int | 341 | static int |
342 | nfs3_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) | 342 | nfs3_xdr_writeargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args) |
343 | { | 343 | { |
344 | struct xdr_buf *sndbuf = &req->rq_snd_buf; | 344 | struct xdr_buf *sndbuf = &req->rq_snd_buf; |
345 | u32 count = args->count; | 345 | u32 count = args->count; |
@@ -360,7 +360,7 @@ nfs3_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) | |||
360 | * Encode CREATE arguments | 360 | * Encode CREATE arguments |
361 | */ | 361 | */ |
362 | static int | 362 | static int |
363 | nfs3_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs3_createargs *args) | 363 | nfs3_xdr_createargs(struct rpc_rqst *req, __be32 *p, struct nfs3_createargs *args) |
364 | { | 364 | { |
365 | p = xdr_encode_fhandle(p, args->fh); | 365 | p = xdr_encode_fhandle(p, args->fh); |
366 | p = xdr_encode_array(p, args->name, args->len); | 366 | p = xdr_encode_array(p, args->name, args->len); |
@@ -380,7 +380,7 @@ nfs3_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs3_createargs *args) | |||
380 | * Encode MKDIR arguments | 380 | * Encode MKDIR arguments |
381 | */ | 381 | */ |
382 | static int | 382 | static int |
383 | nfs3_xdr_mkdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_mkdirargs *args) | 383 | nfs3_xdr_mkdirargs(struct rpc_rqst *req, __be32 *p, struct nfs3_mkdirargs *args) |
384 | { | 384 | { |
385 | p = xdr_encode_fhandle(p, args->fh); | 385 | p = xdr_encode_fhandle(p, args->fh); |
386 | p = xdr_encode_array(p, args->name, args->len); | 386 | p = xdr_encode_array(p, args->name, args->len); |
@@ -393,7 +393,7 @@ nfs3_xdr_mkdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_mkdirargs *args) | |||
393 | * Encode SYMLINK arguments | 393 | * Encode SYMLINK arguments |
394 | */ | 394 | */ |
395 | static int | 395 | static int |
396 | nfs3_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_symlinkargs *args) | 396 | nfs3_xdr_symlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_symlinkargs *args) |
397 | { | 397 | { |
398 | p = xdr_encode_fhandle(p, args->fromfh); | 398 | p = xdr_encode_fhandle(p, args->fromfh); |
399 | p = xdr_encode_array(p, args->fromname, args->fromlen); | 399 | p = xdr_encode_array(p, args->fromname, args->fromlen); |
@@ -410,7 +410,7 @@ nfs3_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_symlinkargs *args | |||
410 | * Encode MKNOD arguments | 410 | * Encode MKNOD arguments |
411 | */ | 411 | */ |
412 | static int | 412 | static int |
413 | nfs3_xdr_mknodargs(struct rpc_rqst *req, u32 *p, struct nfs3_mknodargs *args) | 413 | nfs3_xdr_mknodargs(struct rpc_rqst *req, __be32 *p, struct nfs3_mknodargs *args) |
414 | { | 414 | { |
415 | p = xdr_encode_fhandle(p, args->fh); | 415 | p = xdr_encode_fhandle(p, args->fh); |
416 | p = xdr_encode_array(p, args->name, args->len); | 416 | p = xdr_encode_array(p, args->name, args->len); |
@@ -429,7 +429,7 @@ nfs3_xdr_mknodargs(struct rpc_rqst *req, u32 *p, struct nfs3_mknodargs *args) | |||
429 | * Encode RENAME arguments | 429 | * Encode RENAME arguments |
430 | */ | 430 | */ |
431 | static int | 431 | static int |
432 | nfs3_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs3_renameargs *args) | 432 | nfs3_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs3_renameargs *args) |
433 | { | 433 | { |
434 | p = xdr_encode_fhandle(p, args->fromfh); | 434 | p = xdr_encode_fhandle(p, args->fromfh); |
435 | p = xdr_encode_array(p, args->fromname, args->fromlen); | 435 | p = xdr_encode_array(p, args->fromname, args->fromlen); |
@@ -443,7 +443,7 @@ nfs3_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs3_renameargs *args) | |||
443 | * Encode LINK arguments | 443 | * Encode LINK arguments |
444 | */ | 444 | */ |
445 | static int | 445 | static int |
446 | nfs3_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs3_linkargs *args) | 446 | nfs3_xdr_linkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_linkargs *args) |
447 | { | 447 | { |
448 | p = xdr_encode_fhandle(p, args->fromfh); | 448 | p = xdr_encode_fhandle(p, args->fromfh); |
449 | p = xdr_encode_fhandle(p, args->tofh); | 449 | p = xdr_encode_fhandle(p, args->tofh); |
@@ -456,7 +456,7 @@ nfs3_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs3_linkargs *args) | |||
456 | * Encode arguments to readdir call | 456 | * Encode arguments to readdir call |
457 | */ | 457 | */ |
458 | static int | 458 | static int |
459 | nfs3_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_readdirargs *args) | 459 | nfs3_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirargs *args) |
460 | { | 460 | { |
461 | struct rpc_auth *auth = req->rq_task->tk_auth; | 461 | struct rpc_auth *auth = req->rq_task->tk_auth; |
462 | unsigned int replen; | 462 | unsigned int replen; |
@@ -485,7 +485,7 @@ nfs3_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_readdirargs *args | |||
485 | * We just check for syntactical correctness. | 485 | * We just check for syntactical correctness. |
486 | */ | 486 | */ |
487 | static int | 487 | static int |
488 | nfs3_xdr_readdirres(struct rpc_rqst *req, u32 *p, struct nfs3_readdirres *res) | 488 | nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res) |
489 | { | 489 | { |
490 | struct xdr_buf *rcvbuf = &req->rq_rcv_buf; | 490 | struct xdr_buf *rcvbuf = &req->rq_rcv_buf; |
491 | struct kvec *iov = rcvbuf->head; | 491 | struct kvec *iov = rcvbuf->head; |
@@ -493,7 +493,7 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, u32 *p, struct nfs3_readdirres *res) | |||
493 | int hdrlen, recvd; | 493 | int hdrlen, recvd; |
494 | int status, nr; | 494 | int status, nr; |
495 | unsigned int len, pglen; | 495 | unsigned int len, pglen; |
496 | u32 *entry, *end, *kaddr; | 496 | __be32 *entry, *end, *kaddr; |
497 | 497 | ||
498 | status = ntohl(*p++); | 498 | status = ntohl(*p++); |
499 | /* Decode post_op_attrs */ | 499 | /* Decode post_op_attrs */ |
@@ -523,8 +523,8 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, u32 *p, struct nfs3_readdirres *res) | |||
523 | if (pglen > recvd) | 523 | if (pglen > recvd) |
524 | pglen = recvd; | 524 | pglen = recvd; |
525 | page = rcvbuf->pages; | 525 | page = rcvbuf->pages; |
526 | kaddr = p = (u32 *)kmap_atomic(*page, KM_USER0); | 526 | kaddr = p = kmap_atomic(*page, KM_USER0); |
527 | end = (u32 *)((char *)p + pglen); | 527 | end = (__be32 *)((char *)p + pglen); |
528 | entry = p; | 528 | entry = p; |
529 | for (nr = 0; *p++; nr++) { | 529 | for (nr = 0; *p++; nr++) { |
530 | if (p + 3 > end) | 530 | if (p + 3 > end) |
@@ -583,8 +583,8 @@ err_unmap: | |||
583 | goto out; | 583 | goto out; |
584 | } | 584 | } |
585 | 585 | ||
586 | u32 * | 586 | __be32 * |
587 | nfs3_decode_dirent(u32 *p, struct nfs_entry *entry, int plus) | 587 | nfs3_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus) |
588 | { | 588 | { |
589 | struct nfs_entry old = *entry; | 589 | struct nfs_entry old = *entry; |
590 | 590 | ||
@@ -626,7 +626,7 @@ nfs3_decode_dirent(u32 *p, struct nfs_entry *entry, int plus) | |||
626 | * Encode COMMIT arguments | 626 | * Encode COMMIT arguments |
627 | */ | 627 | */ |
628 | static int | 628 | static int |
629 | nfs3_xdr_commitargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) | 629 | nfs3_xdr_commitargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args) |
630 | { | 630 | { |
631 | p = xdr_encode_fhandle(p, args->fh); | 631 | p = xdr_encode_fhandle(p, args->fh); |
632 | p = xdr_encode_hyper(p, args->offset); | 632 | p = xdr_encode_hyper(p, args->offset); |
@@ -640,7 +640,7 @@ nfs3_xdr_commitargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) | |||
640 | * Encode GETACL arguments | 640 | * Encode GETACL arguments |
641 | */ | 641 | */ |
642 | static int | 642 | static int |
643 | nfs3_xdr_getaclargs(struct rpc_rqst *req, u32 *p, | 643 | nfs3_xdr_getaclargs(struct rpc_rqst *req, __be32 *p, |
644 | struct nfs3_getaclargs *args) | 644 | struct nfs3_getaclargs *args) |
645 | { | 645 | { |
646 | struct rpc_auth *auth = req->rq_task->tk_auth; | 646 | struct rpc_auth *auth = req->rq_task->tk_auth; |
@@ -664,7 +664,7 @@ nfs3_xdr_getaclargs(struct rpc_rqst *req, u32 *p, | |||
664 | * Encode SETACL arguments | 664 | * Encode SETACL arguments |
665 | */ | 665 | */ |
666 | static int | 666 | static int |
667 | nfs3_xdr_setaclargs(struct rpc_rqst *req, u32 *p, | 667 | nfs3_xdr_setaclargs(struct rpc_rqst *req, __be32 *p, |
668 | struct nfs3_setaclargs *args) | 668 | struct nfs3_setaclargs *args) |
669 | { | 669 | { |
670 | struct xdr_buf *buf = &req->rq_snd_buf; | 670 | struct xdr_buf *buf = &req->rq_snd_buf; |
@@ -711,7 +711,7 @@ nfs3_xdr_setaclargs(struct rpc_rqst *req, u32 *p, | |||
711 | * Decode attrstat reply. | 711 | * Decode attrstat reply. |
712 | */ | 712 | */ |
713 | static int | 713 | static int |
714 | nfs3_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) | 714 | nfs3_xdr_attrstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr) |
715 | { | 715 | { |
716 | int status; | 716 | int status; |
717 | 717 | ||
@@ -726,7 +726,7 @@ nfs3_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) | |||
726 | * SATTR, REMOVE, RMDIR | 726 | * SATTR, REMOVE, RMDIR |
727 | */ | 727 | */ |
728 | static int | 728 | static int |
729 | nfs3_xdr_wccstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) | 729 | nfs3_xdr_wccstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr) |
730 | { | 730 | { |
731 | int status; | 731 | int status; |
732 | 732 | ||
@@ -740,7 +740,7 @@ nfs3_xdr_wccstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) | |||
740 | * Decode LOOKUP reply | 740 | * Decode LOOKUP reply |
741 | */ | 741 | */ |
742 | static int | 742 | static int |
743 | nfs3_xdr_lookupres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res) | 743 | nfs3_xdr_lookupres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res) |
744 | { | 744 | { |
745 | int status; | 745 | int status; |
746 | 746 | ||
@@ -759,7 +759,7 @@ nfs3_xdr_lookupres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res) | |||
759 | * Decode ACCESS reply | 759 | * Decode ACCESS reply |
760 | */ | 760 | */ |
761 | static int | 761 | static int |
762 | nfs3_xdr_accessres(struct rpc_rqst *req, u32 *p, struct nfs3_accessres *res) | 762 | nfs3_xdr_accessres(struct rpc_rqst *req, __be32 *p, struct nfs3_accessres *res) |
763 | { | 763 | { |
764 | int status = ntohl(*p++); | 764 | int status = ntohl(*p++); |
765 | 765 | ||
@@ -771,7 +771,7 @@ nfs3_xdr_accessres(struct rpc_rqst *req, u32 *p, struct nfs3_accessres *res) | |||
771 | } | 771 | } |
772 | 772 | ||
773 | static int | 773 | static int |
774 | nfs3_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_readlinkargs *args) | 774 | nfs3_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readlinkargs *args) |
775 | { | 775 | { |
776 | struct rpc_auth *auth = req->rq_task->tk_auth; | 776 | struct rpc_auth *auth = req->rq_task->tk_auth; |
777 | unsigned int replen; | 777 | unsigned int replen; |
@@ -789,7 +789,7 @@ nfs3_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_readlinkargs *ar | |||
789 | * Decode READLINK reply | 789 | * Decode READLINK reply |
790 | */ | 790 | */ |
791 | static int | 791 | static int |
792 | nfs3_xdr_readlinkres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) | 792 | nfs3_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr) |
793 | { | 793 | { |
794 | struct xdr_buf *rcvbuf = &req->rq_rcv_buf; | 794 | struct xdr_buf *rcvbuf = &req->rq_rcv_buf; |
795 | struct kvec *iov = rcvbuf->head; | 795 | struct kvec *iov = rcvbuf->head; |
@@ -837,7 +837,7 @@ nfs3_xdr_readlinkres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) | |||
837 | * Decode READ reply | 837 | * Decode READ reply |
838 | */ | 838 | */ |
839 | static int | 839 | static int |
840 | nfs3_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res) | 840 | nfs3_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res) |
841 | { | 841 | { |
842 | struct kvec *iov = req->rq_rcv_buf.head; | 842 | struct kvec *iov = req->rq_rcv_buf.head; |
843 | int status, count, ocount, recvd, hdrlen; | 843 | int status, count, ocount, recvd, hdrlen; |
@@ -888,7 +888,7 @@ nfs3_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res) | |||
888 | * Decode WRITE response | 888 | * Decode WRITE response |
889 | */ | 889 | */ |
890 | static int | 890 | static int |
891 | nfs3_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) | 891 | nfs3_xdr_writeres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res) |
892 | { | 892 | { |
893 | int status; | 893 | int status; |
894 | 894 | ||
@@ -910,7 +910,7 @@ nfs3_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) | |||
910 | * Decode a CREATE response | 910 | * Decode a CREATE response |
911 | */ | 911 | */ |
912 | static int | 912 | static int |
913 | nfs3_xdr_createres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res) | 913 | nfs3_xdr_createres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res) |
914 | { | 914 | { |
915 | int status; | 915 | int status; |
916 | 916 | ||
@@ -937,7 +937,7 @@ nfs3_xdr_createres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res) | |||
937 | * Decode RENAME reply | 937 | * Decode RENAME reply |
938 | */ | 938 | */ |
939 | static int | 939 | static int |
940 | nfs3_xdr_renameres(struct rpc_rqst *req, u32 *p, struct nfs3_renameres *res) | 940 | nfs3_xdr_renameres(struct rpc_rqst *req, __be32 *p, struct nfs3_renameres *res) |
941 | { | 941 | { |
942 | int status; | 942 | int status; |
943 | 943 | ||
@@ -952,7 +952,7 @@ nfs3_xdr_renameres(struct rpc_rqst *req, u32 *p, struct nfs3_renameres *res) | |||
952 | * Decode LINK reply | 952 | * Decode LINK reply |
953 | */ | 953 | */ |
954 | static int | 954 | static int |
955 | nfs3_xdr_linkres(struct rpc_rqst *req, u32 *p, struct nfs3_linkres *res) | 955 | nfs3_xdr_linkres(struct rpc_rqst *req, __be32 *p, struct nfs3_linkres *res) |
956 | { | 956 | { |
957 | int status; | 957 | int status; |
958 | 958 | ||
@@ -967,7 +967,7 @@ nfs3_xdr_linkres(struct rpc_rqst *req, u32 *p, struct nfs3_linkres *res) | |||
967 | * Decode FSSTAT reply | 967 | * Decode FSSTAT reply |
968 | */ | 968 | */ |
969 | static int | 969 | static int |
970 | nfs3_xdr_fsstatres(struct rpc_rqst *req, u32 *p, struct nfs_fsstat *res) | 970 | nfs3_xdr_fsstatres(struct rpc_rqst *req, __be32 *p, struct nfs_fsstat *res) |
971 | { | 971 | { |
972 | int status; | 972 | int status; |
973 | 973 | ||
@@ -992,7 +992,7 @@ nfs3_xdr_fsstatres(struct rpc_rqst *req, u32 *p, struct nfs_fsstat *res) | |||
992 | * Decode FSINFO reply | 992 | * Decode FSINFO reply |
993 | */ | 993 | */ |
994 | static int | 994 | static int |
995 | nfs3_xdr_fsinfores(struct rpc_rqst *req, u32 *p, struct nfs_fsinfo *res) | 995 | nfs3_xdr_fsinfores(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *res) |
996 | { | 996 | { |
997 | int status; | 997 | int status; |
998 | 998 | ||
@@ -1020,7 +1020,7 @@ nfs3_xdr_fsinfores(struct rpc_rqst *req, u32 *p, struct nfs_fsinfo *res) | |||
1020 | * Decode PATHCONF reply | 1020 | * Decode PATHCONF reply |
1021 | */ | 1021 | */ |
1022 | static int | 1022 | static int |
1023 | nfs3_xdr_pathconfres(struct rpc_rqst *req, u32 *p, struct nfs_pathconf *res) | 1023 | nfs3_xdr_pathconfres(struct rpc_rqst *req, __be32 *p, struct nfs_pathconf *res) |
1024 | { | 1024 | { |
1025 | int status; | 1025 | int status; |
1026 | 1026 | ||
@@ -1040,7 +1040,7 @@ nfs3_xdr_pathconfres(struct rpc_rqst *req, u32 *p, struct nfs_pathconf *res) | |||
1040 | * Decode COMMIT reply | 1040 | * Decode COMMIT reply |
1041 | */ | 1041 | */ |
1042 | static int | 1042 | static int |
1043 | nfs3_xdr_commitres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) | 1043 | nfs3_xdr_commitres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res) |
1044 | { | 1044 | { |
1045 | int status; | 1045 | int status; |
1046 | 1046 | ||
@@ -1059,7 +1059,7 @@ nfs3_xdr_commitres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) | |||
1059 | * Decode GETACL reply | 1059 | * Decode GETACL reply |
1060 | */ | 1060 | */ |
1061 | static int | 1061 | static int |
1062 | nfs3_xdr_getaclres(struct rpc_rqst *req, u32 *p, | 1062 | nfs3_xdr_getaclres(struct rpc_rqst *req, __be32 *p, |
1063 | struct nfs3_getaclres *res) | 1063 | struct nfs3_getaclres *res) |
1064 | { | 1064 | { |
1065 | struct xdr_buf *buf = &req->rq_rcv_buf; | 1065 | struct xdr_buf *buf = &req->rq_rcv_buf; |
@@ -1091,7 +1091,7 @@ nfs3_xdr_getaclres(struct rpc_rqst *req, u32 *p, | |||
1091 | * Decode setacl reply. | 1091 | * Decode setacl reply. |
1092 | */ | 1092 | */ |
1093 | static int | 1093 | static int |
1094 | nfs3_xdr_setaclres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) | 1094 | nfs3_xdr_setaclres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr) |
1095 | { | 1095 | { |
1096 | int status = ntohl(*p++); | 1096 | int status = ntohl(*p++); |
1097 | 1097 | ||
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 61095fe4b5ca..c26cd978c7cc 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -185,7 +185,7 @@ extern const u32 nfs4_fs_locations_bitmap[2]; | |||
185 | extern void nfs4_schedule_state_renewal(struct nfs_client *); | 185 | extern void nfs4_schedule_state_renewal(struct nfs_client *); |
186 | extern void nfs4_renewd_prepare_shutdown(struct nfs_server *); | 186 | extern void nfs4_renewd_prepare_shutdown(struct nfs_server *); |
187 | extern void nfs4_kill_renewd(struct nfs_client *); | 187 | extern void nfs4_kill_renewd(struct nfs_client *); |
188 | extern void nfs4_renew_state(void *); | 188 | extern void nfs4_renew_state(struct work_struct *); |
189 | 189 | ||
190 | /* nfs4state.c */ | 190 | /* nfs4state.c */ |
191 | struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp); | 191 | struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp); |
@@ -212,7 +212,7 @@ extern void nfs_free_seqid(struct nfs_seqid *seqid); | |||
212 | extern const nfs4_stateid zero_stateid; | 212 | extern const nfs4_stateid zero_stateid; |
213 | 213 | ||
214 | /* nfs4xdr.c */ | 214 | /* nfs4xdr.c */ |
215 | extern uint32_t *nfs4_decode_dirent(uint32_t *p, struct nfs_entry *entry, int plus); | 215 | extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus); |
216 | extern struct rpc_procinfo nfs4_procedures[]; | 216 | extern struct rpc_procinfo nfs4_procedures[]; |
217 | 217 | ||
218 | struct nfs4_mount_data; | 218 | struct nfs4_mount_data; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 47c7e6e3910d..ee458aeab24a 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -138,10 +138,10 @@ const u32 nfs4_fs_locations_bitmap[2] = { | |||
138 | | FATTR4_WORD1_MOUNTED_ON_FILEID | 138 | | FATTR4_WORD1_MOUNTED_ON_FILEID |
139 | }; | 139 | }; |
140 | 140 | ||
141 | static void nfs4_setup_readdir(u64 cookie, u32 *verifier, struct dentry *dentry, | 141 | static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dentry, |
142 | struct nfs4_readdir_arg *readdir) | 142 | struct nfs4_readdir_arg *readdir) |
143 | { | 143 | { |
144 | u32 *start, *p; | 144 | __be32 *start, *p; |
145 | 145 | ||
146 | BUG_ON(readdir->count < 80); | 146 | BUG_ON(readdir->count < 80); |
147 | if (cookie > 2) { | 147 | if (cookie > 2) { |
@@ -162,7 +162,7 @@ static void nfs4_setup_readdir(u64 cookie, u32 *verifier, struct dentry *dentry, | |||
162 | * when talking to the server, we always send cookie 0 | 162 | * when talking to the server, we always send cookie 0 |
163 | * instead of 1 or 2. | 163 | * instead of 1 or 2. |
164 | */ | 164 | */ |
165 | start = p = (u32 *)kmap_atomic(*readdir->pages, KM_USER0); | 165 | start = p = kmap_atomic(*readdir->pages, KM_USER0); |
166 | 166 | ||
167 | if (cookie == 0) { | 167 | if (cookie == 0) { |
168 | *p++ = xdr_one; /* next */ | 168 | *p++ = xdr_one; /* next */ |
@@ -636,7 +636,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data) | |||
636 | smp_wmb(); | 636 | smp_wmb(); |
637 | } else | 637 | } else |
638 | status = data->rpc_status; | 638 | status = data->rpc_status; |
639 | rpc_release_task(task); | 639 | rpc_put_task(task); |
640 | return status; | 640 | return status; |
641 | } | 641 | } |
642 | 642 | ||
@@ -742,7 +742,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data) | |||
742 | smp_wmb(); | 742 | smp_wmb(); |
743 | } else | 743 | } else |
744 | status = data->rpc_status; | 744 | status = data->rpc_status; |
745 | rpc_release_task(task); | 745 | rpc_put_task(task); |
746 | if (status != 0) | 746 | if (status != 0) |
747 | return status; | 747 | return status; |
748 | 748 | ||
@@ -1314,11 +1314,9 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st | |||
1314 | case -EROFS: | 1314 | case -EROFS: |
1315 | lookup_instantiate_filp(nd, (struct dentry *)state, NULL); | 1315 | lookup_instantiate_filp(nd, (struct dentry *)state, NULL); |
1316 | return 1; | 1316 | return 1; |
1317 | case -ENOENT: | 1317 | default: |
1318 | if (dentry->d_inode == NULL) | 1318 | goto out_drop; |
1319 | return 1; | ||
1320 | } | 1319 | } |
1321 | goto out_drop; | ||
1322 | } | 1320 | } |
1323 | if (state->inode == dentry->d_inode) { | 1321 | if (state->inode == dentry->d_inode) { |
1324 | nfs4_intent_set_file(nd, dentry, state); | 1322 | nfs4_intent_set_file(nd, dentry, state); |
@@ -1777,89 +1775,6 @@ static int nfs4_proc_read(struct nfs_read_data *rdata) | |||
1777 | return err; | 1775 | return err; |
1778 | } | 1776 | } |
1779 | 1777 | ||
1780 | static int _nfs4_proc_write(struct nfs_write_data *wdata) | ||
1781 | { | ||
1782 | int rpcflags = wdata->flags; | ||
1783 | struct inode *inode = wdata->inode; | ||
1784 | struct nfs_fattr *fattr = wdata->res.fattr; | ||
1785 | struct nfs_server *server = NFS_SERVER(inode); | ||
1786 | struct rpc_message msg = { | ||
1787 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE], | ||
1788 | .rpc_argp = &wdata->args, | ||
1789 | .rpc_resp = &wdata->res, | ||
1790 | .rpc_cred = wdata->cred, | ||
1791 | }; | ||
1792 | int status; | ||
1793 | |||
1794 | dprintk("NFS call write %d @ %Ld\n", wdata->args.count, | ||
1795 | (long long) wdata->args.offset); | ||
1796 | |||
1797 | wdata->args.bitmask = server->attr_bitmask; | ||
1798 | wdata->res.server = server; | ||
1799 | wdata->timestamp = jiffies; | ||
1800 | nfs_fattr_init(fattr); | ||
1801 | status = rpc_call_sync(server->client, &msg, rpcflags); | ||
1802 | dprintk("NFS reply write: %d\n", status); | ||
1803 | if (status < 0) | ||
1804 | return status; | ||
1805 | renew_lease(server, wdata->timestamp); | ||
1806 | nfs_post_op_update_inode(inode, fattr); | ||
1807 | return wdata->res.count; | ||
1808 | } | ||
1809 | |||
1810 | static int nfs4_proc_write(struct nfs_write_data *wdata) | ||
1811 | { | ||
1812 | struct nfs4_exception exception = { }; | ||
1813 | int err; | ||
1814 | do { | ||
1815 | err = nfs4_handle_exception(NFS_SERVER(wdata->inode), | ||
1816 | _nfs4_proc_write(wdata), | ||
1817 | &exception); | ||
1818 | } while (exception.retry); | ||
1819 | return err; | ||
1820 | } | ||
1821 | |||
1822 | static int _nfs4_proc_commit(struct nfs_write_data *cdata) | ||
1823 | { | ||
1824 | struct inode *inode = cdata->inode; | ||
1825 | struct nfs_fattr *fattr = cdata->res.fattr; | ||
1826 | struct nfs_server *server = NFS_SERVER(inode); | ||
1827 | struct rpc_message msg = { | ||
1828 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT], | ||
1829 | .rpc_argp = &cdata->args, | ||
1830 | .rpc_resp = &cdata->res, | ||
1831 | .rpc_cred = cdata->cred, | ||
1832 | }; | ||
1833 | int status; | ||
1834 | |||
1835 | dprintk("NFS call commit %d @ %Ld\n", cdata->args.count, | ||
1836 | (long long) cdata->args.offset); | ||
1837 | |||
1838 | cdata->args.bitmask = server->attr_bitmask; | ||
1839 | cdata->res.server = server; | ||
1840 | cdata->timestamp = jiffies; | ||
1841 | nfs_fattr_init(fattr); | ||
1842 | status = rpc_call_sync(server->client, &msg, 0); | ||
1843 | if (status >= 0) | ||
1844 | renew_lease(server, cdata->timestamp); | ||
1845 | dprintk("NFS reply commit: %d\n", status); | ||
1846 | if (status >= 0) | ||
1847 | nfs_post_op_update_inode(inode, fattr); | ||
1848 | return status; | ||
1849 | } | ||
1850 | |||
1851 | static int nfs4_proc_commit(struct nfs_write_data *cdata) | ||
1852 | { | ||
1853 | struct nfs4_exception exception = { }; | ||
1854 | int err; | ||
1855 | do { | ||
1856 | err = nfs4_handle_exception(NFS_SERVER(cdata->inode), | ||
1857 | _nfs4_proc_commit(cdata), | ||
1858 | &exception); | ||
1859 | } while (exception.retry); | ||
1860 | return err; | ||
1861 | } | ||
1862 | |||
1863 | /* | 1778 | /* |
1864 | * Got race? | 1779 | * Got race? |
1865 | * We will need to arrange for the VFS layer to provide an atomic open. | 1780 | * We will need to arrange for the VFS layer to provide an atomic open. |
@@ -2225,13 +2140,11 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | |||
2225 | dentry->d_parent->d_name.name, | 2140 | dentry->d_parent->d_name.name, |
2226 | dentry->d_name.name, | 2141 | dentry->d_name.name, |
2227 | (unsigned long long)cookie); | 2142 | (unsigned long long)cookie); |
2228 | lock_kernel(); | ||
2229 | nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args); | 2143 | nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args); |
2230 | res.pgbase = args.pgbase; | 2144 | res.pgbase = args.pgbase; |
2231 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); | 2145 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); |
2232 | if (status == 0) | 2146 | if (status == 0) |
2233 | memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE); | 2147 | memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE); |
2234 | unlock_kernel(); | ||
2235 | dprintk("%s: returns %d\n", __FUNCTION__, status); | 2148 | dprintk("%s: returns %d\n", __FUNCTION__, status); |
2236 | return status; | 2149 | return status; |
2237 | } | 2150 | } |
@@ -2917,11 +2830,11 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, unsigned short po | |||
2917 | .rpc_resp = clp, | 2830 | .rpc_resp = clp, |
2918 | .rpc_cred = cred, | 2831 | .rpc_cred = cred, |
2919 | }; | 2832 | }; |
2920 | u32 *p; | 2833 | __be32 *p; |
2921 | int loop = 0; | 2834 | int loop = 0; |
2922 | int status; | 2835 | int status; |
2923 | 2836 | ||
2924 | p = (u32*)sc_verifier.data; | 2837 | p = (__be32*)sc_verifier.data; |
2925 | *p++ = htonl((u32)clp->cl_boot_time.tv_sec); | 2838 | *p++ = htonl((u32)clp->cl_boot_time.tv_sec); |
2926 | *p = htonl((u32)clp->cl_boot_time.tv_nsec); | 2839 | *p = htonl((u32)clp->cl_boot_time.tv_nsec); |
2927 | 2840 | ||
@@ -3069,7 +2982,7 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co | |||
3069 | if (status == 0) | 2982 | if (status == 0) |
3070 | nfs_post_op_update_inode(inode, &data->fattr); | 2983 | nfs_post_op_update_inode(inode, &data->fattr); |
3071 | } | 2984 | } |
3072 | rpc_release_task(task); | 2985 | rpc_put_task(task); |
3073 | return status; | 2986 | return status; |
3074 | } | 2987 | } |
3075 | 2988 | ||
@@ -3316,7 +3229,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock * | |||
3316 | if (IS_ERR(task)) | 3229 | if (IS_ERR(task)) |
3317 | goto out; | 3230 | goto out; |
3318 | status = nfs4_wait_for_completion_rpc_task(task); | 3231 | status = nfs4_wait_for_completion_rpc_task(task); |
3319 | rpc_release_task(task); | 3232 | rpc_put_task(task); |
3320 | out: | 3233 | out: |
3321 | return status; | 3234 | return status; |
3322 | } | 3235 | } |
@@ -3432,7 +3345,7 @@ static void nfs4_lock_release(void *calldata) | |||
3432 | task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp, | 3345 | task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp, |
3433 | data->arg.lock_seqid); | 3346 | data->arg.lock_seqid); |
3434 | if (!IS_ERR(task)) | 3347 | if (!IS_ERR(task)) |
3435 | rpc_release_task(task); | 3348 | rpc_put_task(task); |
3436 | dprintk("%s: cancelling lock!\n", __FUNCTION__); | 3349 | dprintk("%s: cancelling lock!\n", __FUNCTION__); |
3437 | } else | 3350 | } else |
3438 | nfs_free_seqid(data->arg.lock_seqid); | 3351 | nfs_free_seqid(data->arg.lock_seqid); |
@@ -3474,7 +3387,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f | |||
3474 | ret = -EAGAIN; | 3387 | ret = -EAGAIN; |
3475 | } else | 3388 | } else |
3476 | data->cancelled = 1; | 3389 | data->cancelled = 1; |
3477 | rpc_release_task(task); | 3390 | rpc_put_task(task); |
3478 | dprintk("%s: done, ret = %d!\n", __FUNCTION__, ret); | 3391 | dprintk("%s: done, ret = %d!\n", __FUNCTION__, ret); |
3479 | return ret; | 3392 | return ret; |
3480 | } | 3393 | } |
@@ -3734,8 +3647,6 @@ const struct nfs_rpc_ops nfs_v4_clientops = { | |||
3734 | .access = nfs4_proc_access, | 3647 | .access = nfs4_proc_access, |
3735 | .readlink = nfs4_proc_readlink, | 3648 | .readlink = nfs4_proc_readlink, |
3736 | .read = nfs4_proc_read, | 3649 | .read = nfs4_proc_read, |
3737 | .write = nfs4_proc_write, | ||
3738 | .commit = nfs4_proc_commit, | ||
3739 | .create = nfs4_proc_create, | 3650 | .create = nfs4_proc_create, |
3740 | .remove = nfs4_proc_remove, | 3651 | .remove = nfs4_proc_remove, |
3741 | .unlink_setup = nfs4_proc_unlink_setup, | 3652 | .unlink_setup = nfs4_proc_unlink_setup, |
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c index 7b6df1852e75..823298561c0a 100644 --- a/fs/nfs/nfs4renewd.c +++ b/fs/nfs/nfs4renewd.c | |||
@@ -59,9 +59,10 @@ | |||
59 | #define NFSDBG_FACILITY NFSDBG_PROC | 59 | #define NFSDBG_FACILITY NFSDBG_PROC |
60 | 60 | ||
61 | void | 61 | void |
62 | nfs4_renew_state(void *data) | 62 | nfs4_renew_state(struct work_struct *work) |
63 | { | 63 | { |
64 | struct nfs_client *clp = (struct nfs_client *)data; | 64 | struct nfs_client *clp = |
65 | container_of(work, struct nfs_client, cl_renewd.work); | ||
65 | struct rpc_cred *cred; | 66 | struct rpc_cred *cred; |
66 | long lease, timeout; | 67 | long lease, timeout; |
67 | unsigned long last, now; | 68 | unsigned long last, now; |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 3dd413f52da1..0cf3fa312a33 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -471,7 +471,7 @@ struct compound_hdr { | |||
471 | 471 | ||
472 | static void encode_string(struct xdr_stream *xdr, unsigned int len, const char *str) | 472 | static void encode_string(struct xdr_stream *xdr, unsigned int len, const char *str) |
473 | { | 473 | { |
474 | uint32_t *p; | 474 | __be32 *p; |
475 | 475 | ||
476 | p = xdr_reserve_space(xdr, 4 + len); | 476 | p = xdr_reserve_space(xdr, 4 + len); |
477 | BUG_ON(p == NULL); | 477 | BUG_ON(p == NULL); |
@@ -480,7 +480,7 @@ static void encode_string(struct xdr_stream *xdr, unsigned int len, const char * | |||
480 | 480 | ||
481 | static int encode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) | 481 | static int encode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) |
482 | { | 482 | { |
483 | uint32_t *p; | 483 | __be32 *p; |
484 | 484 | ||
485 | dprintk("encode_compound: tag=%.*s\n", (int)hdr->taglen, hdr->tag); | 485 | dprintk("encode_compound: tag=%.*s\n", (int)hdr->taglen, hdr->tag); |
486 | BUG_ON(hdr->taglen > NFS4_MAXTAGLEN); | 486 | BUG_ON(hdr->taglen > NFS4_MAXTAGLEN); |
@@ -494,7 +494,7 @@ static int encode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) | |||
494 | 494 | ||
495 | static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *verf) | 495 | static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *verf) |
496 | { | 496 | { |
497 | uint32_t *p; | 497 | __be32 *p; |
498 | 498 | ||
499 | p = xdr_reserve_space(xdr, NFS4_VERIFIER_SIZE); | 499 | p = xdr_reserve_space(xdr, NFS4_VERIFIER_SIZE); |
500 | BUG_ON(p == NULL); | 500 | BUG_ON(p == NULL); |
@@ -507,8 +507,8 @@ static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const s | |||
507 | char owner_group[IDMAP_NAMESZ]; | 507 | char owner_group[IDMAP_NAMESZ]; |
508 | int owner_namelen = 0; | 508 | int owner_namelen = 0; |
509 | int owner_grouplen = 0; | 509 | int owner_grouplen = 0; |
510 | uint32_t *p; | 510 | __be32 *p; |
511 | uint32_t *q; | 511 | __be32 *q; |
512 | int len; | 512 | int len; |
513 | uint32_t bmval0 = 0; | 513 | uint32_t bmval0 = 0; |
514 | uint32_t bmval1 = 0; | 514 | uint32_t bmval1 = 0; |
@@ -630,7 +630,7 @@ static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const s | |||
630 | 630 | ||
631 | static int encode_access(struct xdr_stream *xdr, u32 access) | 631 | static int encode_access(struct xdr_stream *xdr, u32 access) |
632 | { | 632 | { |
633 | uint32_t *p; | 633 | __be32 *p; |
634 | 634 | ||
635 | RESERVE_SPACE(8); | 635 | RESERVE_SPACE(8); |
636 | WRITE32(OP_ACCESS); | 636 | WRITE32(OP_ACCESS); |
@@ -641,7 +641,7 @@ static int encode_access(struct xdr_stream *xdr, u32 access) | |||
641 | 641 | ||
642 | static int encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg) | 642 | static int encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg) |
643 | { | 643 | { |
644 | uint32_t *p; | 644 | __be32 *p; |
645 | 645 | ||
646 | RESERVE_SPACE(8+sizeof(arg->stateid->data)); | 646 | RESERVE_SPACE(8+sizeof(arg->stateid->data)); |
647 | WRITE32(OP_CLOSE); | 647 | WRITE32(OP_CLOSE); |
@@ -653,7 +653,7 @@ static int encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg) | |||
653 | 653 | ||
654 | static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *args) | 654 | static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *args) |
655 | { | 655 | { |
656 | uint32_t *p; | 656 | __be32 *p; |
657 | 657 | ||
658 | RESERVE_SPACE(16); | 658 | RESERVE_SPACE(16); |
659 | WRITE32(OP_COMMIT); | 659 | WRITE32(OP_COMMIT); |
@@ -665,7 +665,7 @@ static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *arg | |||
665 | 665 | ||
666 | static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create) | 666 | static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create) |
667 | { | 667 | { |
668 | uint32_t *p; | 668 | __be32 *p; |
669 | 669 | ||
670 | RESERVE_SPACE(8); | 670 | RESERVE_SPACE(8); |
671 | WRITE32(OP_CREATE); | 671 | WRITE32(OP_CREATE); |
@@ -697,7 +697,7 @@ static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *c | |||
697 | 697 | ||
698 | static int encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap) | 698 | static int encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap) |
699 | { | 699 | { |
700 | uint32_t *p; | 700 | __be32 *p; |
701 | 701 | ||
702 | RESERVE_SPACE(12); | 702 | RESERVE_SPACE(12); |
703 | WRITE32(OP_GETATTR); | 703 | WRITE32(OP_GETATTR); |
@@ -708,7 +708,7 @@ static int encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap) | |||
708 | 708 | ||
709 | static int encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1) | 709 | static int encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1) |
710 | { | 710 | { |
711 | uint32_t *p; | 711 | __be32 *p; |
712 | 712 | ||
713 | RESERVE_SPACE(16); | 713 | RESERVE_SPACE(16); |
714 | WRITE32(OP_GETATTR); | 714 | WRITE32(OP_GETATTR); |
@@ -740,7 +740,7 @@ static int encode_fs_locations(struct xdr_stream *xdr, const u32* bitmask) | |||
740 | 740 | ||
741 | static int encode_getfh(struct xdr_stream *xdr) | 741 | static int encode_getfh(struct xdr_stream *xdr) |
742 | { | 742 | { |
743 | uint32_t *p; | 743 | __be32 *p; |
744 | 744 | ||
745 | RESERVE_SPACE(4); | 745 | RESERVE_SPACE(4); |
746 | WRITE32(OP_GETFH); | 746 | WRITE32(OP_GETFH); |
@@ -750,7 +750,7 @@ static int encode_getfh(struct xdr_stream *xdr) | |||
750 | 750 | ||
751 | static int encode_link(struct xdr_stream *xdr, const struct qstr *name) | 751 | static int encode_link(struct xdr_stream *xdr, const struct qstr *name) |
752 | { | 752 | { |
753 | uint32_t *p; | 753 | __be32 *p; |
754 | 754 | ||
755 | RESERVE_SPACE(8 + name->len); | 755 | RESERVE_SPACE(8 + name->len); |
756 | WRITE32(OP_LINK); | 756 | WRITE32(OP_LINK); |
@@ -780,7 +780,7 @@ static inline uint64_t nfs4_lock_length(struct file_lock *fl) | |||
780 | */ | 780 | */ |
781 | static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args) | 781 | static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args) |
782 | { | 782 | { |
783 | uint32_t *p; | 783 | __be32 *p; |
784 | 784 | ||
785 | RESERVE_SPACE(32); | 785 | RESERVE_SPACE(32); |
786 | WRITE32(OP_LOCK); | 786 | WRITE32(OP_LOCK); |
@@ -809,7 +809,7 @@ static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args) | |||
809 | 809 | ||
810 | static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *args) | 810 | static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *args) |
811 | { | 811 | { |
812 | uint32_t *p; | 812 | __be32 *p; |
813 | 813 | ||
814 | RESERVE_SPACE(40); | 814 | RESERVE_SPACE(40); |
815 | WRITE32(OP_LOCKT); | 815 | WRITE32(OP_LOCKT); |
@@ -825,7 +825,7 @@ static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *arg | |||
825 | 825 | ||
826 | static int encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *args) | 826 | static int encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *args) |
827 | { | 827 | { |
828 | uint32_t *p; | 828 | __be32 *p; |
829 | 829 | ||
830 | RESERVE_SPACE(44); | 830 | RESERVE_SPACE(44); |
831 | WRITE32(OP_LOCKU); | 831 | WRITE32(OP_LOCKU); |
@@ -841,7 +841,7 @@ static int encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *arg | |||
841 | static int encode_lookup(struct xdr_stream *xdr, const struct qstr *name) | 841 | static int encode_lookup(struct xdr_stream *xdr, const struct qstr *name) |
842 | { | 842 | { |
843 | int len = name->len; | 843 | int len = name->len; |
844 | uint32_t *p; | 844 | __be32 *p; |
845 | 845 | ||
846 | RESERVE_SPACE(8 + len); | 846 | RESERVE_SPACE(8 + len); |
847 | WRITE32(OP_LOOKUP); | 847 | WRITE32(OP_LOOKUP); |
@@ -853,7 +853,7 @@ static int encode_lookup(struct xdr_stream *xdr, const struct qstr *name) | |||
853 | 853 | ||
854 | static void encode_share_access(struct xdr_stream *xdr, int open_flags) | 854 | static void encode_share_access(struct xdr_stream *xdr, int open_flags) |
855 | { | 855 | { |
856 | uint32_t *p; | 856 | __be32 *p; |
857 | 857 | ||
858 | RESERVE_SPACE(8); | 858 | RESERVE_SPACE(8); |
859 | switch (open_flags & (FMODE_READ|FMODE_WRITE)) { | 859 | switch (open_flags & (FMODE_READ|FMODE_WRITE)) { |
@@ -874,7 +874,7 @@ static void encode_share_access(struct xdr_stream *xdr, int open_flags) | |||
874 | 874 | ||
875 | static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_openargs *arg) | 875 | static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_openargs *arg) |
876 | { | 876 | { |
877 | uint32_t *p; | 877 | __be32 *p; |
878 | /* | 878 | /* |
879 | * opcode 4, seqid 4, share_access 4, share_deny 4, clientid 8, ownerlen 4, | 879 | * opcode 4, seqid 4, share_access 4, share_deny 4, clientid 8, ownerlen 4, |
880 | * owner 4 = 32 | 880 | * owner 4 = 32 |
@@ -891,7 +891,7 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena | |||
891 | 891 | ||
892 | static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) | 892 | static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) |
893 | { | 893 | { |
894 | uint32_t *p; | 894 | __be32 *p; |
895 | 895 | ||
896 | RESERVE_SPACE(4); | 896 | RESERVE_SPACE(4); |
897 | switch(arg->open_flags & O_EXCL) { | 897 | switch(arg->open_flags & O_EXCL) { |
@@ -907,7 +907,7 @@ static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_op | |||
907 | 907 | ||
908 | static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *arg) | 908 | static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *arg) |
909 | { | 909 | { |
910 | uint32_t *p; | 910 | __be32 *p; |
911 | 911 | ||
912 | RESERVE_SPACE(4); | 912 | RESERVE_SPACE(4); |
913 | switch (arg->open_flags & O_CREAT) { | 913 | switch (arg->open_flags & O_CREAT) { |
@@ -923,7 +923,7 @@ static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *a | |||
923 | 923 | ||
924 | static inline void encode_delegation_type(struct xdr_stream *xdr, int delegation_type) | 924 | static inline void encode_delegation_type(struct xdr_stream *xdr, int delegation_type) |
925 | { | 925 | { |
926 | uint32_t *p; | 926 | __be32 *p; |
927 | 927 | ||
928 | RESERVE_SPACE(4); | 928 | RESERVE_SPACE(4); |
929 | switch (delegation_type) { | 929 | switch (delegation_type) { |
@@ -943,7 +943,7 @@ static inline void encode_delegation_type(struct xdr_stream *xdr, int delegation | |||
943 | 943 | ||
944 | static inline void encode_claim_null(struct xdr_stream *xdr, const struct qstr *name) | 944 | static inline void encode_claim_null(struct xdr_stream *xdr, const struct qstr *name) |
945 | { | 945 | { |
946 | uint32_t *p; | 946 | __be32 *p; |
947 | 947 | ||
948 | RESERVE_SPACE(4); | 948 | RESERVE_SPACE(4); |
949 | WRITE32(NFS4_OPEN_CLAIM_NULL); | 949 | WRITE32(NFS4_OPEN_CLAIM_NULL); |
@@ -952,7 +952,7 @@ static inline void encode_claim_null(struct xdr_stream *xdr, const struct qstr * | |||
952 | 952 | ||
953 | static inline void encode_claim_previous(struct xdr_stream *xdr, int type) | 953 | static inline void encode_claim_previous(struct xdr_stream *xdr, int type) |
954 | { | 954 | { |
955 | uint32_t *p; | 955 | __be32 *p; |
956 | 956 | ||
957 | RESERVE_SPACE(4); | 957 | RESERVE_SPACE(4); |
958 | WRITE32(NFS4_OPEN_CLAIM_PREVIOUS); | 958 | WRITE32(NFS4_OPEN_CLAIM_PREVIOUS); |
@@ -961,7 +961,7 @@ static inline void encode_claim_previous(struct xdr_stream *xdr, int type) | |||
961 | 961 | ||
962 | static inline void encode_claim_delegate_cur(struct xdr_stream *xdr, const struct qstr *name, const nfs4_stateid *stateid) | 962 | static inline void encode_claim_delegate_cur(struct xdr_stream *xdr, const struct qstr *name, const nfs4_stateid *stateid) |
963 | { | 963 | { |
964 | uint32_t *p; | 964 | __be32 *p; |
965 | 965 | ||
966 | RESERVE_SPACE(4+sizeof(stateid->data)); | 966 | RESERVE_SPACE(4+sizeof(stateid->data)); |
967 | WRITE32(NFS4_OPEN_CLAIM_DELEGATE_CUR); | 967 | WRITE32(NFS4_OPEN_CLAIM_DELEGATE_CUR); |
@@ -991,7 +991,7 @@ static int encode_open(struct xdr_stream *xdr, const struct nfs_openargs *arg) | |||
991 | 991 | ||
992 | static int encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_confirmargs *arg) | 992 | static int encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_confirmargs *arg) |
993 | { | 993 | { |
994 | uint32_t *p; | 994 | __be32 *p; |
995 | 995 | ||
996 | RESERVE_SPACE(8+sizeof(arg->stateid->data)); | 996 | RESERVE_SPACE(8+sizeof(arg->stateid->data)); |
997 | WRITE32(OP_OPEN_CONFIRM); | 997 | WRITE32(OP_OPEN_CONFIRM); |
@@ -1003,7 +1003,7 @@ static int encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_con | |||
1003 | 1003 | ||
1004 | static int encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_closeargs *arg) | 1004 | static int encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_closeargs *arg) |
1005 | { | 1005 | { |
1006 | uint32_t *p; | 1006 | __be32 *p; |
1007 | 1007 | ||
1008 | RESERVE_SPACE(8+sizeof(arg->stateid->data)); | 1008 | RESERVE_SPACE(8+sizeof(arg->stateid->data)); |
1009 | WRITE32(OP_OPEN_DOWNGRADE); | 1009 | WRITE32(OP_OPEN_DOWNGRADE); |
@@ -1017,7 +1017,7 @@ static int | |||
1017 | encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh) | 1017 | encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh) |
1018 | { | 1018 | { |
1019 | int len = fh->size; | 1019 | int len = fh->size; |
1020 | uint32_t *p; | 1020 | __be32 *p; |
1021 | 1021 | ||
1022 | RESERVE_SPACE(8 + len); | 1022 | RESERVE_SPACE(8 + len); |
1023 | WRITE32(OP_PUTFH); | 1023 | WRITE32(OP_PUTFH); |
@@ -1029,7 +1029,7 @@ encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh) | |||
1029 | 1029 | ||
1030 | static int encode_putrootfh(struct xdr_stream *xdr) | 1030 | static int encode_putrootfh(struct xdr_stream *xdr) |
1031 | { | 1031 | { |
1032 | uint32_t *p; | 1032 | __be32 *p; |
1033 | 1033 | ||
1034 | RESERVE_SPACE(4); | 1034 | RESERVE_SPACE(4); |
1035 | WRITE32(OP_PUTROOTFH); | 1035 | WRITE32(OP_PUTROOTFH); |
@@ -1040,7 +1040,7 @@ static int encode_putrootfh(struct xdr_stream *xdr) | |||
1040 | static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context *ctx) | 1040 | static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context *ctx) |
1041 | { | 1041 | { |
1042 | nfs4_stateid stateid; | 1042 | nfs4_stateid stateid; |
1043 | uint32_t *p; | 1043 | __be32 *p; |
1044 | 1044 | ||
1045 | RESERVE_SPACE(16); | 1045 | RESERVE_SPACE(16); |
1046 | if (ctx->state != NULL) { | 1046 | if (ctx->state != NULL) { |
@@ -1052,7 +1052,7 @@ static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context | |||
1052 | 1052 | ||
1053 | static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args) | 1053 | static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args) |
1054 | { | 1054 | { |
1055 | uint32_t *p; | 1055 | __be32 *p; |
1056 | 1056 | ||
1057 | RESERVE_SPACE(4); | 1057 | RESERVE_SPACE(4); |
1058 | WRITE32(OP_READ); | 1058 | WRITE32(OP_READ); |
@@ -1074,7 +1074,7 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg | |||
1074 | FATTR4_WORD1_MOUNTED_ON_FILEID, | 1074 | FATTR4_WORD1_MOUNTED_ON_FILEID, |
1075 | }; | 1075 | }; |
1076 | int replen; | 1076 | int replen; |
1077 | uint32_t *p; | 1077 | __be32 *p; |
1078 | 1078 | ||
1079 | RESERVE_SPACE(32+sizeof(nfs4_verifier)); | 1079 | RESERVE_SPACE(32+sizeof(nfs4_verifier)); |
1080 | WRITE32(OP_READDIR); | 1080 | WRITE32(OP_READDIR); |
@@ -1116,7 +1116,7 @@ static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *r | |||
1116 | { | 1116 | { |
1117 | struct rpc_auth *auth = req->rq_task->tk_auth; | 1117 | struct rpc_auth *auth = req->rq_task->tk_auth; |
1118 | unsigned int replen; | 1118 | unsigned int replen; |
1119 | uint32_t *p; | 1119 | __be32 *p; |
1120 | 1120 | ||
1121 | RESERVE_SPACE(4); | 1121 | RESERVE_SPACE(4); |
1122 | WRITE32(OP_READLINK); | 1122 | WRITE32(OP_READLINK); |
@@ -1134,7 +1134,7 @@ static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *r | |||
1134 | 1134 | ||
1135 | static int encode_remove(struct xdr_stream *xdr, const struct qstr *name) | 1135 | static int encode_remove(struct xdr_stream *xdr, const struct qstr *name) |
1136 | { | 1136 | { |
1137 | uint32_t *p; | 1137 | __be32 *p; |
1138 | 1138 | ||
1139 | RESERVE_SPACE(8 + name->len); | 1139 | RESERVE_SPACE(8 + name->len); |
1140 | WRITE32(OP_REMOVE); | 1140 | WRITE32(OP_REMOVE); |
@@ -1146,7 +1146,7 @@ static int encode_remove(struct xdr_stream *xdr, const struct qstr *name) | |||
1146 | 1146 | ||
1147 | static int encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, const struct qstr *newname) | 1147 | static int encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, const struct qstr *newname) |
1148 | { | 1148 | { |
1149 | uint32_t *p; | 1149 | __be32 *p; |
1150 | 1150 | ||
1151 | RESERVE_SPACE(8 + oldname->len); | 1151 | RESERVE_SPACE(8 + oldname->len); |
1152 | WRITE32(OP_RENAME); | 1152 | WRITE32(OP_RENAME); |
@@ -1162,7 +1162,7 @@ static int encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, con | |||
1162 | 1162 | ||
1163 | static int encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_stateid) | 1163 | static int encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_stateid) |
1164 | { | 1164 | { |
1165 | uint32_t *p; | 1165 | __be32 *p; |
1166 | 1166 | ||
1167 | RESERVE_SPACE(12); | 1167 | RESERVE_SPACE(12); |
1168 | WRITE32(OP_RENEW); | 1168 | WRITE32(OP_RENEW); |
@@ -1174,7 +1174,7 @@ static int encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_ | |||
1174 | static int | 1174 | static int |
1175 | encode_restorefh(struct xdr_stream *xdr) | 1175 | encode_restorefh(struct xdr_stream *xdr) |
1176 | { | 1176 | { |
1177 | uint32_t *p; | 1177 | __be32 *p; |
1178 | 1178 | ||
1179 | RESERVE_SPACE(4); | 1179 | RESERVE_SPACE(4); |
1180 | WRITE32(OP_RESTOREFH); | 1180 | WRITE32(OP_RESTOREFH); |
@@ -1185,7 +1185,7 @@ encode_restorefh(struct xdr_stream *xdr) | |||
1185 | static int | 1185 | static int |
1186 | encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg) | 1186 | encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg) |
1187 | { | 1187 | { |
1188 | uint32_t *p; | 1188 | __be32 *p; |
1189 | 1189 | ||
1190 | RESERVE_SPACE(4+sizeof(zero_stateid.data)); | 1190 | RESERVE_SPACE(4+sizeof(zero_stateid.data)); |
1191 | WRITE32(OP_SETATTR); | 1191 | WRITE32(OP_SETATTR); |
@@ -1204,7 +1204,7 @@ encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg) | |||
1204 | static int | 1204 | static int |
1205 | encode_savefh(struct xdr_stream *xdr) | 1205 | encode_savefh(struct xdr_stream *xdr) |
1206 | { | 1206 | { |
1207 | uint32_t *p; | 1207 | __be32 *p; |
1208 | 1208 | ||
1209 | RESERVE_SPACE(4); | 1209 | RESERVE_SPACE(4); |
1210 | WRITE32(OP_SAVEFH); | 1210 | WRITE32(OP_SAVEFH); |
@@ -1215,7 +1215,7 @@ encode_savefh(struct xdr_stream *xdr) | |||
1215 | static int encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs *arg, const struct nfs_server *server) | 1215 | static int encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs *arg, const struct nfs_server *server) |
1216 | { | 1216 | { |
1217 | int status; | 1217 | int status; |
1218 | uint32_t *p; | 1218 | __be32 *p; |
1219 | 1219 | ||
1220 | RESERVE_SPACE(4+sizeof(arg->stateid.data)); | 1220 | RESERVE_SPACE(4+sizeof(arg->stateid.data)); |
1221 | WRITE32(OP_SETATTR); | 1221 | WRITE32(OP_SETATTR); |
@@ -1229,7 +1229,7 @@ static int encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs * | |||
1229 | 1229 | ||
1230 | static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclientid *setclientid) | 1230 | static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclientid *setclientid) |
1231 | { | 1231 | { |
1232 | uint32_t *p; | 1232 | __be32 *p; |
1233 | 1233 | ||
1234 | RESERVE_SPACE(4 + sizeof(setclientid->sc_verifier->data)); | 1234 | RESERVE_SPACE(4 + sizeof(setclientid->sc_verifier->data)); |
1235 | WRITE32(OP_SETCLIENTID); | 1235 | WRITE32(OP_SETCLIENTID); |
@@ -1248,7 +1248,7 @@ static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclien | |||
1248 | 1248 | ||
1249 | static int encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_client *client_state) | 1249 | static int encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_client *client_state) |
1250 | { | 1250 | { |
1251 | uint32_t *p; | 1251 | __be32 *p; |
1252 | 1252 | ||
1253 | RESERVE_SPACE(12 + sizeof(client_state->cl_confirm.data)); | 1253 | RESERVE_SPACE(12 + sizeof(client_state->cl_confirm.data)); |
1254 | WRITE32(OP_SETCLIENTID_CONFIRM); | 1254 | WRITE32(OP_SETCLIENTID_CONFIRM); |
@@ -1260,7 +1260,7 @@ static int encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_c | |||
1260 | 1260 | ||
1261 | static int encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args) | 1261 | static int encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args) |
1262 | { | 1262 | { |
1263 | uint32_t *p; | 1263 | __be32 *p; |
1264 | 1264 | ||
1265 | RESERVE_SPACE(4); | 1265 | RESERVE_SPACE(4); |
1266 | WRITE32(OP_WRITE); | 1266 | WRITE32(OP_WRITE); |
@@ -1279,7 +1279,7 @@ static int encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args | |||
1279 | 1279 | ||
1280 | static int encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *stateid) | 1280 | static int encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *stateid) |
1281 | { | 1281 | { |
1282 | uint32_t *p; | 1282 | __be32 *p; |
1283 | 1283 | ||
1284 | RESERVE_SPACE(20); | 1284 | RESERVE_SPACE(20); |
1285 | 1285 | ||
@@ -1295,7 +1295,7 @@ static int encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *statei | |||
1295 | /* | 1295 | /* |
1296 | * Encode an ACCESS request | 1296 | * Encode an ACCESS request |
1297 | */ | 1297 | */ |
1298 | static int nfs4_xdr_enc_access(struct rpc_rqst *req, uint32_t *p, const struct nfs4_accessargs *args) | 1298 | static int nfs4_xdr_enc_access(struct rpc_rqst *req, __be32 *p, const struct nfs4_accessargs *args) |
1299 | { | 1299 | { |
1300 | struct xdr_stream xdr; | 1300 | struct xdr_stream xdr; |
1301 | struct compound_hdr hdr = { | 1301 | struct compound_hdr hdr = { |
@@ -1313,7 +1313,7 @@ static int nfs4_xdr_enc_access(struct rpc_rqst *req, uint32_t *p, const struct n | |||
1313 | /* | 1313 | /* |
1314 | * Encode LOOKUP request | 1314 | * Encode LOOKUP request |
1315 | */ | 1315 | */ |
1316 | static int nfs4_xdr_enc_lookup(struct rpc_rqst *req, uint32_t *p, const struct nfs4_lookup_arg *args) | 1316 | static int nfs4_xdr_enc_lookup(struct rpc_rqst *req, __be32 *p, const struct nfs4_lookup_arg *args) |
1317 | { | 1317 | { |
1318 | struct xdr_stream xdr; | 1318 | struct xdr_stream xdr; |
1319 | struct compound_hdr hdr = { | 1319 | struct compound_hdr hdr = { |
@@ -1337,7 +1337,7 @@ out: | |||
1337 | /* | 1337 | /* |
1338 | * Encode LOOKUP_ROOT request | 1338 | * Encode LOOKUP_ROOT request |
1339 | */ | 1339 | */ |
1340 | static int nfs4_xdr_enc_lookup_root(struct rpc_rqst *req, uint32_t *p, const struct nfs4_lookup_root_arg *args) | 1340 | static int nfs4_xdr_enc_lookup_root(struct rpc_rqst *req, __be32 *p, const struct nfs4_lookup_root_arg *args) |
1341 | { | 1341 | { |
1342 | struct xdr_stream xdr; | 1342 | struct xdr_stream xdr; |
1343 | struct compound_hdr hdr = { | 1343 | struct compound_hdr hdr = { |
@@ -1358,7 +1358,7 @@ out: | |||
1358 | /* | 1358 | /* |
1359 | * Encode REMOVE request | 1359 | * Encode REMOVE request |
1360 | */ | 1360 | */ |
1361 | static int nfs4_xdr_enc_remove(struct rpc_rqst *req, uint32_t *p, const struct nfs4_remove_arg *args) | 1361 | static int nfs4_xdr_enc_remove(struct rpc_rqst *req, __be32 *p, const struct nfs4_remove_arg *args) |
1362 | { | 1362 | { |
1363 | struct xdr_stream xdr; | 1363 | struct xdr_stream xdr; |
1364 | struct compound_hdr hdr = { | 1364 | struct compound_hdr hdr = { |
@@ -1380,7 +1380,7 @@ out: | |||
1380 | /* | 1380 | /* |
1381 | * Encode RENAME request | 1381 | * Encode RENAME request |
1382 | */ | 1382 | */ |
1383 | static int nfs4_xdr_enc_rename(struct rpc_rqst *req, uint32_t *p, const struct nfs4_rename_arg *args) | 1383 | static int nfs4_xdr_enc_rename(struct rpc_rqst *req, __be32 *p, const struct nfs4_rename_arg *args) |
1384 | { | 1384 | { |
1385 | struct xdr_stream xdr; | 1385 | struct xdr_stream xdr; |
1386 | struct compound_hdr hdr = { | 1386 | struct compound_hdr hdr = { |
@@ -1410,7 +1410,7 @@ out: | |||
1410 | /* | 1410 | /* |
1411 | * Encode LINK request | 1411 | * Encode LINK request |
1412 | */ | 1412 | */ |
1413 | static int nfs4_xdr_enc_link(struct rpc_rqst *req, uint32_t *p, const struct nfs4_link_arg *args) | 1413 | static int nfs4_xdr_enc_link(struct rpc_rqst *req, __be32 *p, const struct nfs4_link_arg *args) |
1414 | { | 1414 | { |
1415 | struct xdr_stream xdr; | 1415 | struct xdr_stream xdr; |
1416 | struct compound_hdr hdr = { | 1416 | struct compound_hdr hdr = { |
@@ -1440,7 +1440,7 @@ out: | |||
1440 | /* | 1440 | /* |
1441 | * Encode CREATE request | 1441 | * Encode CREATE request |
1442 | */ | 1442 | */ |
1443 | static int nfs4_xdr_enc_create(struct rpc_rqst *req, uint32_t *p, const struct nfs4_create_arg *args) | 1443 | static int nfs4_xdr_enc_create(struct rpc_rqst *req, __be32 *p, const struct nfs4_create_arg *args) |
1444 | { | 1444 | { |
1445 | struct xdr_stream xdr; | 1445 | struct xdr_stream xdr; |
1446 | struct compound_hdr hdr = { | 1446 | struct compound_hdr hdr = { |
@@ -1470,7 +1470,7 @@ out: | |||
1470 | /* | 1470 | /* |
1471 | * Encode SYMLINK request | 1471 | * Encode SYMLINK request |
1472 | */ | 1472 | */ |
1473 | static int nfs4_xdr_enc_symlink(struct rpc_rqst *req, uint32_t *p, const struct nfs4_create_arg *args) | 1473 | static int nfs4_xdr_enc_symlink(struct rpc_rqst *req, __be32 *p, const struct nfs4_create_arg *args) |
1474 | { | 1474 | { |
1475 | return nfs4_xdr_enc_create(req, p, args); | 1475 | return nfs4_xdr_enc_create(req, p, args); |
1476 | } | 1476 | } |
@@ -1478,7 +1478,7 @@ static int nfs4_xdr_enc_symlink(struct rpc_rqst *req, uint32_t *p, const struct | |||
1478 | /* | 1478 | /* |
1479 | * Encode GETATTR request | 1479 | * Encode GETATTR request |
1480 | */ | 1480 | */ |
1481 | static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, uint32_t *p, const struct nfs4_getattr_arg *args) | 1481 | static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, __be32 *p, const struct nfs4_getattr_arg *args) |
1482 | { | 1482 | { |
1483 | struct xdr_stream xdr; | 1483 | struct xdr_stream xdr; |
1484 | struct compound_hdr hdr = { | 1484 | struct compound_hdr hdr = { |
@@ -1496,7 +1496,7 @@ static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, uint32_t *p, const struct | |||
1496 | /* | 1496 | /* |
1497 | * Encode a CLOSE request | 1497 | * Encode a CLOSE request |
1498 | */ | 1498 | */ |
1499 | static int nfs4_xdr_enc_close(struct rpc_rqst *req, uint32_t *p, struct nfs_closeargs *args) | 1499 | static int nfs4_xdr_enc_close(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args) |
1500 | { | 1500 | { |
1501 | struct xdr_stream xdr; | 1501 | struct xdr_stream xdr; |
1502 | struct compound_hdr hdr = { | 1502 | struct compound_hdr hdr = { |
@@ -1520,7 +1520,7 @@ out: | |||
1520 | /* | 1520 | /* |
1521 | * Encode an OPEN request | 1521 | * Encode an OPEN request |
1522 | */ | 1522 | */ |
1523 | static int nfs4_xdr_enc_open(struct rpc_rqst *req, uint32_t *p, struct nfs_openargs *args) | 1523 | static int nfs4_xdr_enc_open(struct rpc_rqst *req, __be32 *p, struct nfs_openargs *args) |
1524 | { | 1524 | { |
1525 | struct xdr_stream xdr; | 1525 | struct xdr_stream xdr; |
1526 | struct compound_hdr hdr = { | 1526 | struct compound_hdr hdr = { |
@@ -1556,7 +1556,7 @@ out: | |||
1556 | /* | 1556 | /* |
1557 | * Encode an OPEN_CONFIRM request | 1557 | * Encode an OPEN_CONFIRM request |
1558 | */ | 1558 | */ |
1559 | static int nfs4_xdr_enc_open_confirm(struct rpc_rqst *req, uint32_t *p, struct nfs_open_confirmargs *args) | 1559 | static int nfs4_xdr_enc_open_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_open_confirmargs *args) |
1560 | { | 1560 | { |
1561 | struct xdr_stream xdr; | 1561 | struct xdr_stream xdr; |
1562 | struct compound_hdr hdr = { | 1562 | struct compound_hdr hdr = { |
@@ -1577,7 +1577,7 @@ out: | |||
1577 | /* | 1577 | /* |
1578 | * Encode an OPEN request with no attributes. | 1578 | * Encode an OPEN request with no attributes. |
1579 | */ | 1579 | */ |
1580 | static int nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, uint32_t *p, struct nfs_openargs *args) | 1580 | static int nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, __be32 *p, struct nfs_openargs *args) |
1581 | { | 1581 | { |
1582 | struct xdr_stream xdr; | 1582 | struct xdr_stream xdr; |
1583 | struct compound_hdr hdr = { | 1583 | struct compound_hdr hdr = { |
@@ -1601,7 +1601,7 @@ out: | |||
1601 | /* | 1601 | /* |
1602 | * Encode an OPEN_DOWNGRADE request | 1602 | * Encode an OPEN_DOWNGRADE request |
1603 | */ | 1603 | */ |
1604 | static int nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, uint32_t *p, struct nfs_closeargs *args) | 1604 | static int nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args) |
1605 | { | 1605 | { |
1606 | struct xdr_stream xdr; | 1606 | struct xdr_stream xdr; |
1607 | struct compound_hdr hdr = { | 1607 | struct compound_hdr hdr = { |
@@ -1625,7 +1625,7 @@ out: | |||
1625 | /* | 1625 | /* |
1626 | * Encode a LOCK request | 1626 | * Encode a LOCK request |
1627 | */ | 1627 | */ |
1628 | static int nfs4_xdr_enc_lock(struct rpc_rqst *req, uint32_t *p, struct nfs_lock_args *args) | 1628 | static int nfs4_xdr_enc_lock(struct rpc_rqst *req, __be32 *p, struct nfs_lock_args *args) |
1629 | { | 1629 | { |
1630 | struct xdr_stream xdr; | 1630 | struct xdr_stream xdr; |
1631 | struct compound_hdr hdr = { | 1631 | struct compound_hdr hdr = { |
@@ -1646,7 +1646,7 @@ out: | |||
1646 | /* | 1646 | /* |
1647 | * Encode a LOCKT request | 1647 | * Encode a LOCKT request |
1648 | */ | 1648 | */ |
1649 | static int nfs4_xdr_enc_lockt(struct rpc_rqst *req, uint32_t *p, struct nfs_lockt_args *args) | 1649 | static int nfs4_xdr_enc_lockt(struct rpc_rqst *req, __be32 *p, struct nfs_lockt_args *args) |
1650 | { | 1650 | { |
1651 | struct xdr_stream xdr; | 1651 | struct xdr_stream xdr; |
1652 | struct compound_hdr hdr = { | 1652 | struct compound_hdr hdr = { |
@@ -1667,7 +1667,7 @@ out: | |||
1667 | /* | 1667 | /* |
1668 | * Encode a LOCKU request | 1668 | * Encode a LOCKU request |
1669 | */ | 1669 | */ |
1670 | static int nfs4_xdr_enc_locku(struct rpc_rqst *req, uint32_t *p, struct nfs_locku_args *args) | 1670 | static int nfs4_xdr_enc_locku(struct rpc_rqst *req, __be32 *p, struct nfs_locku_args *args) |
1671 | { | 1671 | { |
1672 | struct xdr_stream xdr; | 1672 | struct xdr_stream xdr; |
1673 | struct compound_hdr hdr = { | 1673 | struct compound_hdr hdr = { |
@@ -1688,7 +1688,7 @@ out: | |||
1688 | /* | 1688 | /* |
1689 | * Encode a READLINK request | 1689 | * Encode a READLINK request |
1690 | */ | 1690 | */ |
1691 | static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, uint32_t *p, const struct nfs4_readlink *args) | 1691 | static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, __be32 *p, const struct nfs4_readlink *args) |
1692 | { | 1692 | { |
1693 | struct xdr_stream xdr; | 1693 | struct xdr_stream xdr; |
1694 | struct compound_hdr hdr = { | 1694 | struct compound_hdr hdr = { |
@@ -1709,7 +1709,7 @@ out: | |||
1709 | /* | 1709 | /* |
1710 | * Encode a READDIR request | 1710 | * Encode a READDIR request |
1711 | */ | 1711 | */ |
1712 | static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, uint32_t *p, const struct nfs4_readdir_arg *args) | 1712 | static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nfs4_readdir_arg *args) |
1713 | { | 1713 | { |
1714 | struct xdr_stream xdr; | 1714 | struct xdr_stream xdr; |
1715 | struct compound_hdr hdr = { | 1715 | struct compound_hdr hdr = { |
@@ -1730,7 +1730,7 @@ out: | |||
1730 | /* | 1730 | /* |
1731 | * Encode a READ request | 1731 | * Encode a READ request |
1732 | */ | 1732 | */ |
1733 | static int nfs4_xdr_enc_read(struct rpc_rqst *req, uint32_t *p, struct nfs_readargs *args) | 1733 | static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) |
1734 | { | 1734 | { |
1735 | struct rpc_auth *auth = req->rq_task->tk_auth; | 1735 | struct rpc_auth *auth = req->rq_task->tk_auth; |
1736 | struct xdr_stream xdr; | 1736 | struct xdr_stream xdr; |
@@ -1762,7 +1762,7 @@ out: | |||
1762 | /* | 1762 | /* |
1763 | * Encode an SETATTR request | 1763 | * Encode an SETATTR request |
1764 | */ | 1764 | */ |
1765 | static int nfs4_xdr_enc_setattr(struct rpc_rqst *req, uint32_t *p, struct nfs_setattrargs *args) | 1765 | static int nfs4_xdr_enc_setattr(struct rpc_rqst *req, __be32 *p, struct nfs_setattrargs *args) |
1766 | 1766 | ||
1767 | { | 1767 | { |
1768 | struct xdr_stream xdr; | 1768 | struct xdr_stream xdr; |
@@ -1788,7 +1788,7 @@ out: | |||
1788 | * Encode a GETACL request | 1788 | * Encode a GETACL request |
1789 | */ | 1789 | */ |
1790 | static int | 1790 | static int |
1791 | nfs4_xdr_enc_getacl(struct rpc_rqst *req, uint32_t *p, | 1791 | nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p, |
1792 | struct nfs_getaclargs *args) | 1792 | struct nfs_getaclargs *args) |
1793 | { | 1793 | { |
1794 | struct xdr_stream xdr; | 1794 | struct xdr_stream xdr; |
@@ -1815,7 +1815,7 @@ out: | |||
1815 | /* | 1815 | /* |
1816 | * Encode a WRITE request | 1816 | * Encode a WRITE request |
1817 | */ | 1817 | */ |
1818 | static int nfs4_xdr_enc_write(struct rpc_rqst *req, uint32_t *p, struct nfs_writeargs *args) | 1818 | static int nfs4_xdr_enc_write(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args) |
1819 | { | 1819 | { |
1820 | struct xdr_stream xdr; | 1820 | struct xdr_stream xdr; |
1821 | struct compound_hdr hdr = { | 1821 | struct compound_hdr hdr = { |
@@ -1839,7 +1839,7 @@ out: | |||
1839 | /* | 1839 | /* |
1840 | * a COMMIT request | 1840 | * a COMMIT request |
1841 | */ | 1841 | */ |
1842 | static int nfs4_xdr_enc_commit(struct rpc_rqst *req, uint32_t *p, struct nfs_writeargs *args) | 1842 | static int nfs4_xdr_enc_commit(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args) |
1843 | { | 1843 | { |
1844 | struct xdr_stream xdr; | 1844 | struct xdr_stream xdr; |
1845 | struct compound_hdr hdr = { | 1845 | struct compound_hdr hdr = { |
@@ -1863,7 +1863,7 @@ out: | |||
1863 | /* | 1863 | /* |
1864 | * FSINFO request | 1864 | * FSINFO request |
1865 | */ | 1865 | */ |
1866 | static int nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, uint32_t *p, struct nfs4_fsinfo_arg *args) | 1866 | static int nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs4_fsinfo_arg *args) |
1867 | { | 1867 | { |
1868 | struct xdr_stream xdr; | 1868 | struct xdr_stream xdr; |
1869 | struct compound_hdr hdr = { | 1869 | struct compound_hdr hdr = { |
@@ -1882,7 +1882,7 @@ static int nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, uint32_t *p, struct nfs4_fs | |||
1882 | /* | 1882 | /* |
1883 | * a PATHCONF request | 1883 | * a PATHCONF request |
1884 | */ | 1884 | */ |
1885 | static int nfs4_xdr_enc_pathconf(struct rpc_rqst *req, uint32_t *p, const struct nfs4_pathconf_arg *args) | 1885 | static int nfs4_xdr_enc_pathconf(struct rpc_rqst *req, __be32 *p, const struct nfs4_pathconf_arg *args) |
1886 | { | 1886 | { |
1887 | struct xdr_stream xdr; | 1887 | struct xdr_stream xdr; |
1888 | struct compound_hdr hdr = { | 1888 | struct compound_hdr hdr = { |
@@ -1902,7 +1902,7 @@ static int nfs4_xdr_enc_pathconf(struct rpc_rqst *req, uint32_t *p, const struct | |||
1902 | /* | 1902 | /* |
1903 | * a STATFS request | 1903 | * a STATFS request |
1904 | */ | 1904 | */ |
1905 | static int nfs4_xdr_enc_statfs(struct rpc_rqst *req, uint32_t *p, const struct nfs4_statfs_arg *args) | 1905 | static int nfs4_xdr_enc_statfs(struct rpc_rqst *req, __be32 *p, const struct nfs4_statfs_arg *args) |
1906 | { | 1906 | { |
1907 | struct xdr_stream xdr; | 1907 | struct xdr_stream xdr; |
1908 | struct compound_hdr hdr = { | 1908 | struct compound_hdr hdr = { |
@@ -1923,7 +1923,7 @@ static int nfs4_xdr_enc_statfs(struct rpc_rqst *req, uint32_t *p, const struct n | |||
1923 | /* | 1923 | /* |
1924 | * GETATTR_BITMAP request | 1924 | * GETATTR_BITMAP request |
1925 | */ | 1925 | */ |
1926 | static int nfs4_xdr_enc_server_caps(struct rpc_rqst *req, uint32_t *p, const struct nfs_fh *fhandle) | 1926 | static int nfs4_xdr_enc_server_caps(struct rpc_rqst *req, __be32 *p, const struct nfs_fh *fhandle) |
1927 | { | 1927 | { |
1928 | struct xdr_stream xdr; | 1928 | struct xdr_stream xdr; |
1929 | struct compound_hdr hdr = { | 1929 | struct compound_hdr hdr = { |
@@ -1945,7 +1945,7 @@ static int nfs4_xdr_enc_server_caps(struct rpc_rqst *req, uint32_t *p, const str | |||
1945 | /* | 1945 | /* |
1946 | * a RENEW request | 1946 | * a RENEW request |
1947 | */ | 1947 | */ |
1948 | static int nfs4_xdr_enc_renew(struct rpc_rqst *req, uint32_t *p, struct nfs_client *clp) | 1948 | static int nfs4_xdr_enc_renew(struct rpc_rqst *req, __be32 *p, struct nfs_client *clp) |
1949 | { | 1949 | { |
1950 | struct xdr_stream xdr; | 1950 | struct xdr_stream xdr; |
1951 | struct compound_hdr hdr = { | 1951 | struct compound_hdr hdr = { |
@@ -1960,7 +1960,7 @@ static int nfs4_xdr_enc_renew(struct rpc_rqst *req, uint32_t *p, struct nfs_clie | |||
1960 | /* | 1960 | /* |
1961 | * a SETCLIENTID request | 1961 | * a SETCLIENTID request |
1962 | */ | 1962 | */ |
1963 | static int nfs4_xdr_enc_setclientid(struct rpc_rqst *req, uint32_t *p, struct nfs4_setclientid *sc) | 1963 | static int nfs4_xdr_enc_setclientid(struct rpc_rqst *req, __be32 *p, struct nfs4_setclientid *sc) |
1964 | { | 1964 | { |
1965 | struct xdr_stream xdr; | 1965 | struct xdr_stream xdr; |
1966 | struct compound_hdr hdr = { | 1966 | struct compound_hdr hdr = { |
@@ -1975,7 +1975,7 @@ static int nfs4_xdr_enc_setclientid(struct rpc_rqst *req, uint32_t *p, struct nf | |||
1975 | /* | 1975 | /* |
1976 | * a SETCLIENTID_CONFIRM request | 1976 | * a SETCLIENTID_CONFIRM request |
1977 | */ | 1977 | */ |
1978 | static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, uint32_t *p, struct nfs_client *clp) | 1978 | static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_client *clp) |
1979 | { | 1979 | { |
1980 | struct xdr_stream xdr; | 1980 | struct xdr_stream xdr; |
1981 | struct compound_hdr hdr = { | 1981 | struct compound_hdr hdr = { |
@@ -1997,7 +1997,7 @@ static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, uint32_t *p, s | |||
1997 | /* | 1997 | /* |
1998 | * DELEGRETURN request | 1998 | * DELEGRETURN request |
1999 | */ | 1999 | */ |
2000 | static int nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, uint32_t *p, const struct nfs4_delegreturnargs *args) | 2000 | static int nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, __be32 *p, const struct nfs4_delegreturnargs *args) |
2001 | { | 2001 | { |
2002 | struct xdr_stream xdr; | 2002 | struct xdr_stream xdr; |
2003 | struct compound_hdr hdr = { | 2003 | struct compound_hdr hdr = { |
@@ -2021,7 +2021,7 @@ out: | |||
2021 | /* | 2021 | /* |
2022 | * Encode FS_LOCATIONS request | 2022 | * Encode FS_LOCATIONS request |
2023 | */ | 2023 | */ |
2024 | static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, uint32_t *p, struct nfs4_fs_locations_arg *args) | 2024 | static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs4_fs_locations_arg *args) |
2025 | { | 2025 | { |
2026 | struct xdr_stream xdr; | 2026 | struct xdr_stream xdr; |
2027 | struct compound_hdr hdr = { | 2027 | struct compound_hdr hdr = { |
@@ -2086,7 +2086,7 @@ out: | |||
2086 | 2086 | ||
2087 | static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char **string) | 2087 | static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char **string) |
2088 | { | 2088 | { |
2089 | uint32_t *p; | 2089 | __be32 *p; |
2090 | 2090 | ||
2091 | READ_BUF(4); | 2091 | READ_BUF(4); |
2092 | READ32(*len); | 2092 | READ32(*len); |
@@ -2097,7 +2097,7 @@ static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char | |||
2097 | 2097 | ||
2098 | static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) | 2098 | static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) |
2099 | { | 2099 | { |
2100 | uint32_t *p; | 2100 | __be32 *p; |
2101 | 2101 | ||
2102 | READ_BUF(8); | 2102 | READ_BUF(8); |
2103 | READ32(hdr->status); | 2103 | READ32(hdr->status); |
@@ -2112,7 +2112,7 @@ static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) | |||
2112 | 2112 | ||
2113 | static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected) | 2113 | static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected) |
2114 | { | 2114 | { |
2115 | uint32_t *p; | 2115 | __be32 *p; |
2116 | uint32_t opnum; | 2116 | uint32_t opnum; |
2117 | int32_t nfserr; | 2117 | int32_t nfserr; |
2118 | 2118 | ||
@@ -2134,7 +2134,7 @@ static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected) | |||
2134 | /* Dummy routine */ | 2134 | /* Dummy routine */ |
2135 | static int decode_ace(struct xdr_stream *xdr, void *ace, struct nfs_client *clp) | 2135 | static int decode_ace(struct xdr_stream *xdr, void *ace, struct nfs_client *clp) |
2136 | { | 2136 | { |
2137 | uint32_t *p; | 2137 | __be32 *p; |
2138 | unsigned int strlen; | 2138 | unsigned int strlen; |
2139 | char *str; | 2139 | char *str; |
2140 | 2140 | ||
@@ -2144,7 +2144,8 @@ static int decode_ace(struct xdr_stream *xdr, void *ace, struct nfs_client *clp) | |||
2144 | 2144 | ||
2145 | static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) | 2145 | static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) |
2146 | { | 2146 | { |
2147 | uint32_t bmlen, *p; | 2147 | uint32_t bmlen; |
2148 | __be32 *p; | ||
2148 | 2149 | ||
2149 | READ_BUF(4); | 2150 | READ_BUF(4); |
2150 | READ32(bmlen); | 2151 | READ32(bmlen); |
@@ -2159,9 +2160,9 @@ static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) | |||
2159 | return 0; | 2160 | return 0; |
2160 | } | 2161 | } |
2161 | 2162 | ||
2162 | static inline int decode_attr_length(struct xdr_stream *xdr, uint32_t *attrlen, uint32_t **savep) | 2163 | static inline int decode_attr_length(struct xdr_stream *xdr, uint32_t *attrlen, __be32 **savep) |
2163 | { | 2164 | { |
2164 | uint32_t *p; | 2165 | __be32 *p; |
2165 | 2166 | ||
2166 | READ_BUF(4); | 2167 | READ_BUF(4); |
2167 | READ32(*attrlen); | 2168 | READ32(*attrlen); |
@@ -2182,7 +2183,7 @@ static int decode_attr_supported(struct xdr_stream *xdr, uint32_t *bitmap, uint3 | |||
2182 | 2183 | ||
2183 | static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *type) | 2184 | static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *type) |
2184 | { | 2185 | { |
2185 | uint32_t *p; | 2186 | __be32 *p; |
2186 | 2187 | ||
2187 | *type = 0; | 2188 | *type = 0; |
2188 | if (unlikely(bitmap[0] & (FATTR4_WORD0_TYPE - 1U))) | 2189 | if (unlikely(bitmap[0] & (FATTR4_WORD0_TYPE - 1U))) |
@@ -2202,7 +2203,7 @@ static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t * | |||
2202 | 2203 | ||
2203 | static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *change) | 2204 | static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *change) |
2204 | { | 2205 | { |
2205 | uint32_t *p; | 2206 | __be32 *p; |
2206 | 2207 | ||
2207 | *change = 0; | 2208 | *change = 0; |
2208 | if (unlikely(bitmap[0] & (FATTR4_WORD0_CHANGE - 1U))) | 2209 | if (unlikely(bitmap[0] & (FATTR4_WORD0_CHANGE - 1U))) |
@@ -2219,7 +2220,7 @@ static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t | |||
2219 | 2220 | ||
2220 | static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *size) | 2221 | static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *size) |
2221 | { | 2222 | { |
2222 | uint32_t *p; | 2223 | __be32 *p; |
2223 | 2224 | ||
2224 | *size = 0; | 2225 | *size = 0; |
2225 | if (unlikely(bitmap[0] & (FATTR4_WORD0_SIZE - 1U))) | 2226 | if (unlikely(bitmap[0] & (FATTR4_WORD0_SIZE - 1U))) |
@@ -2235,7 +2236,7 @@ static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t * | |||
2235 | 2236 | ||
2236 | static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) | 2237 | static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) |
2237 | { | 2238 | { |
2238 | uint32_t *p; | 2239 | __be32 *p; |
2239 | 2240 | ||
2240 | *res = 0; | 2241 | *res = 0; |
2241 | if (unlikely(bitmap[0] & (FATTR4_WORD0_LINK_SUPPORT - 1U))) | 2242 | if (unlikely(bitmap[0] & (FATTR4_WORD0_LINK_SUPPORT - 1U))) |
@@ -2251,7 +2252,7 @@ static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, ui | |||
2251 | 2252 | ||
2252 | static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) | 2253 | static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) |
2253 | { | 2254 | { |
2254 | uint32_t *p; | 2255 | __be32 *p; |
2255 | 2256 | ||
2256 | *res = 0; | 2257 | *res = 0; |
2257 | if (unlikely(bitmap[0] & (FATTR4_WORD0_SYMLINK_SUPPORT - 1U))) | 2258 | if (unlikely(bitmap[0] & (FATTR4_WORD0_SYMLINK_SUPPORT - 1U))) |
@@ -2267,7 +2268,7 @@ static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap, | |||
2267 | 2268 | ||
2268 | static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fsid *fsid) | 2269 | static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fsid *fsid) |
2269 | { | 2270 | { |
2270 | uint32_t *p; | 2271 | __be32 *p; |
2271 | 2272 | ||
2272 | fsid->major = 0; | 2273 | fsid->major = 0; |
2273 | fsid->minor = 0; | 2274 | fsid->minor = 0; |
@@ -2287,7 +2288,7 @@ static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs | |||
2287 | 2288 | ||
2288 | static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) | 2289 | static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) |
2289 | { | 2290 | { |
2290 | uint32_t *p; | 2291 | __be32 *p; |
2291 | 2292 | ||
2292 | *res = 60; | 2293 | *res = 60; |
2293 | if (unlikely(bitmap[0] & (FATTR4_WORD0_LEASE_TIME - 1U))) | 2294 | if (unlikely(bitmap[0] & (FATTR4_WORD0_LEASE_TIME - 1U))) |
@@ -2303,7 +2304,7 @@ static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2303 | 2304 | ||
2304 | static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) | 2305 | static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) |
2305 | { | 2306 | { |
2306 | uint32_t *p; | 2307 | __be32 *p; |
2307 | 2308 | ||
2308 | *res = ACL4_SUPPORT_ALLOW_ACL|ACL4_SUPPORT_DENY_ACL; | 2309 | *res = ACL4_SUPPORT_ALLOW_ACL|ACL4_SUPPORT_DENY_ACL; |
2309 | if (unlikely(bitmap[0] & (FATTR4_WORD0_ACLSUPPORT - 1U))) | 2310 | if (unlikely(bitmap[0] & (FATTR4_WORD0_ACLSUPPORT - 1U))) |
@@ -2319,7 +2320,7 @@ static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2319 | 2320 | ||
2320 | static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) | 2321 | static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) |
2321 | { | 2322 | { |
2322 | uint32_t *p; | 2323 | __be32 *p; |
2323 | 2324 | ||
2324 | *fileid = 0; | 2325 | *fileid = 0; |
2325 | if (unlikely(bitmap[0] & (FATTR4_WORD0_FILEID - 1U))) | 2326 | if (unlikely(bitmap[0] & (FATTR4_WORD0_FILEID - 1U))) |
@@ -2335,7 +2336,7 @@ static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t | |||
2335 | 2336 | ||
2336 | static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) | 2337 | static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) |
2337 | { | 2338 | { |
2338 | uint32_t *p; | 2339 | __be32 *p; |
2339 | 2340 | ||
2340 | *fileid = 0; | 2341 | *fileid = 0; |
2341 | if (unlikely(bitmap[1] & (FATTR4_WORD1_MOUNTED_ON_FILEID - 1U))) | 2342 | if (unlikely(bitmap[1] & (FATTR4_WORD1_MOUNTED_ON_FILEID - 1U))) |
@@ -2351,7 +2352,7 @@ static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitma | |||
2351 | 2352 | ||
2352 | static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) | 2353 | static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) |
2353 | { | 2354 | { |
2354 | uint32_t *p; | 2355 | __be32 *p; |
2355 | int status = 0; | 2356 | int status = 0; |
2356 | 2357 | ||
2357 | *res = 0; | 2358 | *res = 0; |
@@ -2368,7 +2369,7 @@ static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2368 | 2369 | ||
2369 | static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) | 2370 | static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) |
2370 | { | 2371 | { |
2371 | uint32_t *p; | 2372 | __be32 *p; |
2372 | int status = 0; | 2373 | int status = 0; |
2373 | 2374 | ||
2374 | *res = 0; | 2375 | *res = 0; |
@@ -2385,7 +2386,7 @@ static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2385 | 2386 | ||
2386 | static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) | 2387 | static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) |
2387 | { | 2388 | { |
2388 | uint32_t *p; | 2389 | __be32 *p; |
2389 | int status = 0; | 2390 | int status = 0; |
2390 | 2391 | ||
2391 | *res = 0; | 2392 | *res = 0; |
@@ -2403,7 +2404,7 @@ static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2403 | static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path) | 2404 | static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path) |
2404 | { | 2405 | { |
2405 | int n; | 2406 | int n; |
2406 | uint32_t *p; | 2407 | __be32 *p; |
2407 | int status = 0; | 2408 | int status = 0; |
2408 | 2409 | ||
2409 | READ_BUF(4); | 2410 | READ_BUF(4); |
@@ -2448,7 +2449,7 @@ out_eio: | |||
2448 | static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs4_fs_locations *res) | 2449 | static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs4_fs_locations *res) |
2449 | { | 2450 | { |
2450 | int n; | 2451 | int n; |
2451 | uint32_t *p; | 2452 | __be32 *p; |
2452 | int status = -EIO; | 2453 | int status = -EIO; |
2453 | 2454 | ||
2454 | if (unlikely(bitmap[0] & (FATTR4_WORD0_FS_LOCATIONS -1U))) | 2455 | if (unlikely(bitmap[0] & (FATTR4_WORD0_FS_LOCATIONS -1U))) |
@@ -2512,7 +2513,7 @@ out_eio: | |||
2512 | 2513 | ||
2513 | static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) | 2514 | static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) |
2514 | { | 2515 | { |
2515 | uint32_t *p; | 2516 | __be32 *p; |
2516 | int status = 0; | 2517 | int status = 0; |
2517 | 2518 | ||
2518 | *res = 0; | 2519 | *res = 0; |
@@ -2529,7 +2530,7 @@ static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2529 | 2530 | ||
2530 | static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxlink) | 2531 | static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxlink) |
2531 | { | 2532 | { |
2532 | uint32_t *p; | 2533 | __be32 *p; |
2533 | int status = 0; | 2534 | int status = 0; |
2534 | 2535 | ||
2535 | *maxlink = 1; | 2536 | *maxlink = 1; |
@@ -2546,7 +2547,7 @@ static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_ | |||
2546 | 2547 | ||
2547 | static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxname) | 2548 | static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxname) |
2548 | { | 2549 | { |
2549 | uint32_t *p; | 2550 | __be32 *p; |
2550 | int status = 0; | 2551 | int status = 0; |
2551 | 2552 | ||
2552 | *maxname = 1024; | 2553 | *maxname = 1024; |
@@ -2563,7 +2564,7 @@ static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_ | |||
2563 | 2564 | ||
2564 | static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) | 2565 | static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) |
2565 | { | 2566 | { |
2566 | uint32_t *p; | 2567 | __be32 *p; |
2567 | int status = 0; | 2568 | int status = 0; |
2568 | 2569 | ||
2569 | *res = 1024; | 2570 | *res = 1024; |
@@ -2584,7 +2585,7 @@ static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_ | |||
2584 | 2585 | ||
2585 | static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) | 2586 | static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) |
2586 | { | 2587 | { |
2587 | uint32_t *p; | 2588 | __be32 *p; |
2588 | int status = 0; | 2589 | int status = 0; |
2589 | 2590 | ||
2590 | *res = 1024; | 2591 | *res = 1024; |
@@ -2605,7 +2606,7 @@ static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32 | |||
2605 | 2606 | ||
2606 | static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *mode) | 2607 | static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *mode) |
2607 | { | 2608 | { |
2608 | uint32_t *p; | 2609 | __be32 *p; |
2609 | 2610 | ||
2610 | *mode = 0; | 2611 | *mode = 0; |
2611 | if (unlikely(bitmap[1] & (FATTR4_WORD1_MODE - 1U))) | 2612 | if (unlikely(bitmap[1] & (FATTR4_WORD1_MODE - 1U))) |
@@ -2622,7 +2623,7 @@ static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t * | |||
2622 | 2623 | ||
2623 | static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *nlink) | 2624 | static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *nlink) |
2624 | { | 2625 | { |
2625 | uint32_t *p; | 2626 | __be32 *p; |
2626 | 2627 | ||
2627 | *nlink = 1; | 2628 | *nlink = 1; |
2628 | if (unlikely(bitmap[1] & (FATTR4_WORD1_NUMLINKS - 1U))) | 2629 | if (unlikely(bitmap[1] & (FATTR4_WORD1_NUMLINKS - 1U))) |
@@ -2638,7 +2639,8 @@ static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t | |||
2638 | 2639 | ||
2639 | static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *uid) | 2640 | static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *uid) |
2640 | { | 2641 | { |
2641 | uint32_t len, *p; | 2642 | uint32_t len; |
2643 | __be32 *p; | ||
2642 | 2644 | ||
2643 | *uid = -2; | 2645 | *uid = -2; |
2644 | if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER - 1U))) | 2646 | if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER - 1U))) |
@@ -2662,7 +2664,8 @@ static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nf | |||
2662 | 2664 | ||
2663 | static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *gid) | 2665 | static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *gid) |
2664 | { | 2666 | { |
2665 | uint32_t len, *p; | 2667 | uint32_t len; |
2668 | __be32 *p; | ||
2666 | 2669 | ||
2667 | *gid = -2; | 2670 | *gid = -2; |
2668 | if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER_GROUP - 1U))) | 2671 | if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER_GROUP - 1U))) |
@@ -2686,7 +2689,8 @@ static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nf | |||
2686 | 2689 | ||
2687 | static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rdev) | 2690 | static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rdev) |
2688 | { | 2691 | { |
2689 | uint32_t major = 0, minor = 0, *p; | 2692 | uint32_t major = 0, minor = 0; |
2693 | __be32 *p; | ||
2690 | 2694 | ||
2691 | *rdev = MKDEV(0,0); | 2695 | *rdev = MKDEV(0,0); |
2692 | if (unlikely(bitmap[1] & (FATTR4_WORD1_RAWDEV - 1U))) | 2696 | if (unlikely(bitmap[1] & (FATTR4_WORD1_RAWDEV - 1U))) |
@@ -2708,7 +2712,7 @@ static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rde | |||
2708 | 2712 | ||
2709 | static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) | 2713 | static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) |
2710 | { | 2714 | { |
2711 | uint32_t *p; | 2715 | __be32 *p; |
2712 | int status = 0; | 2716 | int status = 0; |
2713 | 2717 | ||
2714 | *res = 0; | 2718 | *res = 0; |
@@ -2725,7 +2729,7 @@ static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2725 | 2729 | ||
2726 | static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) | 2730 | static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) |
2727 | { | 2731 | { |
2728 | uint32_t *p; | 2732 | __be32 *p; |
2729 | int status = 0; | 2733 | int status = 0; |
2730 | 2734 | ||
2731 | *res = 0; | 2735 | *res = 0; |
@@ -2742,7 +2746,7 @@ static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2742 | 2746 | ||
2743 | static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) | 2747 | static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) |
2744 | { | 2748 | { |
2745 | uint32_t *p; | 2749 | __be32 *p; |
2746 | int status = 0; | 2750 | int status = 0; |
2747 | 2751 | ||
2748 | *res = 0; | 2752 | *res = 0; |
@@ -2759,7 +2763,7 @@ static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2759 | 2763 | ||
2760 | static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *used) | 2764 | static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *used) |
2761 | { | 2765 | { |
2762 | uint32_t *p; | 2766 | __be32 *p; |
2763 | 2767 | ||
2764 | *used = 0; | 2768 | *used = 0; |
2765 | if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_USED - 1U))) | 2769 | if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_USED - 1U))) |
@@ -2776,7 +2780,7 @@ static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2776 | 2780 | ||
2777 | static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time) | 2781 | static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time) |
2778 | { | 2782 | { |
2779 | uint32_t *p; | 2783 | __be32 *p; |
2780 | uint64_t sec; | 2784 | uint64_t sec; |
2781 | uint32_t nsec; | 2785 | uint32_t nsec; |
2782 | 2786 | ||
@@ -2836,7 +2840,7 @@ static int decode_attr_time_modify(struct xdr_stream *xdr, uint32_t *bitmap, str | |||
2836 | return status; | 2840 | return status; |
2837 | } | 2841 | } |
2838 | 2842 | ||
2839 | static int verify_attr_len(struct xdr_stream *xdr, uint32_t *savep, uint32_t attrlen) | 2843 | static int verify_attr_len(struct xdr_stream *xdr, __be32 *savep, uint32_t attrlen) |
2840 | { | 2844 | { |
2841 | unsigned int attrwords = XDR_QUADLEN(attrlen); | 2845 | unsigned int attrwords = XDR_QUADLEN(attrlen); |
2842 | unsigned int nwords = xdr->p - savep; | 2846 | unsigned int nwords = xdr->p - savep; |
@@ -2854,7 +2858,7 @@ static int verify_attr_len(struct xdr_stream *xdr, uint32_t *savep, uint32_t att | |||
2854 | 2858 | ||
2855 | static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) | 2859 | static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) |
2856 | { | 2860 | { |
2857 | uint32_t *p; | 2861 | __be32 *p; |
2858 | 2862 | ||
2859 | READ_BUF(20); | 2863 | READ_BUF(20); |
2860 | READ32(cinfo->atomic); | 2864 | READ32(cinfo->atomic); |
@@ -2865,7 +2869,7 @@ static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *c | |||
2865 | 2869 | ||
2866 | static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access) | 2870 | static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access) |
2867 | { | 2871 | { |
2868 | uint32_t *p; | 2872 | __be32 *p; |
2869 | uint32_t supp, acc; | 2873 | uint32_t supp, acc; |
2870 | int status; | 2874 | int status; |
2871 | 2875 | ||
@@ -2882,7 +2886,7 @@ static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access) | |||
2882 | 2886 | ||
2883 | static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res) | 2887 | static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res) |
2884 | { | 2888 | { |
2885 | uint32_t *p; | 2889 | __be32 *p; |
2886 | int status; | 2890 | int status; |
2887 | 2891 | ||
2888 | status = decode_op_hdr(xdr, OP_CLOSE); | 2892 | status = decode_op_hdr(xdr, OP_CLOSE); |
@@ -2895,7 +2899,7 @@ static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res) | |||
2895 | 2899 | ||
2896 | static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res) | 2900 | static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res) |
2897 | { | 2901 | { |
2898 | uint32_t *p; | 2902 | __be32 *p; |
2899 | int status; | 2903 | int status; |
2900 | 2904 | ||
2901 | status = decode_op_hdr(xdr, OP_COMMIT); | 2905 | status = decode_op_hdr(xdr, OP_COMMIT); |
@@ -2908,7 +2912,7 @@ static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res) | |||
2908 | 2912 | ||
2909 | static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) | 2913 | static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) |
2910 | { | 2914 | { |
2911 | uint32_t *p; | 2915 | __be32 *p; |
2912 | uint32_t bmlen; | 2916 | uint32_t bmlen; |
2913 | int status; | 2917 | int status; |
2914 | 2918 | ||
@@ -2925,7 +2929,7 @@ static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) | |||
2925 | 2929 | ||
2926 | static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_res *res) | 2930 | static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_res *res) |
2927 | { | 2931 | { |
2928 | uint32_t *savep; | 2932 | __be32 *savep; |
2929 | uint32_t attrlen, | 2933 | uint32_t attrlen, |
2930 | bitmap[2] = {0}; | 2934 | bitmap[2] = {0}; |
2931 | int status; | 2935 | int status; |
@@ -2952,7 +2956,7 @@ xdr_error: | |||
2952 | 2956 | ||
2953 | static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat) | 2957 | static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat) |
2954 | { | 2958 | { |
2955 | uint32_t *savep; | 2959 | __be32 *savep; |
2956 | uint32_t attrlen, | 2960 | uint32_t attrlen, |
2957 | bitmap[2] = {0}; | 2961 | bitmap[2] = {0}; |
2958 | int status; | 2962 | int status; |
@@ -2985,7 +2989,7 @@ xdr_error: | |||
2985 | 2989 | ||
2986 | static int decode_pathconf(struct xdr_stream *xdr, struct nfs_pathconf *pathconf) | 2990 | static int decode_pathconf(struct xdr_stream *xdr, struct nfs_pathconf *pathconf) |
2987 | { | 2991 | { |
2988 | uint32_t *savep; | 2992 | __be32 *savep; |
2989 | uint32_t attrlen, | 2993 | uint32_t attrlen, |
2990 | bitmap[2] = {0}; | 2994 | bitmap[2] = {0}; |
2991 | int status; | 2995 | int status; |
@@ -3010,7 +3014,7 @@ xdr_error: | |||
3010 | 3014 | ||
3011 | static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, const struct nfs_server *server) | 3015 | static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, const struct nfs_server *server) |
3012 | { | 3016 | { |
3013 | uint32_t *savep; | 3017 | __be32 *savep; |
3014 | uint32_t attrlen, | 3018 | uint32_t attrlen, |
3015 | bitmap[2] = {0}, | 3019 | bitmap[2] = {0}, |
3016 | type; | 3020 | type; |
@@ -3079,7 +3083,7 @@ xdr_error: | |||
3079 | 3083 | ||
3080 | static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo) | 3084 | static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo) |
3081 | { | 3085 | { |
3082 | uint32_t *savep; | 3086 | __be32 *savep; |
3083 | uint32_t attrlen, bitmap[2]; | 3087 | uint32_t attrlen, bitmap[2]; |
3084 | int status; | 3088 | int status; |
3085 | 3089 | ||
@@ -3111,7 +3115,7 @@ xdr_error: | |||
3111 | 3115 | ||
3112 | static int decode_getfh(struct xdr_stream *xdr, struct nfs_fh *fh) | 3116 | static int decode_getfh(struct xdr_stream *xdr, struct nfs_fh *fh) |
3113 | { | 3117 | { |
3114 | uint32_t *p; | 3118 | __be32 *p; |
3115 | uint32_t len; | 3119 | uint32_t len; |
3116 | int status; | 3120 | int status; |
3117 | 3121 | ||
@@ -3147,7 +3151,7 @@ static int decode_link(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) | |||
3147 | static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl) | 3151 | static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl) |
3148 | { | 3152 | { |
3149 | uint64_t offset, length, clientid; | 3153 | uint64_t offset, length, clientid; |
3150 | uint32_t *p; | 3154 | __be32 *p; |
3151 | uint32_t namelen, type; | 3155 | uint32_t namelen, type; |
3152 | 3156 | ||
3153 | READ_BUF(32); | 3157 | READ_BUF(32); |
@@ -3172,7 +3176,7 @@ static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl) | |||
3172 | 3176 | ||
3173 | static int decode_lock(struct xdr_stream *xdr, struct nfs_lock_res *res) | 3177 | static int decode_lock(struct xdr_stream *xdr, struct nfs_lock_res *res) |
3174 | { | 3178 | { |
3175 | uint32_t *p; | 3179 | __be32 *p; |
3176 | int status; | 3180 | int status; |
3177 | 3181 | ||
3178 | status = decode_op_hdr(xdr, OP_LOCK); | 3182 | status = decode_op_hdr(xdr, OP_LOCK); |
@@ -3195,7 +3199,7 @@ static int decode_lockt(struct xdr_stream *xdr, struct nfs_lockt_res *res) | |||
3195 | 3199 | ||
3196 | static int decode_locku(struct xdr_stream *xdr, struct nfs_locku_res *res) | 3200 | static int decode_locku(struct xdr_stream *xdr, struct nfs_locku_res *res) |
3197 | { | 3201 | { |
3198 | uint32_t *p; | 3202 | __be32 *p; |
3199 | int status; | 3203 | int status; |
3200 | 3204 | ||
3201 | status = decode_op_hdr(xdr, OP_LOCKU); | 3205 | status = decode_op_hdr(xdr, OP_LOCKU); |
@@ -3214,7 +3218,7 @@ static int decode_lookup(struct xdr_stream *xdr) | |||
3214 | /* This is too sick! */ | 3218 | /* This is too sick! */ |
3215 | static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize) | 3219 | static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize) |
3216 | { | 3220 | { |
3217 | uint32_t *p; | 3221 | __be32 *p; |
3218 | uint32_t limit_type, nblocks, blocksize; | 3222 | uint32_t limit_type, nblocks, blocksize; |
3219 | 3223 | ||
3220 | READ_BUF(12); | 3224 | READ_BUF(12); |
@@ -3233,7 +3237,7 @@ static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize) | |||
3233 | 3237 | ||
3234 | static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) | 3238 | static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) |
3235 | { | 3239 | { |
3236 | uint32_t *p; | 3240 | __be32 *p; |
3237 | uint32_t delegation_type; | 3241 | uint32_t delegation_type; |
3238 | 3242 | ||
3239 | READ_BUF(4); | 3243 | READ_BUF(4); |
@@ -3259,7 +3263,7 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) | |||
3259 | 3263 | ||
3260 | static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) | 3264 | static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) |
3261 | { | 3265 | { |
3262 | uint32_t *p; | 3266 | __be32 *p; |
3263 | uint32_t bmlen; | 3267 | uint32_t bmlen; |
3264 | int status; | 3268 | int status; |
3265 | 3269 | ||
@@ -3287,7 +3291,7 @@ xdr_error: | |||
3287 | 3291 | ||
3288 | static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res) | 3292 | static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res) |
3289 | { | 3293 | { |
3290 | uint32_t *p; | 3294 | __be32 *p; |
3291 | int status; | 3295 | int status; |
3292 | 3296 | ||
3293 | status = decode_op_hdr(xdr, OP_OPEN_CONFIRM); | 3297 | status = decode_op_hdr(xdr, OP_OPEN_CONFIRM); |
@@ -3300,7 +3304,7 @@ static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmre | |||
3300 | 3304 | ||
3301 | static int decode_open_downgrade(struct xdr_stream *xdr, struct nfs_closeres *res) | 3305 | static int decode_open_downgrade(struct xdr_stream *xdr, struct nfs_closeres *res) |
3302 | { | 3306 | { |
3303 | uint32_t *p; | 3307 | __be32 *p; |
3304 | int status; | 3308 | int status; |
3305 | 3309 | ||
3306 | status = decode_op_hdr(xdr, OP_OPEN_DOWNGRADE); | 3310 | status = decode_op_hdr(xdr, OP_OPEN_DOWNGRADE); |
@@ -3324,7 +3328,7 @@ static int decode_putrootfh(struct xdr_stream *xdr) | |||
3324 | static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs_readres *res) | 3328 | static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs_readres *res) |
3325 | { | 3329 | { |
3326 | struct kvec *iov = req->rq_rcv_buf.head; | 3330 | struct kvec *iov = req->rq_rcv_buf.head; |
3327 | uint32_t *p; | 3331 | __be32 *p; |
3328 | uint32_t count, eof, recvd, hdrlen; | 3332 | uint32_t count, eof, recvd, hdrlen; |
3329 | int status; | 3333 | int status; |
3330 | 3334 | ||
@@ -3354,7 +3358,7 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n | |||
3354 | struct page *page = *rcvbuf->pages; | 3358 | struct page *page = *rcvbuf->pages; |
3355 | struct kvec *iov = rcvbuf->head; | 3359 | struct kvec *iov = rcvbuf->head; |
3356 | unsigned int nr, pglen = rcvbuf->page_len; | 3360 | unsigned int nr, pglen = rcvbuf->page_len; |
3357 | uint32_t *end, *entry, *p, *kaddr; | 3361 | __be32 *end, *entry, *p, *kaddr; |
3358 | uint32_t len, attrlen, xlen; | 3362 | uint32_t len, attrlen, xlen; |
3359 | int hdrlen, recvd, status; | 3363 | int hdrlen, recvd, status; |
3360 | 3364 | ||
@@ -3376,7 +3380,7 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n | |||
3376 | xdr_read_pages(xdr, pglen); | 3380 | xdr_read_pages(xdr, pglen); |
3377 | 3381 | ||
3378 | BUG_ON(pglen + readdir->pgbase > PAGE_CACHE_SIZE); | 3382 | BUG_ON(pglen + readdir->pgbase > PAGE_CACHE_SIZE); |
3379 | kaddr = p = (uint32_t *) kmap_atomic(page, KM_USER0); | 3383 | kaddr = p = kmap_atomic(page, KM_USER0); |
3380 | end = p + ((pglen + readdir->pgbase) >> 2); | 3384 | end = p + ((pglen + readdir->pgbase) >> 2); |
3381 | entry = p; | 3385 | entry = p; |
3382 | for (nr = 0; *p++; nr++) { | 3386 | for (nr = 0; *p++; nr++) { |
@@ -3428,7 +3432,7 @@ static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req) | |||
3428 | struct xdr_buf *rcvbuf = &req->rq_rcv_buf; | 3432 | struct xdr_buf *rcvbuf = &req->rq_rcv_buf; |
3429 | struct kvec *iov = rcvbuf->head; | 3433 | struct kvec *iov = rcvbuf->head; |
3430 | int hdrlen, len, recvd; | 3434 | int hdrlen, len, recvd; |
3431 | uint32_t *p; | 3435 | __be32 *p; |
3432 | char *kaddr; | 3436 | char *kaddr; |
3433 | int status; | 3437 | int status; |
3434 | 3438 | ||
@@ -3505,7 +3509,7 @@ decode_restorefh(struct xdr_stream *xdr) | |||
3505 | static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req, | 3509 | static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req, |
3506 | size_t *acl_len) | 3510 | size_t *acl_len) |
3507 | { | 3511 | { |
3508 | uint32_t *savep; | 3512 | __be32 *savep; |
3509 | uint32_t attrlen, | 3513 | uint32_t attrlen, |
3510 | bitmap[2] = {0}; | 3514 | bitmap[2] = {0}; |
3511 | struct kvec *iov = req->rq_rcv_buf.head; | 3515 | struct kvec *iov = req->rq_rcv_buf.head; |
@@ -3551,7 +3555,7 @@ decode_savefh(struct xdr_stream *xdr) | |||
3551 | 3555 | ||
3552 | static int decode_setattr(struct xdr_stream *xdr, struct nfs_setattrres *res) | 3556 | static int decode_setattr(struct xdr_stream *xdr, struct nfs_setattrres *res) |
3553 | { | 3557 | { |
3554 | uint32_t *p; | 3558 | __be32 *p; |
3555 | uint32_t bmlen; | 3559 | uint32_t bmlen; |
3556 | int status; | 3560 | int status; |
3557 | 3561 | ||
@@ -3567,7 +3571,7 @@ static int decode_setattr(struct xdr_stream *xdr, struct nfs_setattrres *res) | |||
3567 | 3571 | ||
3568 | static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp) | 3572 | static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp) |
3569 | { | 3573 | { |
3570 | uint32_t *p; | 3574 | __be32 *p; |
3571 | uint32_t opnum; | 3575 | uint32_t opnum; |
3572 | int32_t nfserr; | 3576 | int32_t nfserr; |
3573 | 3577 | ||
@@ -3610,7 +3614,7 @@ static int decode_setclientid_confirm(struct xdr_stream *xdr) | |||
3610 | 3614 | ||
3611 | static int decode_write(struct xdr_stream *xdr, struct nfs_writeres *res) | 3615 | static int decode_write(struct xdr_stream *xdr, struct nfs_writeres *res) |
3612 | { | 3616 | { |
3613 | uint32_t *p; | 3617 | __be32 *p; |
3614 | int status; | 3618 | int status; |
3615 | 3619 | ||
3616 | status = decode_op_hdr(xdr, OP_WRITE); | 3620 | status = decode_op_hdr(xdr, OP_WRITE); |
@@ -3632,7 +3636,7 @@ static int decode_delegreturn(struct xdr_stream *xdr) | |||
3632 | /* | 3636 | /* |
3633 | * Decode OPEN_DOWNGRADE response | 3637 | * Decode OPEN_DOWNGRADE response |
3634 | */ | 3638 | */ |
3635 | static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_closeres *res) | 3639 | static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res) |
3636 | { | 3640 | { |
3637 | struct xdr_stream xdr; | 3641 | struct xdr_stream xdr; |
3638 | struct compound_hdr hdr; | 3642 | struct compound_hdr hdr; |
@@ -3660,7 +3664,7 @@ out: | |||
3660 | /* | 3664 | /* |
3661 | * Decode ACCESS response | 3665 | * Decode ACCESS response |
3662 | */ | 3666 | */ |
3663 | static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_accessres *res) | 3667 | static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_accessres *res) |
3664 | { | 3668 | { |
3665 | struct xdr_stream xdr; | 3669 | struct xdr_stream xdr; |
3666 | struct compound_hdr hdr; | 3670 | struct compound_hdr hdr; |
@@ -3678,7 +3682,7 @@ out: | |||
3678 | /* | 3682 | /* |
3679 | * Decode LOOKUP response | 3683 | * Decode LOOKUP response |
3680 | */ | 3684 | */ |
3681 | static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_lookup_res *res) | 3685 | static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_lookup_res *res) |
3682 | { | 3686 | { |
3683 | struct xdr_stream xdr; | 3687 | struct xdr_stream xdr; |
3684 | struct compound_hdr hdr; | 3688 | struct compound_hdr hdr; |
@@ -3701,7 +3705,7 @@ out: | |||
3701 | /* | 3705 | /* |
3702 | * Decode LOOKUP_ROOT response | 3706 | * Decode LOOKUP_ROOT response |
3703 | */ | 3707 | */ |
3704 | static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_lookup_res *res) | 3708 | static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_lookup_res *res) |
3705 | { | 3709 | { |
3706 | struct xdr_stream xdr; | 3710 | struct xdr_stream xdr; |
3707 | struct compound_hdr hdr; | 3711 | struct compound_hdr hdr; |
@@ -3721,7 +3725,7 @@ out: | |||
3721 | /* | 3725 | /* |
3722 | * Decode REMOVE response | 3726 | * Decode REMOVE response |
3723 | */ | 3727 | */ |
3724 | static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_remove_res *res) | 3728 | static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_remove_res *res) |
3725 | { | 3729 | { |
3726 | struct xdr_stream xdr; | 3730 | struct xdr_stream xdr; |
3727 | struct compound_hdr hdr; | 3731 | struct compound_hdr hdr; |
@@ -3742,7 +3746,7 @@ out: | |||
3742 | /* | 3746 | /* |
3743 | * Decode RENAME response | 3747 | * Decode RENAME response |
3744 | */ | 3748 | */ |
3745 | static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_rename_res *res) | 3749 | static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_rename_res *res) |
3746 | { | 3750 | { |
3747 | struct xdr_stream xdr; | 3751 | struct xdr_stream xdr; |
3748 | struct compound_hdr hdr; | 3752 | struct compound_hdr hdr; |
@@ -3772,7 +3776,7 @@ out: | |||
3772 | /* | 3776 | /* |
3773 | * Decode LINK response | 3777 | * Decode LINK response |
3774 | */ | 3778 | */ |
3775 | static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_link_res *res) | 3779 | static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_link_res *res) |
3776 | { | 3780 | { |
3777 | struct xdr_stream xdr; | 3781 | struct xdr_stream xdr; |
3778 | struct compound_hdr hdr; | 3782 | struct compound_hdr hdr; |
@@ -3805,7 +3809,7 @@ out: | |||
3805 | /* | 3809 | /* |
3806 | * Decode CREATE response | 3810 | * Decode CREATE response |
3807 | */ | 3811 | */ |
3808 | static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_create_res *res) | 3812 | static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_create_res *res) |
3809 | { | 3813 | { |
3810 | struct xdr_stream xdr; | 3814 | struct xdr_stream xdr; |
3811 | struct compound_hdr hdr; | 3815 | struct compound_hdr hdr; |
@@ -3834,7 +3838,7 @@ out: | |||
3834 | /* | 3838 | /* |
3835 | * Decode SYMLINK response | 3839 | * Decode SYMLINK response |
3836 | */ | 3840 | */ |
3837 | static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_create_res *res) | 3841 | static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_create_res *res) |
3838 | { | 3842 | { |
3839 | return nfs4_xdr_dec_create(rqstp, p, res); | 3843 | return nfs4_xdr_dec_create(rqstp, p, res); |
3840 | } | 3844 | } |
@@ -3842,7 +3846,7 @@ static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4 | |||
3842 | /* | 3846 | /* |
3843 | * Decode GETATTR response | 3847 | * Decode GETATTR response |
3844 | */ | 3848 | */ |
3845 | static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_getattr_res *res) | 3849 | static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_getattr_res *res) |
3846 | { | 3850 | { |
3847 | struct xdr_stream xdr; | 3851 | struct xdr_stream xdr; |
3848 | struct compound_hdr hdr; | 3852 | struct compound_hdr hdr; |
@@ -3865,7 +3869,7 @@ out: | |||
3865 | * Encode an SETACL request | 3869 | * Encode an SETACL request |
3866 | */ | 3870 | */ |
3867 | static int | 3871 | static int |
3868 | nfs4_xdr_enc_setacl(struct rpc_rqst *req, uint32_t *p, struct nfs_setaclargs *args) | 3872 | nfs4_xdr_enc_setacl(struct rpc_rqst *req, __be32 *p, struct nfs_setaclargs *args) |
3869 | { | 3873 | { |
3870 | struct xdr_stream xdr; | 3874 | struct xdr_stream xdr; |
3871 | struct compound_hdr hdr = { | 3875 | struct compound_hdr hdr = { |
@@ -3886,7 +3890,7 @@ out: | |||
3886 | * Decode SETACL response | 3890 | * Decode SETACL response |
3887 | */ | 3891 | */ |
3888 | static int | 3892 | static int |
3889 | nfs4_xdr_dec_setacl(struct rpc_rqst *rqstp, uint32_t *p, void *res) | 3893 | nfs4_xdr_dec_setacl(struct rpc_rqst *rqstp, __be32 *p, void *res) |
3890 | { | 3894 | { |
3891 | struct xdr_stream xdr; | 3895 | struct xdr_stream xdr; |
3892 | struct compound_hdr hdr; | 3896 | struct compound_hdr hdr; |
@@ -3908,7 +3912,7 @@ out: | |||
3908 | * Decode GETACL response | 3912 | * Decode GETACL response |
3909 | */ | 3913 | */ |
3910 | static int | 3914 | static int |
3911 | nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, uint32_t *p, size_t *acl_len) | 3915 | nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, __be32 *p, size_t *acl_len) |
3912 | { | 3916 | { |
3913 | struct xdr_stream xdr; | 3917 | struct xdr_stream xdr; |
3914 | struct compound_hdr hdr; | 3918 | struct compound_hdr hdr; |
@@ -3930,7 +3934,7 @@ out: | |||
3930 | /* | 3934 | /* |
3931 | * Decode CLOSE response | 3935 | * Decode CLOSE response |
3932 | */ | 3936 | */ |
3933 | static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_closeres *res) | 3937 | static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res) |
3934 | { | 3938 | { |
3935 | struct xdr_stream xdr; | 3939 | struct xdr_stream xdr; |
3936 | struct compound_hdr hdr; | 3940 | struct compound_hdr hdr; |
@@ -3960,7 +3964,7 @@ out: | |||
3960 | /* | 3964 | /* |
3961 | * Decode OPEN response | 3965 | * Decode OPEN response |
3962 | */ | 3966 | */ |
3963 | static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_openres *res) | 3967 | static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res) |
3964 | { | 3968 | { |
3965 | struct xdr_stream xdr; | 3969 | struct xdr_stream xdr; |
3966 | struct compound_hdr hdr; | 3970 | struct compound_hdr hdr; |
@@ -3994,7 +3998,7 @@ out: | |||
3994 | /* | 3998 | /* |
3995 | * Decode OPEN_CONFIRM response | 3999 | * Decode OPEN_CONFIRM response |
3996 | */ | 4000 | */ |
3997 | static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_open_confirmres *res) | 4001 | static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp, __be32 *p, struct nfs_open_confirmres *res) |
3998 | { | 4002 | { |
3999 | struct xdr_stream xdr; | 4003 | struct xdr_stream xdr; |
4000 | struct compound_hdr hdr; | 4004 | struct compound_hdr hdr; |
@@ -4015,7 +4019,7 @@ out: | |||
4015 | /* | 4019 | /* |
4016 | * Decode OPEN response | 4020 | * Decode OPEN response |
4017 | */ | 4021 | */ |
4018 | static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_openres *res) | 4022 | static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res) |
4019 | { | 4023 | { |
4020 | struct xdr_stream xdr; | 4024 | struct xdr_stream xdr; |
4021 | struct compound_hdr hdr; | 4025 | struct compound_hdr hdr; |
@@ -4039,7 +4043,7 @@ out: | |||
4039 | /* | 4043 | /* |
4040 | * Decode SETATTR response | 4044 | * Decode SETATTR response |
4041 | */ | 4045 | */ |
4042 | static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_setattrres *res) | 4046 | static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_setattrres *res) |
4043 | { | 4047 | { |
4044 | struct xdr_stream xdr; | 4048 | struct xdr_stream xdr; |
4045 | struct compound_hdr hdr; | 4049 | struct compound_hdr hdr; |
@@ -4065,7 +4069,7 @@ out: | |||
4065 | /* | 4069 | /* |
4066 | * Decode LOCK response | 4070 | * Decode LOCK response |
4067 | */ | 4071 | */ |
4068 | static int nfs4_xdr_dec_lock(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_lock_res *res) | 4072 | static int nfs4_xdr_dec_lock(struct rpc_rqst *rqstp, __be32 *p, struct nfs_lock_res *res) |
4069 | { | 4073 | { |
4070 | struct xdr_stream xdr; | 4074 | struct xdr_stream xdr; |
4071 | struct compound_hdr hdr; | 4075 | struct compound_hdr hdr; |
@@ -4086,7 +4090,7 @@ out: | |||
4086 | /* | 4090 | /* |
4087 | * Decode LOCKT response | 4091 | * Decode LOCKT response |
4088 | */ | 4092 | */ |
4089 | static int nfs4_xdr_dec_lockt(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_lockt_res *res) | 4093 | static int nfs4_xdr_dec_lockt(struct rpc_rqst *rqstp, __be32 *p, struct nfs_lockt_res *res) |
4090 | { | 4094 | { |
4091 | struct xdr_stream xdr; | 4095 | struct xdr_stream xdr; |
4092 | struct compound_hdr hdr; | 4096 | struct compound_hdr hdr; |
@@ -4107,7 +4111,7 @@ out: | |||
4107 | /* | 4111 | /* |
4108 | * Decode LOCKU response | 4112 | * Decode LOCKU response |
4109 | */ | 4113 | */ |
4110 | static int nfs4_xdr_dec_locku(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_locku_res *res) | 4114 | static int nfs4_xdr_dec_locku(struct rpc_rqst *rqstp, __be32 *p, struct nfs_locku_res *res) |
4111 | { | 4115 | { |
4112 | struct xdr_stream xdr; | 4116 | struct xdr_stream xdr; |
4113 | struct compound_hdr hdr; | 4117 | struct compound_hdr hdr; |
@@ -4128,7 +4132,7 @@ out: | |||
4128 | /* | 4132 | /* |
4129 | * Decode READLINK response | 4133 | * Decode READLINK response |
4130 | */ | 4134 | */ |
4131 | static int nfs4_xdr_dec_readlink(struct rpc_rqst *rqstp, uint32_t *p, void *res) | 4135 | static int nfs4_xdr_dec_readlink(struct rpc_rqst *rqstp, __be32 *p, void *res) |
4132 | { | 4136 | { |
4133 | struct xdr_stream xdr; | 4137 | struct xdr_stream xdr; |
4134 | struct compound_hdr hdr; | 4138 | struct compound_hdr hdr; |
@@ -4149,7 +4153,7 @@ out: | |||
4149 | /* | 4153 | /* |
4150 | * Decode READDIR response | 4154 | * Decode READDIR response |
4151 | */ | 4155 | */ |
4152 | static int nfs4_xdr_dec_readdir(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_readdir_res *res) | 4156 | static int nfs4_xdr_dec_readdir(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_readdir_res *res) |
4153 | { | 4157 | { |
4154 | struct xdr_stream xdr; | 4158 | struct xdr_stream xdr; |
4155 | struct compound_hdr hdr; | 4159 | struct compound_hdr hdr; |
@@ -4170,7 +4174,7 @@ out: | |||
4170 | /* | 4174 | /* |
4171 | * Decode Read response | 4175 | * Decode Read response |
4172 | */ | 4176 | */ |
4173 | static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_readres *res) | 4177 | static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, __be32 *p, struct nfs_readres *res) |
4174 | { | 4178 | { |
4175 | struct xdr_stream xdr; | 4179 | struct xdr_stream xdr; |
4176 | struct compound_hdr hdr; | 4180 | struct compound_hdr hdr; |
@@ -4193,7 +4197,7 @@ out: | |||
4193 | /* | 4197 | /* |
4194 | * Decode WRITE response | 4198 | * Decode WRITE response |
4195 | */ | 4199 | */ |
4196 | static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_writeres *res) | 4200 | static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, __be32 *p, struct nfs_writeres *res) |
4197 | { | 4201 | { |
4198 | struct xdr_stream xdr; | 4202 | struct xdr_stream xdr; |
4199 | struct compound_hdr hdr; | 4203 | struct compound_hdr hdr; |
@@ -4219,7 +4223,7 @@ out: | |||
4219 | /* | 4223 | /* |
4220 | * Decode COMMIT response | 4224 | * Decode COMMIT response |
4221 | */ | 4225 | */ |
4222 | static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_writeres *res) | 4226 | static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, __be32 *p, struct nfs_writeres *res) |
4223 | { | 4227 | { |
4224 | struct xdr_stream xdr; | 4228 | struct xdr_stream xdr; |
4225 | struct compound_hdr hdr; | 4229 | struct compound_hdr hdr; |
@@ -4243,7 +4247,7 @@ out: | |||
4243 | /* | 4247 | /* |
4244 | * FSINFO request | 4248 | * FSINFO request |
4245 | */ | 4249 | */ |
4246 | static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, uint32_t *p, struct nfs_fsinfo *fsinfo) | 4250 | static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *fsinfo) |
4247 | { | 4251 | { |
4248 | struct xdr_stream xdr; | 4252 | struct xdr_stream xdr; |
4249 | struct compound_hdr hdr; | 4253 | struct compound_hdr hdr; |
@@ -4263,7 +4267,7 @@ static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, uint32_t *p, struct nfs_fsi | |||
4263 | /* | 4267 | /* |
4264 | * PATHCONF request | 4268 | * PATHCONF request |
4265 | */ | 4269 | */ |
4266 | static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, uint32_t *p, struct nfs_pathconf *pathconf) | 4270 | static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, __be32 *p, struct nfs_pathconf *pathconf) |
4267 | { | 4271 | { |
4268 | struct xdr_stream xdr; | 4272 | struct xdr_stream xdr; |
4269 | struct compound_hdr hdr; | 4273 | struct compound_hdr hdr; |
@@ -4281,7 +4285,7 @@ static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, uint32_t *p, struct nfs_p | |||
4281 | /* | 4285 | /* |
4282 | * STATFS request | 4286 | * STATFS request |
4283 | */ | 4287 | */ |
4284 | static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, uint32_t *p, struct nfs_fsstat *fsstat) | 4288 | static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, __be32 *p, struct nfs_fsstat *fsstat) |
4285 | { | 4289 | { |
4286 | struct xdr_stream xdr; | 4290 | struct xdr_stream xdr; |
4287 | struct compound_hdr hdr; | 4291 | struct compound_hdr hdr; |
@@ -4299,7 +4303,7 @@ static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, uint32_t *p, struct nfs_fss | |||
4299 | /* | 4303 | /* |
4300 | * GETATTR_BITMAP request | 4304 | * GETATTR_BITMAP request |
4301 | */ | 4305 | */ |
4302 | static int nfs4_xdr_dec_server_caps(struct rpc_rqst *req, uint32_t *p, struct nfs4_server_caps_res *res) | 4306 | static int nfs4_xdr_dec_server_caps(struct rpc_rqst *req, __be32 *p, struct nfs4_server_caps_res *res) |
4303 | { | 4307 | { |
4304 | struct xdr_stream xdr; | 4308 | struct xdr_stream xdr; |
4305 | struct compound_hdr hdr; | 4309 | struct compound_hdr hdr; |
@@ -4318,7 +4322,7 @@ out: | |||
4318 | /* | 4322 | /* |
4319 | * Decode RENEW response | 4323 | * Decode RENEW response |
4320 | */ | 4324 | */ |
4321 | static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, uint32_t *p, void *dummy) | 4325 | static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, __be32 *p, void *dummy) |
4322 | { | 4326 | { |
4323 | struct xdr_stream xdr; | 4327 | struct xdr_stream xdr; |
4324 | struct compound_hdr hdr; | 4328 | struct compound_hdr hdr; |
@@ -4334,7 +4338,7 @@ static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, uint32_t *p, void *dummy) | |||
4334 | /* | 4338 | /* |
4335 | * a SETCLIENTID request | 4339 | * a SETCLIENTID request |
4336 | */ | 4340 | */ |
4337 | static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, uint32_t *p, | 4341 | static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p, |
4338 | struct nfs_client *clp) | 4342 | struct nfs_client *clp) |
4339 | { | 4343 | { |
4340 | struct xdr_stream xdr; | 4344 | struct xdr_stream xdr; |
@@ -4353,7 +4357,7 @@ static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, uint32_t *p, | |||
4353 | /* | 4357 | /* |
4354 | * a SETCLIENTID_CONFIRM request | 4358 | * a SETCLIENTID_CONFIRM request |
4355 | */ | 4359 | */ |
4356 | static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, uint32_t *p, struct nfs_fsinfo *fsinfo) | 4360 | static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *fsinfo) |
4357 | { | 4361 | { |
4358 | struct xdr_stream xdr; | 4362 | struct xdr_stream xdr; |
4359 | struct compound_hdr hdr; | 4363 | struct compound_hdr hdr; |
@@ -4375,7 +4379,7 @@ static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, uint32_t *p, s | |||
4375 | /* | 4379 | /* |
4376 | * DELEGRETURN request | 4380 | * DELEGRETURN request |
4377 | */ | 4381 | */ |
4378 | static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_delegreturnres *res) | 4382 | static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_delegreturnres *res) |
4379 | { | 4383 | { |
4380 | struct xdr_stream xdr; | 4384 | struct xdr_stream xdr; |
4381 | struct compound_hdr hdr; | 4385 | struct compound_hdr hdr; |
@@ -4397,7 +4401,7 @@ out: | |||
4397 | /* | 4401 | /* |
4398 | * FS_LOCATIONS request | 4402 | * FS_LOCATIONS request |
4399 | */ | 4403 | */ |
4400 | static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, uint32_t *p, struct nfs4_fs_locations *res) | 4404 | static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs4_fs_locations *res) |
4401 | { | 4405 | { |
4402 | struct xdr_stream xdr; | 4406 | struct xdr_stream xdr; |
4403 | struct compound_hdr hdr; | 4407 | struct compound_hdr hdr; |
@@ -4417,7 +4421,7 @@ out: | |||
4417 | return status; | 4421 | return status; |
4418 | } | 4422 | } |
4419 | 4423 | ||
4420 | uint32_t *nfs4_decode_dirent(uint32_t *p, struct nfs_entry *entry, int plus) | 4424 | __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus) |
4421 | { | 4425 | { |
4422 | uint32_t bitmap[2] = {0}; | 4426 | uint32_t bitmap[2] = {0}; |
4423 | uint32_t len; | 4427 | uint32_t len; |
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c index 8dfefe41a8da..75f819dc0255 100644 --- a/fs/nfs/nfsroot.c +++ b/fs/nfs/nfsroot.c | |||
@@ -98,7 +98,7 @@ | |||
98 | static char nfs_root_name[256] __initdata = ""; | 98 | static char nfs_root_name[256] __initdata = ""; |
99 | 99 | ||
100 | /* Address of NFS server */ | 100 | /* Address of NFS server */ |
101 | static __u32 servaddr __initdata = 0; | 101 | static __be32 servaddr __initdata = 0; |
102 | 102 | ||
103 | /* Name of directory to mount */ | 103 | /* Name of directory to mount */ |
104 | static char nfs_path[NFS_MAXPATHLEN] __initdata = { 0, }; | 104 | static char nfs_path[NFS_MAXPATHLEN] __initdata = { 0, }; |
@@ -327,7 +327,7 @@ static int __init root_nfs_name(char *name) | |||
327 | */ | 327 | */ |
328 | static int __init root_nfs_addr(void) | 328 | static int __init root_nfs_addr(void) |
329 | { | 329 | { |
330 | if ((servaddr = root_server_addr) == INADDR_NONE) { | 330 | if ((servaddr = root_server_addr) == htonl(INADDR_NONE)) { |
331 | printk(KERN_ERR "Root-NFS: No NFS server available, giving up.\n"); | 331 | printk(KERN_ERR "Root-NFS: No NFS server available, giving up.\n"); |
332 | return -1; | 332 | return -1; |
333 | } | 333 | } |
@@ -411,7 +411,7 @@ __setup("nfsroot=", nfs_root_setup); | |||
411 | * Construct sockaddr_in from address and port number. | 411 | * Construct sockaddr_in from address and port number. |
412 | */ | 412 | */ |
413 | static inline void | 413 | static inline void |
414 | set_sockaddr(struct sockaddr_in *sin, __u32 addr, __u16 port) | 414 | set_sockaddr(struct sockaddr_in *sin, __be32 addr, __be16 port) |
415 | { | 415 | { |
416 | sin->sin_family = AF_INET; | 416 | sin->sin_family = AF_INET; |
417 | sin->sin_addr.s_addr = addr; | 417 | sin->sin_addr.s_addr = addr; |
@@ -468,14 +468,13 @@ static int __init root_nfs_ports(void) | |||
468 | dprintk("Root-NFS: Portmapper on server returned %d " | 468 | dprintk("Root-NFS: Portmapper on server returned %d " |
469 | "as nfsd port\n", port); | 469 | "as nfsd port\n", port); |
470 | } | 470 | } |
471 | nfs_port = htons(nfs_port); | ||
472 | 471 | ||
473 | if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) { | 472 | if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) { |
474 | printk(KERN_ERR "Root-NFS: Unable to get mountd port " | 473 | printk(KERN_ERR "Root-NFS: Unable to get mountd port " |
475 | "number from server, using default\n"); | 474 | "number from server, using default\n"); |
476 | port = mountd_port; | 475 | port = mountd_port; |
477 | } | 476 | } |
478 | mount_port = htons(port); | 477 | mount_port = port; |
479 | dprintk("Root-NFS: mountd port is %d\n", port); | 478 | dprintk("Root-NFS: mountd port is %d\n", port); |
480 | 479 | ||
481 | return 0; | 480 | return 0; |
@@ -496,7 +495,7 @@ static int __init root_nfs_get_handle(void) | |||
496 | int version = (nfs_data.flags & NFS_MOUNT_VER3) ? | 495 | int version = (nfs_data.flags & NFS_MOUNT_VER3) ? |
497 | NFS_MNT3_VERSION : NFS_MNT_VERSION; | 496 | NFS_MNT3_VERSION : NFS_MNT_VERSION; |
498 | 497 | ||
499 | set_sockaddr(&sin, servaddr, mount_port); | 498 | set_sockaddr(&sin, servaddr, htons(mount_port)); |
500 | status = nfsroot_mount(&sin, nfs_path, &fh, version, protocol); | 499 | status = nfsroot_mount(&sin, nfs_path, &fh, version, protocol); |
501 | if (status < 0) | 500 | if (status < 0) |
502 | printk(KERN_ERR "Root-NFS: Server returned error %d " | 501 | printk(KERN_ERR "Root-NFS: Server returned error %d " |
@@ -519,6 +518,6 @@ void * __init nfs_root_data(void) | |||
519 | || root_nfs_ports() < 0 | 518 | || root_nfs_ports() < 0 |
520 | || root_nfs_get_handle() < 0) | 519 | || root_nfs_get_handle() < 0) |
521 | return NULL; | 520 | return NULL; |
522 | set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, nfs_port); | 521 | set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, htons(nfs_port)); |
523 | return (void*)&nfs_data; | 522 | return (void*)&nfs_data; |
524 | } | 523 | } |
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 829af323f288..ca4b1d4ff42b 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -17,16 +17,17 @@ | |||
17 | #include <linux/nfs_page.h> | 17 | #include <linux/nfs_page.h> |
18 | #include <linux/nfs_fs.h> | 18 | #include <linux/nfs_fs.h> |
19 | #include <linux/nfs_mount.h> | 19 | #include <linux/nfs_mount.h> |
20 | #include <linux/writeback.h> | ||
20 | 21 | ||
21 | #define NFS_PARANOIA 1 | 22 | #define NFS_PARANOIA 1 |
22 | 23 | ||
23 | static kmem_cache_t *nfs_page_cachep; | 24 | static struct kmem_cache *nfs_page_cachep; |
24 | 25 | ||
25 | static inline struct nfs_page * | 26 | static inline struct nfs_page * |
26 | nfs_page_alloc(void) | 27 | nfs_page_alloc(void) |
27 | { | 28 | { |
28 | struct nfs_page *p; | 29 | struct nfs_page *p; |
29 | p = kmem_cache_alloc(nfs_page_cachep, SLAB_KERNEL); | 30 | p = kmem_cache_alloc(nfs_page_cachep, GFP_KERNEL); |
30 | if (p) { | 31 | if (p) { |
31 | memset(p, 0, sizeof(*p)); | 32 | memset(p, 0, sizeof(*p)); |
32 | INIT_LIST_HEAD(&p->wb_list); | 33 | INIT_LIST_HEAD(&p->wb_list); |
@@ -268,11 +269,10 @@ nfs_coalesce_requests(struct list_head *head, struct list_head *dst, | |||
268 | 269 | ||
269 | #define NFS_SCAN_MAXENTRIES 16 | 270 | #define NFS_SCAN_MAXENTRIES 16 |
270 | /** | 271 | /** |
271 | * nfs_scan_lock_dirty - Scan the radix tree for dirty requests | 272 | * nfs_scan_dirty - Scan the radix tree for dirty requests |
272 | * @nfsi: NFS inode | 273 | * @mapping: pointer to address space |
274 | * @wbc: writeback_control structure | ||
273 | * @dst: Destination list | 275 | * @dst: Destination list |
274 | * @idx_start: lower bound of page->index to scan | ||
275 | * @npages: idx_start + npages sets the upper bound to scan. | ||
276 | * | 276 | * |
277 | * Moves elements from one of the inode request lists. | 277 | * Moves elements from one of the inode request lists. |
278 | * If the number of requests is set to 0, the entire address_space | 278 | * If the number of requests is set to 0, the entire address_space |
@@ -280,46 +280,63 @@ nfs_coalesce_requests(struct list_head *head, struct list_head *dst, | |||
280 | * The requests are *not* checked to ensure that they form a contiguous set. | 280 | * The requests are *not* checked to ensure that they form a contiguous set. |
281 | * You must be holding the inode's req_lock when calling this function | 281 | * You must be holding the inode's req_lock when calling this function |
282 | */ | 282 | */ |
283 | int | 283 | long nfs_scan_dirty(struct address_space *mapping, |
284 | nfs_scan_lock_dirty(struct nfs_inode *nfsi, struct list_head *dst, | 284 | struct writeback_control *wbc, |
285 | unsigned long idx_start, unsigned int npages) | 285 | struct list_head *dst) |
286 | { | 286 | { |
287 | struct nfs_inode *nfsi = NFS_I(mapping->host); | ||
287 | struct nfs_page *pgvec[NFS_SCAN_MAXENTRIES]; | 288 | struct nfs_page *pgvec[NFS_SCAN_MAXENTRIES]; |
288 | struct nfs_page *req; | 289 | struct nfs_page *req; |
289 | unsigned long idx_end; | 290 | pgoff_t idx_start, idx_end; |
291 | long res = 0; | ||
290 | int found, i; | 292 | int found, i; |
291 | int res; | ||
292 | 293 | ||
293 | res = 0; | 294 | if (nfsi->ndirty == 0) |
294 | if (npages == 0) | 295 | return 0; |
295 | idx_end = ~0; | 296 | if (wbc->range_cyclic) { |
296 | else | 297 | idx_start = 0; |
297 | idx_end = idx_start + npages - 1; | 298 | idx_end = ULONG_MAX; |
299 | } else if (wbc->range_end == 0) { | ||
300 | idx_start = wbc->range_start >> PAGE_CACHE_SHIFT; | ||
301 | idx_end = ULONG_MAX; | ||
302 | } else { | ||
303 | idx_start = wbc->range_start >> PAGE_CACHE_SHIFT; | ||
304 | idx_end = wbc->range_end >> PAGE_CACHE_SHIFT; | ||
305 | } | ||
298 | 306 | ||
299 | for (;;) { | 307 | for (;;) { |
308 | unsigned int toscan = NFS_SCAN_MAXENTRIES; | ||
309 | |||
300 | found = radix_tree_gang_lookup_tag(&nfsi->nfs_page_tree, | 310 | found = radix_tree_gang_lookup_tag(&nfsi->nfs_page_tree, |
301 | (void **)&pgvec[0], idx_start, NFS_SCAN_MAXENTRIES, | 311 | (void **)&pgvec[0], idx_start, toscan, |
302 | NFS_PAGE_TAG_DIRTY); | 312 | NFS_PAGE_TAG_DIRTY); |
313 | |||
314 | /* Did we make progress? */ | ||
303 | if (found <= 0) | 315 | if (found <= 0) |
304 | break; | 316 | break; |
317 | |||
305 | for (i = 0; i < found; i++) { | 318 | for (i = 0; i < found; i++) { |
306 | req = pgvec[i]; | 319 | req = pgvec[i]; |
307 | if (req->wb_index > idx_end) | 320 | if (!wbc->range_cyclic && req->wb_index > idx_end) |
308 | goto out; | 321 | goto out; |
309 | 322 | ||
323 | /* Try to lock request and mark it for writeback */ | ||
324 | if (!nfs_set_page_writeback_locked(req)) | ||
325 | goto next; | ||
326 | radix_tree_tag_clear(&nfsi->nfs_page_tree, | ||
327 | req->wb_index, NFS_PAGE_TAG_DIRTY); | ||
328 | nfsi->ndirty--; | ||
329 | nfs_list_remove_request(req); | ||
330 | nfs_list_add_request(req, dst); | ||
331 | res++; | ||
332 | if (res == LONG_MAX) | ||
333 | goto out; | ||
334 | next: | ||
310 | idx_start = req->wb_index + 1; | 335 | idx_start = req->wb_index + 1; |
311 | |||
312 | if (nfs_set_page_writeback_locked(req)) { | ||
313 | radix_tree_tag_clear(&nfsi->nfs_page_tree, | ||
314 | req->wb_index, NFS_PAGE_TAG_DIRTY); | ||
315 | nfs_list_remove_request(req); | ||
316 | nfs_list_add_request(req, dst); | ||
317 | dec_zone_page_state(req->wb_page, NR_FILE_DIRTY); | ||
318 | res++; | ||
319 | } | ||
320 | } | 336 | } |
321 | } | 337 | } |
322 | out: | 338 | out: |
339 | WARN_ON ((nfsi->ndirty == 0) != list_empty(&nfsi->dirty)); | ||
323 | return res; | 340 | return res; |
324 | } | 341 | } |
325 | 342 | ||
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 4529cc4f3f8f..560536ad74a4 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -215,32 +215,6 @@ static int nfs_proc_read(struct nfs_read_data *rdata) | |||
215 | return status; | 215 | return status; |
216 | } | 216 | } |
217 | 217 | ||
218 | static int nfs_proc_write(struct nfs_write_data *wdata) | ||
219 | { | ||
220 | int flags = wdata->flags; | ||
221 | struct inode * inode = wdata->inode; | ||
222 | struct nfs_fattr * fattr = wdata->res.fattr; | ||
223 | struct rpc_message msg = { | ||
224 | .rpc_proc = &nfs_procedures[NFSPROC_WRITE], | ||
225 | .rpc_argp = &wdata->args, | ||
226 | .rpc_resp = &wdata->res, | ||
227 | .rpc_cred = wdata->cred, | ||
228 | }; | ||
229 | int status; | ||
230 | |||
231 | dprintk("NFS call write %d @ %Ld\n", wdata->args.count, | ||
232 | (long long) wdata->args.offset); | ||
233 | nfs_fattr_init(fattr); | ||
234 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags); | ||
235 | if (status >= 0) { | ||
236 | nfs_post_op_update_inode(inode, fattr); | ||
237 | wdata->res.count = wdata->args.count; | ||
238 | wdata->verf.committed = NFS_FILE_SYNC; | ||
239 | } | ||
240 | dprintk("NFS reply write: %d\n", status); | ||
241 | return status < 0? status : wdata->res.count; | ||
242 | } | ||
243 | |||
244 | static int | 218 | static int |
245 | nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | 219 | nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, |
246 | int flags, struct nameidata *nd) | 220 | int flags, struct nameidata *nd) |
@@ -545,13 +519,10 @@ nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | |||
545 | }; | 519 | }; |
546 | int status; | 520 | int status; |
547 | 521 | ||
548 | lock_kernel(); | ||
549 | |||
550 | dprintk("NFS call readdir %d\n", (unsigned int)cookie); | 522 | dprintk("NFS call readdir %d\n", (unsigned int)cookie); |
551 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); | 523 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); |
552 | 524 | ||
553 | dprintk("NFS reply readdir: %d\n", status); | 525 | dprintk("NFS reply readdir: %d\n", status); |
554 | unlock_kernel(); | ||
555 | return status; | 526 | return status; |
556 | } | 527 | } |
557 | 528 | ||
@@ -680,7 +651,7 @@ nfs_proc_commit_setup(struct nfs_write_data *data, int how) | |||
680 | static int | 651 | static int |
681 | nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl) | 652 | nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl) |
682 | { | 653 | { |
683 | return nlmclnt_proc(filp->f_dentry->d_inode, cmd, fl); | 654 | return nlmclnt_proc(filp->f_path.dentry->d_inode, cmd, fl); |
684 | } | 655 | } |
685 | 656 | ||
686 | 657 | ||
@@ -696,8 +667,6 @@ const struct nfs_rpc_ops nfs_v2_clientops = { | |||
696 | .access = NULL, /* access */ | 667 | .access = NULL, /* access */ |
697 | .readlink = nfs_proc_readlink, | 668 | .readlink = nfs_proc_readlink, |
698 | .read = nfs_proc_read, | 669 | .read = nfs_proc_read, |
699 | .write = nfs_proc_write, | ||
700 | .commit = NULL, /* commit */ | ||
701 | .create = nfs_proc_create, | 670 | .create = nfs_proc_create, |
702 | .remove = nfs_proc_remove, | 671 | .remove = nfs_proc_remove, |
703 | .unlink_setup = nfs_proc_unlink_setup, | 672 | .unlink_setup = nfs_proc_unlink_setup, |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index c2e49c397a27..a9c26521a9e2 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | #include <asm/system.h> | 31 | #include <asm/system.h> |
32 | 32 | ||
33 | #include "internal.h" | ||
33 | #include "iostat.h" | 34 | #include "iostat.h" |
34 | 35 | ||
35 | #define NFSDBG_FACILITY NFSDBG_PAGECACHE | 36 | #define NFSDBG_FACILITY NFSDBG_PAGECACHE |
@@ -38,7 +39,7 @@ static int nfs_pagein_one(struct list_head *, struct inode *); | |||
38 | static const struct rpc_call_ops nfs_read_partial_ops; | 39 | static const struct rpc_call_ops nfs_read_partial_ops; |
39 | static const struct rpc_call_ops nfs_read_full_ops; | 40 | static const struct rpc_call_ops nfs_read_full_ops; |
40 | 41 | ||
41 | static kmem_cache_t *nfs_rdata_cachep; | 42 | static struct kmem_cache *nfs_rdata_cachep; |
42 | static mempool_t *nfs_rdata_mempool; | 43 | static mempool_t *nfs_rdata_mempool; |
43 | 44 | ||
44 | #define MIN_POOL_READ (32) | 45 | #define MIN_POOL_READ (32) |
@@ -46,7 +47,7 @@ static mempool_t *nfs_rdata_mempool; | |||
46 | struct nfs_read_data *nfs_readdata_alloc(size_t len) | 47 | struct nfs_read_data *nfs_readdata_alloc(size_t len) |
47 | { | 48 | { |
48 | unsigned int pagecount = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; | 49 | unsigned int pagecount = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
49 | struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS); | 50 | struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, GFP_NOFS); |
50 | 51 | ||
51 | if (p) { | 52 | if (p) { |
52 | memset(p, 0, sizeof(*p)); | 53 | memset(p, 0, sizeof(*p)); |
@@ -65,32 +66,22 @@ struct nfs_read_data *nfs_readdata_alloc(size_t len) | |||
65 | return p; | 66 | return p; |
66 | } | 67 | } |
67 | 68 | ||
68 | static void nfs_readdata_free(struct nfs_read_data *p) | 69 | static void nfs_readdata_rcu_free(struct rcu_head *head) |
69 | { | 70 | { |
71 | struct nfs_read_data *p = container_of(head, struct nfs_read_data, task.u.tk_rcu); | ||
70 | if (p && (p->pagevec != &p->page_array[0])) | 72 | if (p && (p->pagevec != &p->page_array[0])) |
71 | kfree(p->pagevec); | 73 | kfree(p->pagevec); |
72 | mempool_free(p, nfs_rdata_mempool); | 74 | mempool_free(p, nfs_rdata_mempool); |
73 | } | 75 | } |
74 | 76 | ||
75 | void nfs_readdata_release(void *data) | 77 | static void nfs_readdata_free(struct nfs_read_data *rdata) |
76 | { | 78 | { |
77 | nfs_readdata_free(data); | 79 | call_rcu_bh(&rdata->task.u.tk_rcu, nfs_readdata_rcu_free); |
78 | } | 80 | } |
79 | 81 | ||
80 | static | 82 | void nfs_readdata_release(void *data) |
81 | unsigned int nfs_page_length(struct inode *inode, struct page *page) | ||
82 | { | 83 | { |
83 | loff_t i_size = i_size_read(inode); | 84 | nfs_readdata_free(data); |
84 | unsigned long idx; | ||
85 | |||
86 | if (i_size <= 0) | ||
87 | return 0; | ||
88 | idx = (i_size - 1) >> PAGE_CACHE_SHIFT; | ||
89 | if (page->index > idx) | ||
90 | return 0; | ||
91 | if (page->index != idx) | ||
92 | return PAGE_CACHE_SIZE; | ||
93 | return 1 + ((i_size - 1) & (PAGE_CACHE_SIZE - 1)); | ||
94 | } | 85 | } |
95 | 86 | ||
96 | static | 87 | static |
@@ -139,12 +130,12 @@ static int nfs_readpage_sync(struct nfs_open_context *ctx, struct inode *inode, | |||
139 | { | 130 | { |
140 | unsigned int rsize = NFS_SERVER(inode)->rsize; | 131 | unsigned int rsize = NFS_SERVER(inode)->rsize; |
141 | unsigned int count = PAGE_CACHE_SIZE; | 132 | unsigned int count = PAGE_CACHE_SIZE; |
142 | int result; | 133 | int result = -ENOMEM; |
143 | struct nfs_read_data *rdata; | 134 | struct nfs_read_data *rdata; |
144 | 135 | ||
145 | rdata = nfs_readdata_alloc(count); | 136 | rdata = nfs_readdata_alloc(count); |
146 | if (!rdata) | 137 | if (!rdata) |
147 | return -ENOMEM; | 138 | goto out_unlock; |
148 | 139 | ||
149 | memset(rdata, 0, sizeof(*rdata)); | 140 | memset(rdata, 0, sizeof(*rdata)); |
150 | rdata->flags = (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); | 141 | rdata->flags = (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); |
@@ -212,8 +203,9 @@ static int nfs_readpage_sync(struct nfs_open_context *ctx, struct inode *inode, | |||
212 | result = 0; | 203 | result = 0; |
213 | 204 | ||
214 | io_error: | 205 | io_error: |
215 | unlock_page(page); | ||
216 | nfs_readdata_free(rdata); | 206 | nfs_readdata_free(rdata); |
207 | out_unlock: | ||
208 | unlock_page(page); | ||
217 | return result; | 209 | return result; |
218 | } | 210 | } |
219 | 211 | ||
@@ -224,7 +216,7 @@ static int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode, | |||
224 | struct nfs_page *new; | 216 | struct nfs_page *new; |
225 | unsigned int len; | 217 | unsigned int len; |
226 | 218 | ||
227 | len = nfs_page_length(inode, page); | 219 | len = nfs_page_length(page); |
228 | if (len == 0) | 220 | if (len == 0) |
229 | return nfs_return_empty_page(page); | 221 | return nfs_return_empty_page(page); |
230 | new = nfs_create_request(ctx, inode, page, 0, len); | 222 | new = nfs_create_request(ctx, inode, page, 0, len); |
@@ -316,9 +308,7 @@ static void nfs_execute_read(struct nfs_read_data *data) | |||
316 | sigset_t oldset; | 308 | sigset_t oldset; |
317 | 309 | ||
318 | rpc_clnt_sigmask(clnt, &oldset); | 310 | rpc_clnt_sigmask(clnt, &oldset); |
319 | lock_kernel(); | ||
320 | rpc_execute(&data->task); | 311 | rpc_execute(&data->task); |
321 | unlock_kernel(); | ||
322 | rpc_clnt_sigunmask(clnt, &oldset); | 312 | rpc_clnt_sigunmask(clnt, &oldset); |
323 | } | 313 | } |
324 | 314 | ||
@@ -455,6 +445,55 @@ nfs_pagein_list(struct list_head *head, int rpages) | |||
455 | } | 445 | } |
456 | 446 | ||
457 | /* | 447 | /* |
448 | * This is the callback from RPC telling us whether a reply was | ||
449 | * received or some error occurred (timeout or socket shutdown). | ||
450 | */ | ||
451 | int nfs_readpage_result(struct rpc_task *task, struct nfs_read_data *data) | ||
452 | { | ||
453 | int status; | ||
454 | |||
455 | dprintk("%s: %4d, (status %d)\n", __FUNCTION__, task->tk_pid, | ||
456 | task->tk_status); | ||
457 | |||
458 | status = NFS_PROTO(data->inode)->read_done(task, data); | ||
459 | if (status != 0) | ||
460 | return status; | ||
461 | |||
462 | nfs_add_stats(data->inode, NFSIOS_SERVERREADBYTES, data->res.count); | ||
463 | |||
464 | if (task->tk_status == -ESTALE) { | ||
465 | set_bit(NFS_INO_STALE, &NFS_FLAGS(data->inode)); | ||
466 | nfs_mark_for_revalidate(data->inode); | ||
467 | } | ||
468 | spin_lock(&data->inode->i_lock); | ||
469 | NFS_I(data->inode)->cache_validity |= NFS_INO_INVALID_ATIME; | ||
470 | spin_unlock(&data->inode->i_lock); | ||
471 | return 0; | ||
472 | } | ||
473 | |||
474 | static int nfs_readpage_retry(struct rpc_task *task, struct nfs_read_data *data) | ||
475 | { | ||
476 | struct nfs_readargs *argp = &data->args; | ||
477 | struct nfs_readres *resp = &data->res; | ||
478 | |||
479 | if (resp->eof || resp->count == argp->count) | ||
480 | return 0; | ||
481 | |||
482 | /* This is a short read! */ | ||
483 | nfs_inc_stats(data->inode, NFSIOS_SHORTREAD); | ||
484 | /* Has the server at least made some progress? */ | ||
485 | if (resp->count == 0) | ||
486 | return 0; | ||
487 | |||
488 | /* Yes, so retry the read at the end of the data */ | ||
489 | argp->offset += resp->count; | ||
490 | argp->pgbase += resp->count; | ||
491 | argp->count -= resp->count; | ||
492 | rpc_restart_call(task); | ||
493 | return -EAGAIN; | ||
494 | } | ||
495 | |||
496 | /* | ||
458 | * Handle a read reply that fills part of a page. | 497 | * Handle a read reply that fills part of a page. |
459 | */ | 498 | */ |
460 | static void nfs_readpage_result_partial(struct rpc_task *task, void *calldata) | 499 | static void nfs_readpage_result_partial(struct rpc_task *task, void *calldata) |
@@ -463,12 +502,16 @@ static void nfs_readpage_result_partial(struct rpc_task *task, void *calldata) | |||
463 | struct nfs_page *req = data->req; | 502 | struct nfs_page *req = data->req; |
464 | struct page *page = req->wb_page; | 503 | struct page *page = req->wb_page; |
465 | 504 | ||
466 | if (likely(task->tk_status >= 0)) | ||
467 | nfs_readpage_truncate_uninitialised_page(data); | ||
468 | else | ||
469 | SetPageError(page); | ||
470 | if (nfs_readpage_result(task, data) != 0) | 505 | if (nfs_readpage_result(task, data) != 0) |
471 | return; | 506 | return; |
507 | |||
508 | if (likely(task->tk_status >= 0)) { | ||
509 | nfs_readpage_truncate_uninitialised_page(data); | ||
510 | if (nfs_readpage_retry(task, data) != 0) | ||
511 | return; | ||
512 | } | ||
513 | if (unlikely(task->tk_status < 0)) | ||
514 | SetPageError(page); | ||
472 | if (atomic_dec_and_test(&req->wb_complete)) { | 515 | if (atomic_dec_and_test(&req->wb_complete)) { |
473 | if (!PageError(page)) | 516 | if (!PageError(page)) |
474 | SetPageUptodate(page); | 517 | SetPageUptodate(page); |
@@ -496,25 +539,13 @@ static void nfs_readpage_set_pages_uptodate(struct nfs_read_data *data) | |||
496 | count += base; | 539 | count += base; |
497 | for (;count >= PAGE_CACHE_SIZE; count -= PAGE_CACHE_SIZE, pages++) | 540 | for (;count >= PAGE_CACHE_SIZE; count -= PAGE_CACHE_SIZE, pages++) |
498 | SetPageUptodate(*pages); | 541 | SetPageUptodate(*pages); |
499 | if (count != 0) | 542 | if (count == 0) |
543 | return; | ||
544 | /* Was this a short read? */ | ||
545 | if (data->res.eof || data->res.count == data->args.count) | ||
500 | SetPageUptodate(*pages); | 546 | SetPageUptodate(*pages); |
501 | } | 547 | } |
502 | 548 | ||
503 | static void nfs_readpage_set_pages_error(struct nfs_read_data *data) | ||
504 | { | ||
505 | unsigned int count = data->args.count; | ||
506 | unsigned int base = data->args.pgbase; | ||
507 | struct page **pages; | ||
508 | |||
509 | pages = &data->args.pages[base >> PAGE_CACHE_SHIFT]; | ||
510 | base &= ~PAGE_CACHE_MASK; | ||
511 | count += base; | ||
512 | for (;count >= PAGE_CACHE_SIZE; count -= PAGE_CACHE_SIZE, pages++) | ||
513 | SetPageError(*pages); | ||
514 | if (count != 0) | ||
515 | SetPageError(*pages); | ||
516 | } | ||
517 | |||
518 | /* | 549 | /* |
519 | * This is the callback from RPC telling us whether a reply was | 550 | * This is the callback from RPC telling us whether a reply was |
520 | * received or some error occurred (timeout or socket shutdown). | 551 | * received or some error occurred (timeout or socket shutdown). |
@@ -523,19 +554,20 @@ static void nfs_readpage_result_full(struct rpc_task *task, void *calldata) | |||
523 | { | 554 | { |
524 | struct nfs_read_data *data = calldata; | 555 | struct nfs_read_data *data = calldata; |
525 | 556 | ||
557 | if (nfs_readpage_result(task, data) != 0) | ||
558 | return; | ||
526 | /* | 559 | /* |
527 | * Note: nfs_readpage_result may change the values of | 560 | * Note: nfs_readpage_retry may change the values of |
528 | * data->args. In the multi-page case, we therefore need | 561 | * data->args. In the multi-page case, we therefore need |
529 | * to ensure that we call the next nfs_readpage_set_page_uptodate() | 562 | * to ensure that we call nfs_readpage_set_pages_uptodate() |
530 | * first in the multi-page case. | 563 | * first. |
531 | */ | 564 | */ |
532 | if (likely(task->tk_status >= 0)) { | 565 | if (likely(task->tk_status >= 0)) { |
533 | nfs_readpage_truncate_uninitialised_page(data); | 566 | nfs_readpage_truncate_uninitialised_page(data); |
534 | nfs_readpage_set_pages_uptodate(data); | 567 | nfs_readpage_set_pages_uptodate(data); |
535 | } else | 568 | if (nfs_readpage_retry(task, data) != 0) |
536 | nfs_readpage_set_pages_error(data); | 569 | return; |
537 | if (nfs_readpage_result(task, data) != 0) | 570 | } |
538 | return; | ||
539 | while (!list_empty(&data->pages)) { | 571 | while (!list_empty(&data->pages)) { |
540 | struct nfs_page *req = nfs_list_entry(data->pages.next); | 572 | struct nfs_page *req = nfs_list_entry(data->pages.next); |
541 | 573 | ||
@@ -550,50 +582,6 @@ static const struct rpc_call_ops nfs_read_full_ops = { | |||
550 | }; | 582 | }; |
551 | 583 | ||
552 | /* | 584 | /* |
553 | * This is the callback from RPC telling us whether a reply was | ||
554 | * received or some error occurred (timeout or socket shutdown). | ||
555 | */ | ||
556 | int nfs_readpage_result(struct rpc_task *task, struct nfs_read_data *data) | ||
557 | { | ||
558 | struct nfs_readargs *argp = &data->args; | ||
559 | struct nfs_readres *resp = &data->res; | ||
560 | int status; | ||
561 | |||
562 | dprintk("NFS: %4d nfs_readpage_result, (status %d)\n", | ||
563 | task->tk_pid, task->tk_status); | ||
564 | |||
565 | status = NFS_PROTO(data->inode)->read_done(task, data); | ||
566 | if (status != 0) | ||
567 | return status; | ||
568 | |||
569 | nfs_add_stats(data->inode, NFSIOS_SERVERREADBYTES, resp->count); | ||
570 | |||
571 | if (task->tk_status < 0) { | ||
572 | if (task->tk_status == -ESTALE) { | ||
573 | set_bit(NFS_INO_STALE, &NFS_FLAGS(data->inode)); | ||
574 | nfs_mark_for_revalidate(data->inode); | ||
575 | } | ||
576 | } else if (resp->count < argp->count && !resp->eof) { | ||
577 | /* This is a short read! */ | ||
578 | nfs_inc_stats(data->inode, NFSIOS_SHORTREAD); | ||
579 | /* Has the server at least made some progress? */ | ||
580 | if (resp->count != 0) { | ||
581 | /* Yes, so retry the read at the end of the data */ | ||
582 | argp->offset += resp->count; | ||
583 | argp->pgbase += resp->count; | ||
584 | argp->count -= resp->count; | ||
585 | rpc_restart_call(task); | ||
586 | return -EAGAIN; | ||
587 | } | ||
588 | task->tk_status = -EIO; | ||
589 | } | ||
590 | spin_lock(&data->inode->i_lock); | ||
591 | NFS_I(data->inode)->cache_validity |= NFS_INO_INVALID_ATIME; | ||
592 | spin_unlock(&data->inode->i_lock); | ||
593 | return 0; | ||
594 | } | ||
595 | |||
596 | /* | ||
597 | * Read a page over NFS. | 585 | * Read a page over NFS. |
598 | * We read the page synchronously in the following case: | 586 | * We read the page synchronously in the following case: |
599 | * - The error flag is set for this page. This happens only when a | 587 | * - The error flag is set for this page. This happens only when a |
@@ -626,9 +614,10 @@ int nfs_readpage(struct file *file, struct page *page) | |||
626 | goto out_error; | 614 | goto out_error; |
627 | 615 | ||
628 | if (file == NULL) { | 616 | if (file == NULL) { |
617 | error = -EBADF; | ||
629 | ctx = nfs_find_open_context(inode, NULL, FMODE_READ); | 618 | ctx = nfs_find_open_context(inode, NULL, FMODE_READ); |
630 | if (ctx == NULL) | 619 | if (ctx == NULL) |
631 | return -EBADF; | 620 | goto out_error; |
632 | } else | 621 | } else |
633 | ctx = get_nfs_open_context((struct nfs_open_context *) | 622 | ctx = get_nfs_open_context((struct nfs_open_context *) |
634 | file->private_data); | 623 | file->private_data); |
@@ -663,7 +652,7 @@ readpage_async_filler(void *data, struct page *page) | |||
663 | unsigned int len; | 652 | unsigned int len; |
664 | 653 | ||
665 | nfs_wb_page(inode, page); | 654 | nfs_wb_page(inode, page); |
666 | len = nfs_page_length(inode, page); | 655 | len = nfs_page_length(page); |
667 | if (len == 0) | 656 | if (len == 0) |
668 | return nfs_return_empty_page(page); | 657 | return nfs_return_empty_page(page); |
669 | new = nfs_create_request(desc->ctx, inode, page, 0, len); | 658 | new = nfs_create_request(desc->ctx, inode, page, 0, len); |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 28659a919d6e..28108c82b887 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -834,7 +834,7 @@ static int nfs4_get_sb(struct file_system_type *fs_type, | |||
834 | } | 834 | } |
835 | /* RFC3530: The default port for NFS is 2049 */ | 835 | /* RFC3530: The default port for NFS is 2049 */ |
836 | if (addr.sin_port == 0) | 836 | if (addr.sin_port == 0) |
837 | addr.sin_port = NFS_PORT; | 837 | addr.sin_port = htons(NFS_PORT); |
838 | 838 | ||
839 | /* Grab the authentication type */ | 839 | /* Grab the authentication type */ |
840 | authflavour = RPC_AUTH_UNIX; | 840 | authflavour = RPC_AUTH_UNIX; |
diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c index 600bbe630abd..6c686112cc03 100644 --- a/fs/nfs/symlink.c +++ b/fs/nfs/symlink.c | |||
@@ -33,9 +33,7 @@ static int nfs_symlink_filler(struct inode *inode, struct page *page) | |||
33 | { | 33 | { |
34 | int error; | 34 | int error; |
35 | 35 | ||
36 | lock_kernel(); | ||
37 | error = NFS_PROTO(inode)->readlink(inode, page, 0, PAGE_SIZE); | 36 | error = NFS_PROTO(inode)->readlink(inode, page, 0, PAGE_SIZE); |
38 | unlock_kernel(); | ||
39 | if (error < 0) | 37 | if (error < 0) |
40 | goto error; | 38 | goto error; |
41 | SetPageUptodate(page); | 39 | SetPageUptodate(page); |
diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c index 2fe3403c2409..3ea50ac64820 100644 --- a/fs/nfs/sysctl.c +++ b/fs/nfs/sysctl.c | |||
@@ -18,11 +18,6 @@ | |||
18 | static const int nfs_set_port_min = 0; | 18 | static const int nfs_set_port_min = 0; |
19 | static const int nfs_set_port_max = 65535; | 19 | static const int nfs_set_port_max = 65535; |
20 | static struct ctl_table_header *nfs_callback_sysctl_table; | 20 | static struct ctl_table_header *nfs_callback_sysctl_table; |
21 | /* | ||
22 | * Something that isn't CTL_ANY, CTL_NONE or a value that may clash. | ||
23 | * Use the same values as fs/lockd/svc.c | ||
24 | */ | ||
25 | #define CTL_UNNUMBERED -2 | ||
26 | 21 | ||
27 | static ctl_table nfs_cb_sysctls[] = { | 22 | static ctl_table nfs_cb_sysctls[] = { |
28 | #ifdef CONFIG_NFS_V4 | 23 | #ifdef CONFIG_NFS_V4 |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index f6675d2c386c..345492e78643 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -57,10 +57,13 @@ | |||
57 | #include <linux/nfs_fs.h> | 57 | #include <linux/nfs_fs.h> |
58 | #include <linux/nfs_mount.h> | 58 | #include <linux/nfs_mount.h> |
59 | #include <linux/nfs_page.h> | 59 | #include <linux/nfs_page.h> |
60 | #include <linux/backing-dev.h> | ||
61 | |||
60 | #include <asm/uaccess.h> | 62 | #include <asm/uaccess.h> |
61 | #include <linux/smp_lock.h> | 63 | #include <linux/smp_lock.h> |
62 | 64 | ||
63 | #include "delegation.h" | 65 | #include "delegation.h" |
66 | #include "internal.h" | ||
64 | #include "iostat.h" | 67 | #include "iostat.h" |
65 | 68 | ||
66 | #define NFSDBG_FACILITY NFSDBG_PAGECACHE | 69 | #define NFSDBG_FACILITY NFSDBG_PAGECACHE |
@@ -72,18 +75,17 @@ | |||
72 | * Local function declarations | 75 | * Local function declarations |
73 | */ | 76 | */ |
74 | static struct nfs_page * nfs_update_request(struct nfs_open_context*, | 77 | static struct nfs_page * nfs_update_request(struct nfs_open_context*, |
75 | struct inode *, | ||
76 | struct page *, | 78 | struct page *, |
77 | unsigned int, unsigned int); | 79 | unsigned int, unsigned int); |
80 | static void nfs_mark_request_dirty(struct nfs_page *req); | ||
78 | static int nfs_wait_on_write_congestion(struct address_space *, int); | 81 | static int nfs_wait_on_write_congestion(struct address_space *, int); |
79 | static int nfs_wait_on_requests(struct inode *, unsigned long, unsigned int); | 82 | static int nfs_wait_on_requests(struct inode *, unsigned long, unsigned int); |
80 | static int nfs_flush_inode(struct inode *inode, unsigned long idx_start, | 83 | static long nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how); |
81 | unsigned int npages, int how); | ||
82 | static const struct rpc_call_ops nfs_write_partial_ops; | 84 | static const struct rpc_call_ops nfs_write_partial_ops; |
83 | static const struct rpc_call_ops nfs_write_full_ops; | 85 | static const struct rpc_call_ops nfs_write_full_ops; |
84 | static const struct rpc_call_ops nfs_commit_ops; | 86 | static const struct rpc_call_ops nfs_commit_ops; |
85 | 87 | ||
86 | static kmem_cache_t *nfs_wdata_cachep; | 88 | static struct kmem_cache *nfs_wdata_cachep; |
87 | static mempool_t *nfs_wdata_mempool; | 89 | static mempool_t *nfs_wdata_mempool; |
88 | static mempool_t *nfs_commit_mempool; | 90 | static mempool_t *nfs_commit_mempool; |
89 | 91 | ||
@@ -91,7 +93,7 @@ static DECLARE_WAIT_QUEUE_HEAD(nfs_write_congestion); | |||
91 | 93 | ||
92 | struct nfs_write_data *nfs_commit_alloc(void) | 94 | struct nfs_write_data *nfs_commit_alloc(void) |
93 | { | 95 | { |
94 | struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, SLAB_NOFS); | 96 | struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, GFP_NOFS); |
95 | 97 | ||
96 | if (p) { | 98 | if (p) { |
97 | memset(p, 0, sizeof(*p)); | 99 | memset(p, 0, sizeof(*p)); |
@@ -100,17 +102,23 @@ struct nfs_write_data *nfs_commit_alloc(void) | |||
100 | return p; | 102 | return p; |
101 | } | 103 | } |
102 | 104 | ||
103 | void nfs_commit_free(struct nfs_write_data *p) | 105 | void nfs_commit_rcu_free(struct rcu_head *head) |
104 | { | 106 | { |
107 | struct nfs_write_data *p = container_of(head, struct nfs_write_data, task.u.tk_rcu); | ||
105 | if (p && (p->pagevec != &p->page_array[0])) | 108 | if (p && (p->pagevec != &p->page_array[0])) |
106 | kfree(p->pagevec); | 109 | kfree(p->pagevec); |
107 | mempool_free(p, nfs_commit_mempool); | 110 | mempool_free(p, nfs_commit_mempool); |
108 | } | 111 | } |
109 | 112 | ||
113 | void nfs_commit_free(struct nfs_write_data *wdata) | ||
114 | { | ||
115 | call_rcu_bh(&wdata->task.u.tk_rcu, nfs_commit_rcu_free); | ||
116 | } | ||
117 | |||
110 | struct nfs_write_data *nfs_writedata_alloc(size_t len) | 118 | struct nfs_write_data *nfs_writedata_alloc(size_t len) |
111 | { | 119 | { |
112 | unsigned int pagecount = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; | 120 | unsigned int pagecount = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
113 | struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS); | 121 | struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, GFP_NOFS); |
114 | 122 | ||
115 | if (p) { | 123 | if (p) { |
116 | memset(p, 0, sizeof(*p)); | 124 | memset(p, 0, sizeof(*p)); |
@@ -129,18 +137,47 @@ struct nfs_write_data *nfs_writedata_alloc(size_t len) | |||
129 | return p; | 137 | return p; |
130 | } | 138 | } |
131 | 139 | ||
132 | static void nfs_writedata_free(struct nfs_write_data *p) | 140 | static void nfs_writedata_rcu_free(struct rcu_head *head) |
133 | { | 141 | { |
142 | struct nfs_write_data *p = container_of(head, struct nfs_write_data, task.u.tk_rcu); | ||
134 | if (p && (p->pagevec != &p->page_array[0])) | 143 | if (p && (p->pagevec != &p->page_array[0])) |
135 | kfree(p->pagevec); | 144 | kfree(p->pagevec); |
136 | mempool_free(p, nfs_wdata_mempool); | 145 | mempool_free(p, nfs_wdata_mempool); |
137 | } | 146 | } |
138 | 147 | ||
148 | static void nfs_writedata_free(struct nfs_write_data *wdata) | ||
149 | { | ||
150 | call_rcu_bh(&wdata->task.u.tk_rcu, nfs_writedata_rcu_free); | ||
151 | } | ||
152 | |||
139 | void nfs_writedata_release(void *wdata) | 153 | void nfs_writedata_release(void *wdata) |
140 | { | 154 | { |
141 | nfs_writedata_free(wdata); | 155 | nfs_writedata_free(wdata); |
142 | } | 156 | } |
143 | 157 | ||
158 | static struct nfs_page *nfs_page_find_request_locked(struct page *page) | ||
159 | { | ||
160 | struct nfs_page *req = NULL; | ||
161 | |||
162 | if (PagePrivate(page)) { | ||
163 | req = (struct nfs_page *)page_private(page); | ||
164 | if (req != NULL) | ||
165 | atomic_inc(&req->wb_count); | ||
166 | } | ||
167 | return req; | ||
168 | } | ||
169 | |||
170 | static struct nfs_page *nfs_page_find_request(struct page *page) | ||
171 | { | ||
172 | struct nfs_page *req = NULL; | ||
173 | spinlock_t *req_lock = &NFS_I(page->mapping->host)->req_lock; | ||
174 | |||
175 | spin_lock(req_lock); | ||
176 | req = nfs_page_find_request_locked(page); | ||
177 | spin_unlock(req_lock); | ||
178 | return req; | ||
179 | } | ||
180 | |||
144 | /* Adjust the file length if we're writing beyond the end */ | 181 | /* Adjust the file length if we're writing beyond the end */ |
145 | static void nfs_grow_file(struct page *page, unsigned int offset, unsigned int count) | 182 | static void nfs_grow_file(struct page *page, unsigned int offset, unsigned int count) |
146 | { | 183 | { |
@@ -162,113 +199,34 @@ static void nfs_grow_file(struct page *page, unsigned int offset, unsigned int c | |||
162 | */ | 199 | */ |
163 | static void nfs_mark_uptodate(struct page *page, unsigned int base, unsigned int count) | 200 | static void nfs_mark_uptodate(struct page *page, unsigned int base, unsigned int count) |
164 | { | 201 | { |
165 | loff_t end_offs; | ||
166 | |||
167 | if (PageUptodate(page)) | 202 | if (PageUptodate(page)) |
168 | return; | 203 | return; |
169 | if (base != 0) | 204 | if (base != 0) |
170 | return; | 205 | return; |
171 | if (count == PAGE_CACHE_SIZE) { | 206 | if (count != nfs_page_length(page)) |
172 | SetPageUptodate(page); | ||
173 | return; | 207 | return; |
174 | } | 208 | if (count != PAGE_CACHE_SIZE) |
175 | |||
176 | end_offs = i_size_read(page->mapping->host) - 1; | ||
177 | if (end_offs < 0) | ||
178 | return; | ||
179 | /* Is this the last page? */ | ||
180 | if (page->index != (unsigned long)(end_offs >> PAGE_CACHE_SHIFT)) | ||
181 | return; | ||
182 | /* This is the last page: set PG_uptodate if we cover the entire | ||
183 | * extent of the data, then zero the rest of the page. | ||
184 | */ | ||
185 | if (count == (unsigned int)(end_offs & (PAGE_CACHE_SIZE - 1)) + 1) { | ||
186 | memclear_highpage_flush(page, count, PAGE_CACHE_SIZE - count); | 209 | memclear_highpage_flush(page, count, PAGE_CACHE_SIZE - count); |
187 | SetPageUptodate(page); | 210 | SetPageUptodate(page); |
188 | } | ||
189 | } | ||
190 | |||
191 | /* | ||
192 | * Write a page synchronously. | ||
193 | * Offset is the data offset within the page. | ||
194 | */ | ||
195 | static int nfs_writepage_sync(struct nfs_open_context *ctx, struct inode *inode, | ||
196 | struct page *page, unsigned int offset, unsigned int count, | ||
197 | int how) | ||
198 | { | ||
199 | unsigned int wsize = NFS_SERVER(inode)->wsize; | ||
200 | int result, written = 0; | ||
201 | struct nfs_write_data *wdata; | ||
202 | |||
203 | wdata = nfs_writedata_alloc(wsize); | ||
204 | if (!wdata) | ||
205 | return -ENOMEM; | ||
206 | |||
207 | wdata->flags = how; | ||
208 | wdata->cred = ctx->cred; | ||
209 | wdata->inode = inode; | ||
210 | wdata->args.fh = NFS_FH(inode); | ||
211 | wdata->args.context = ctx; | ||
212 | wdata->args.pages = &page; | ||
213 | wdata->args.stable = NFS_FILE_SYNC; | ||
214 | wdata->args.pgbase = offset; | ||
215 | wdata->args.count = wsize; | ||
216 | wdata->res.fattr = &wdata->fattr; | ||
217 | wdata->res.verf = &wdata->verf; | ||
218 | |||
219 | dprintk("NFS: nfs_writepage_sync(%s/%Ld %d@%Ld)\n", | ||
220 | inode->i_sb->s_id, | ||
221 | (long long)NFS_FILEID(inode), | ||
222 | count, (long long)(page_offset(page) + offset)); | ||
223 | |||
224 | set_page_writeback(page); | ||
225 | nfs_begin_data_update(inode); | ||
226 | do { | ||
227 | if (count < wsize) | ||
228 | wdata->args.count = count; | ||
229 | wdata->args.offset = page_offset(page) + wdata->args.pgbase; | ||
230 | |||
231 | result = NFS_PROTO(inode)->write(wdata); | ||
232 | |||
233 | if (result < 0) { | ||
234 | /* Must mark the page invalid after I/O error */ | ||
235 | ClearPageUptodate(page); | ||
236 | goto io_error; | ||
237 | } | ||
238 | if (result < wdata->args.count) | ||
239 | printk(KERN_WARNING "NFS: short write, count=%u, result=%d\n", | ||
240 | wdata->args.count, result); | ||
241 | |||
242 | wdata->args.offset += result; | ||
243 | wdata->args.pgbase += result; | ||
244 | written += result; | ||
245 | count -= result; | ||
246 | nfs_add_stats(inode, NFSIOS_SERVERWRITTENBYTES, result); | ||
247 | } while (count); | ||
248 | /* Update file length */ | ||
249 | nfs_grow_file(page, offset, written); | ||
250 | /* Set the PG_uptodate flag? */ | ||
251 | nfs_mark_uptodate(page, offset, written); | ||
252 | |||
253 | if (PageError(page)) | ||
254 | ClearPageError(page); | ||
255 | |||
256 | io_error: | ||
257 | nfs_end_data_update(inode); | ||
258 | end_page_writeback(page); | ||
259 | nfs_writedata_free(wdata); | ||
260 | return written ? written : result; | ||
261 | } | 211 | } |
262 | 212 | ||
263 | static int nfs_writepage_async(struct nfs_open_context *ctx, | 213 | static int nfs_writepage_setup(struct nfs_open_context *ctx, struct page *page, |
264 | struct inode *inode, struct page *page, | ||
265 | unsigned int offset, unsigned int count) | 214 | unsigned int offset, unsigned int count) |
266 | { | 215 | { |
267 | struct nfs_page *req; | 216 | struct nfs_page *req; |
217 | int ret; | ||
268 | 218 | ||
269 | req = nfs_update_request(ctx, inode, page, offset, count); | 219 | for (;;) { |
270 | if (IS_ERR(req)) | 220 | req = nfs_update_request(ctx, page, offset, count); |
271 | return PTR_ERR(req); | 221 | if (!IS_ERR(req)) |
222 | break; | ||
223 | ret = PTR_ERR(req); | ||
224 | if (ret != -EBUSY) | ||
225 | return ret; | ||
226 | ret = nfs_wb_page(page->mapping->host, page); | ||
227 | if (ret != 0) | ||
228 | return ret; | ||
229 | } | ||
272 | /* Update file length */ | 230 | /* Update file length */ |
273 | nfs_grow_file(page, offset, count); | 231 | nfs_grow_file(page, offset, count); |
274 | /* Set the PG_uptodate flag? */ | 232 | /* Set the PG_uptodate flag? */ |
@@ -287,73 +245,94 @@ static int wb_priority(struct writeback_control *wbc) | |||
287 | } | 245 | } |
288 | 246 | ||
289 | /* | 247 | /* |
248 | * Find an associated nfs write request, and prepare to flush it out | ||
249 | * Returns 1 if there was no write request, or if the request was | ||
250 | * already tagged by nfs_set_page_dirty.Returns 0 if the request | ||
251 | * was not tagged. | ||
252 | * May also return an error if the user signalled nfs_wait_on_request(). | ||
253 | */ | ||
254 | static int nfs_page_mark_flush(struct page *page) | ||
255 | { | ||
256 | struct nfs_page *req; | ||
257 | spinlock_t *req_lock = &NFS_I(page->mapping->host)->req_lock; | ||
258 | int ret; | ||
259 | |||
260 | spin_lock(req_lock); | ||
261 | for(;;) { | ||
262 | req = nfs_page_find_request_locked(page); | ||
263 | if (req == NULL) { | ||
264 | spin_unlock(req_lock); | ||
265 | return 1; | ||
266 | } | ||
267 | if (nfs_lock_request_dontget(req)) | ||
268 | break; | ||
269 | /* Note: If we hold the page lock, as is the case in nfs_writepage, | ||
270 | * then the call to nfs_lock_request_dontget() will always | ||
271 | * succeed provided that someone hasn't already marked the | ||
272 | * request as dirty (in which case we don't care). | ||
273 | */ | ||
274 | spin_unlock(req_lock); | ||
275 | ret = nfs_wait_on_request(req); | ||
276 | nfs_release_request(req); | ||
277 | if (ret != 0) | ||
278 | return ret; | ||
279 | spin_lock(req_lock); | ||
280 | } | ||
281 | spin_unlock(req_lock); | ||
282 | if (test_and_set_bit(PG_FLUSHING, &req->wb_flags) == 0) { | ||
283 | nfs_mark_request_dirty(req); | ||
284 | set_page_writeback(page); | ||
285 | } | ||
286 | ret = test_bit(PG_NEED_FLUSH, &req->wb_flags); | ||
287 | nfs_unlock_request(req); | ||
288 | return ret; | ||
289 | } | ||
290 | |||
291 | /* | ||
290 | * Write an mmapped page to the server. | 292 | * Write an mmapped page to the server. |
291 | */ | 293 | */ |
292 | int nfs_writepage(struct page *page, struct writeback_control *wbc) | 294 | static int nfs_writepage_locked(struct page *page, struct writeback_control *wbc) |
293 | { | 295 | { |
294 | struct nfs_open_context *ctx; | 296 | struct nfs_open_context *ctx; |
295 | struct inode *inode = page->mapping->host; | 297 | struct inode *inode = page->mapping->host; |
296 | unsigned long end_index; | 298 | unsigned offset; |
297 | unsigned offset = PAGE_CACHE_SIZE; | ||
298 | loff_t i_size = i_size_read(inode); | ||
299 | int inode_referenced = 0; | ||
300 | int priority = wb_priority(wbc); | ||
301 | int err; | 299 | int err; |
302 | 300 | ||
303 | nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE); | 301 | nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE); |
304 | nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1); | 302 | nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1); |
305 | 303 | ||
306 | /* | 304 | err = nfs_page_mark_flush(page); |
307 | * Note: We need to ensure that we have a reference to the inode | 305 | if (err <= 0) |
308 | * if we are to do asynchronous writes. If not, waiting | 306 | goto out; |
309 | * in nfs_wait_on_request() may deadlock with clear_inode(). | 307 | err = 0; |
310 | * | 308 | offset = nfs_page_length(page); |
311 | * If igrab() fails here, then it is in any case safe to | 309 | if (!offset) |
312 | * call nfs_wb_page(), since there will be no pending writes. | ||
313 | */ | ||
314 | if (igrab(inode) != 0) | ||
315 | inode_referenced = 1; | ||
316 | end_index = i_size >> PAGE_CACHE_SHIFT; | ||
317 | |||
318 | /* Ensure we've flushed out any previous writes */ | ||
319 | nfs_wb_page_priority(inode, page, priority); | ||
320 | |||
321 | /* easy case */ | ||
322 | if (page->index < end_index) | ||
323 | goto do_it; | ||
324 | /* things got complicated... */ | ||
325 | offset = i_size & (PAGE_CACHE_SIZE-1); | ||
326 | |||
327 | /* OK, are we completely out? */ | ||
328 | err = 0; /* potential race with truncate - ignore */ | ||
329 | if (page->index >= end_index+1 || !offset) | ||
330 | goto out; | 310 | goto out; |
331 | do_it: | 311 | |
332 | ctx = nfs_find_open_context(inode, NULL, FMODE_WRITE); | 312 | ctx = nfs_find_open_context(inode, NULL, FMODE_WRITE); |
333 | if (ctx == NULL) { | 313 | if (ctx == NULL) { |
334 | err = -EBADF; | 314 | err = -EBADF; |
335 | goto out; | 315 | goto out; |
336 | } | 316 | } |
337 | lock_kernel(); | 317 | err = nfs_writepage_setup(ctx, page, 0, offset); |
338 | if (!IS_SYNC(inode) && inode_referenced) { | ||
339 | err = nfs_writepage_async(ctx, inode, page, 0, offset); | ||
340 | if (!wbc->for_writepages) | ||
341 | nfs_flush_inode(inode, 0, 0, wb_priority(wbc)); | ||
342 | } else { | ||
343 | err = nfs_writepage_sync(ctx, inode, page, 0, | ||
344 | offset, priority); | ||
345 | if (err >= 0) { | ||
346 | if (err != offset) | ||
347 | redirty_page_for_writepage(wbc, page); | ||
348 | err = 0; | ||
349 | } | ||
350 | } | ||
351 | unlock_kernel(); | ||
352 | put_nfs_open_context(ctx); | 318 | put_nfs_open_context(ctx); |
319 | if (err != 0) | ||
320 | goto out; | ||
321 | err = nfs_page_mark_flush(page); | ||
322 | if (err > 0) | ||
323 | err = 0; | ||
353 | out: | 324 | out: |
325 | if (!wbc->for_writepages) | ||
326 | nfs_flush_mapping(page->mapping, wbc, wb_priority(wbc)); | ||
327 | return err; | ||
328 | } | ||
329 | |||
330 | int nfs_writepage(struct page *page, struct writeback_control *wbc) | ||
331 | { | ||
332 | int err; | ||
333 | |||
334 | err = nfs_writepage_locked(page, wbc); | ||
354 | unlock_page(page); | 335 | unlock_page(page); |
355 | if (inode_referenced) | ||
356 | iput(inode); | ||
357 | return err; | 336 | return err; |
358 | } | 337 | } |
359 | 338 | ||
@@ -377,25 +356,22 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc) | |||
377 | return 0; | 356 | return 0; |
378 | nfs_wait_on_write_congestion(mapping, 0); | 357 | nfs_wait_on_write_congestion(mapping, 0); |
379 | } | 358 | } |
380 | err = nfs_flush_inode(inode, 0, 0, wb_priority(wbc)); | 359 | err = nfs_flush_mapping(mapping, wbc, wb_priority(wbc)); |
381 | if (err < 0) | 360 | if (err < 0) |
382 | goto out; | 361 | goto out; |
383 | nfs_add_stats(inode, NFSIOS_WRITEPAGES, err); | 362 | nfs_add_stats(inode, NFSIOS_WRITEPAGES, err); |
384 | wbc->nr_to_write -= err; | ||
385 | if (!wbc->nonblocking && wbc->sync_mode == WB_SYNC_ALL) { | 363 | if (!wbc->nonblocking && wbc->sync_mode == WB_SYNC_ALL) { |
386 | err = nfs_wait_on_requests(inode, 0, 0); | 364 | err = nfs_wait_on_requests(inode, 0, 0); |
387 | if (err < 0) | 365 | if (err < 0) |
388 | goto out; | 366 | goto out; |
389 | } | 367 | } |
390 | err = nfs_commit_inode(inode, wb_priority(wbc)); | 368 | err = nfs_commit_inode(inode, wb_priority(wbc)); |
391 | if (err > 0) { | 369 | if (err > 0) |
392 | wbc->nr_to_write -= err; | ||
393 | err = 0; | 370 | err = 0; |
394 | } | ||
395 | out: | 371 | out: |
396 | clear_bit(BDI_write_congested, &bdi->state); | 372 | clear_bit(BDI_write_congested, &bdi->state); |
397 | wake_up_all(&nfs_write_congestion); | 373 | wake_up_all(&nfs_write_congestion); |
398 | writeback_congestion_end(); | 374 | congestion_end(WRITE); |
399 | return err; | 375 | return err; |
400 | } | 376 | } |
401 | 377 | ||
@@ -418,6 +394,7 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req) | |||
418 | nfsi->change_attr++; | 394 | nfsi->change_attr++; |
419 | } | 395 | } |
420 | SetPagePrivate(req->wb_page); | 396 | SetPagePrivate(req->wb_page); |
397 | set_page_private(req->wb_page, (unsigned long)req); | ||
421 | nfsi->npages++; | 398 | nfsi->npages++; |
422 | atomic_inc(&req->wb_count); | 399 | atomic_inc(&req->wb_count); |
423 | return 0; | 400 | return 0; |
@@ -434,6 +411,7 @@ static void nfs_inode_remove_request(struct nfs_page *req) | |||
434 | BUG_ON (!NFS_WBACK_BUSY(req)); | 411 | BUG_ON (!NFS_WBACK_BUSY(req)); |
435 | 412 | ||
436 | spin_lock(&nfsi->req_lock); | 413 | spin_lock(&nfsi->req_lock); |
414 | set_page_private(req->wb_page, 0); | ||
437 | ClearPagePrivate(req->wb_page); | 415 | ClearPagePrivate(req->wb_page); |
438 | radix_tree_delete(&nfsi->nfs_page_tree, req->wb_index); | 416 | radix_tree_delete(&nfsi->nfs_page_tree, req->wb_index); |
439 | nfsi->npages--; | 417 | nfsi->npages--; |
@@ -448,33 +426,6 @@ static void nfs_inode_remove_request(struct nfs_page *req) | |||
448 | } | 426 | } |
449 | 427 | ||
450 | /* | 428 | /* |
451 | * Find a request | ||
452 | */ | ||
453 | static inline struct nfs_page * | ||
454 | _nfs_find_request(struct inode *inode, unsigned long index) | ||
455 | { | ||
456 | struct nfs_inode *nfsi = NFS_I(inode); | ||
457 | struct nfs_page *req; | ||
458 | |||
459 | req = (struct nfs_page*)radix_tree_lookup(&nfsi->nfs_page_tree, index); | ||
460 | if (req) | ||
461 | atomic_inc(&req->wb_count); | ||
462 | return req; | ||
463 | } | ||
464 | |||
465 | static struct nfs_page * | ||
466 | nfs_find_request(struct inode *inode, unsigned long index) | ||
467 | { | ||
468 | struct nfs_page *req; | ||
469 | struct nfs_inode *nfsi = NFS_I(inode); | ||
470 | |||
471 | spin_lock(&nfsi->req_lock); | ||
472 | req = _nfs_find_request(inode, index); | ||
473 | spin_unlock(&nfsi->req_lock); | ||
474 | return req; | ||
475 | } | ||
476 | |||
477 | /* | ||
478 | * Add a request to the inode's dirty list. | 429 | * Add a request to the inode's dirty list. |
479 | */ | 430 | */ |
480 | static void | 431 | static void |
@@ -489,8 +440,14 @@ nfs_mark_request_dirty(struct nfs_page *req) | |||
489 | nfs_list_add_request(req, &nfsi->dirty); | 440 | nfs_list_add_request(req, &nfsi->dirty); |
490 | nfsi->ndirty++; | 441 | nfsi->ndirty++; |
491 | spin_unlock(&nfsi->req_lock); | 442 | spin_unlock(&nfsi->req_lock); |
492 | inc_zone_page_state(req->wb_page, NR_FILE_DIRTY); | 443 | __mark_inode_dirty(inode, I_DIRTY_PAGES); |
493 | mark_inode_dirty(inode); | 444 | } |
445 | |||
446 | static void | ||
447 | nfs_redirty_request(struct nfs_page *req) | ||
448 | { | ||
449 | clear_bit(PG_FLUSHING, &req->wb_flags); | ||
450 | __set_page_dirty_nobuffers(req->wb_page); | ||
494 | } | 451 | } |
495 | 452 | ||
496 | /* | 453 | /* |
@@ -499,8 +456,7 @@ nfs_mark_request_dirty(struct nfs_page *req) | |||
499 | static inline int | 456 | static inline int |
500 | nfs_dirty_request(struct nfs_page *req) | 457 | nfs_dirty_request(struct nfs_page *req) |
501 | { | 458 | { |
502 | struct nfs_inode *nfsi = NFS_I(req->wb_context->dentry->d_inode); | 459 | return test_bit(PG_FLUSHING, &req->wb_flags) == 0; |
503 | return !list_empty(&req->wb_list) && req->wb_list_head == &nfsi->dirty; | ||
504 | } | 460 | } |
505 | 461 | ||
506 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 462 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
@@ -518,7 +474,7 @@ nfs_mark_request_commit(struct nfs_page *req) | |||
518 | nfsi->ncommit++; | 474 | nfsi->ncommit++; |
519 | spin_unlock(&nfsi->req_lock); | 475 | spin_unlock(&nfsi->req_lock); |
520 | inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); | 476 | inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); |
521 | mark_inode_dirty(inode); | 477 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); |
522 | } | 478 | } |
523 | #endif | 479 | #endif |
524 | 480 | ||
@@ -588,36 +544,11 @@ static void nfs_cancel_commit_list(struct list_head *head) | |||
588 | 544 | ||
589 | while(!list_empty(head)) { | 545 | while(!list_empty(head)) { |
590 | req = nfs_list_entry(head->next); | 546 | req = nfs_list_entry(head->next); |
547 | dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); | ||
591 | nfs_list_remove_request(req); | 548 | nfs_list_remove_request(req); |
592 | nfs_inode_remove_request(req); | 549 | nfs_inode_remove_request(req); |
593 | dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); | 550 | nfs_unlock_request(req); |
594 | nfs_clear_page_writeback(req); | ||
595 | } | ||
596 | } | ||
597 | |||
598 | /* | ||
599 | * nfs_scan_dirty - Scan an inode for dirty requests | ||
600 | * @inode: NFS inode to scan | ||
601 | * @dst: destination list | ||
602 | * @idx_start: lower bound of page->index to scan. | ||
603 | * @npages: idx_start + npages sets the upper bound to scan. | ||
604 | * | ||
605 | * Moves requests from the inode's dirty page list. | ||
606 | * The requests are *not* checked to ensure that they form a contiguous set. | ||
607 | */ | ||
608 | static int | ||
609 | nfs_scan_dirty(struct inode *inode, struct list_head *dst, unsigned long idx_start, unsigned int npages) | ||
610 | { | ||
611 | struct nfs_inode *nfsi = NFS_I(inode); | ||
612 | int res = 0; | ||
613 | |||
614 | if (nfsi->ndirty != 0) { | ||
615 | res = nfs_scan_lock_dirty(nfsi, dst, idx_start, npages); | ||
616 | nfsi->ndirty -= res; | ||
617 | if ((nfsi->ndirty == 0) != list_empty(&nfsi->dirty)) | ||
618 | printk(KERN_ERR "NFS: desynchronized value of nfs_i.ndirty.\n"); | ||
619 | } | 551 | } |
620 | return res; | ||
621 | } | 552 | } |
622 | 553 | ||
623 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 554 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
@@ -696,27 +627,27 @@ static int nfs_wait_on_write_congestion(struct address_space *mapping, int intr) | |||
696 | * Note: Should always be called with the Page Lock held! | 627 | * Note: Should always be called with the Page Lock held! |
697 | */ | 628 | */ |
698 | static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx, | 629 | static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx, |
699 | struct inode *inode, struct page *page, | 630 | struct page *page, unsigned int offset, unsigned int bytes) |
700 | unsigned int offset, unsigned int bytes) | ||
701 | { | 631 | { |
702 | struct nfs_server *server = NFS_SERVER(inode); | 632 | struct inode *inode = page->mapping->host; |
703 | struct nfs_inode *nfsi = NFS_I(inode); | 633 | struct nfs_inode *nfsi = NFS_I(inode); |
704 | struct nfs_page *req, *new = NULL; | 634 | struct nfs_page *req, *new = NULL; |
705 | unsigned long rqend, end; | 635 | unsigned long rqend, end; |
706 | 636 | ||
707 | end = offset + bytes; | 637 | end = offset + bytes; |
708 | 638 | ||
709 | if (nfs_wait_on_write_congestion(page->mapping, server->flags & NFS_MOUNT_INTR)) | 639 | if (nfs_wait_on_write_congestion(page->mapping, NFS_SERVER(inode)->flags & NFS_MOUNT_INTR)) |
710 | return ERR_PTR(-ERESTARTSYS); | 640 | return ERR_PTR(-ERESTARTSYS); |
711 | for (;;) { | 641 | for (;;) { |
712 | /* Loop over all inode entries and see if we find | 642 | /* Loop over all inode entries and see if we find |
713 | * A request for the page we wish to update | 643 | * A request for the page we wish to update |
714 | */ | 644 | */ |
715 | spin_lock(&nfsi->req_lock); | 645 | spin_lock(&nfsi->req_lock); |
716 | req = _nfs_find_request(inode, page->index); | 646 | req = nfs_page_find_request_locked(page); |
717 | if (req) { | 647 | if (req) { |
718 | if (!nfs_lock_request_dontget(req)) { | 648 | if (!nfs_lock_request_dontget(req)) { |
719 | int error; | 649 | int error; |
650 | |||
720 | spin_unlock(&nfsi->req_lock); | 651 | spin_unlock(&nfsi->req_lock); |
721 | error = nfs_wait_on_request(req); | 652 | error = nfs_wait_on_request(req); |
722 | nfs_release_request(req); | 653 | nfs_release_request(req); |
@@ -743,7 +674,6 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx, | |||
743 | return ERR_PTR(error); | 674 | return ERR_PTR(error); |
744 | } | 675 | } |
745 | spin_unlock(&nfsi->req_lock); | 676 | spin_unlock(&nfsi->req_lock); |
746 | nfs_mark_request_dirty(new); | ||
747 | return new; | 677 | return new; |
748 | } | 678 | } |
749 | spin_unlock(&nfsi->req_lock); | 679 | spin_unlock(&nfsi->req_lock); |
@@ -784,9 +714,8 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx, | |||
784 | int nfs_flush_incompatible(struct file *file, struct page *page) | 714 | int nfs_flush_incompatible(struct file *file, struct page *page) |
785 | { | 715 | { |
786 | struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; | 716 | struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; |
787 | struct inode *inode = page->mapping->host; | ||
788 | struct nfs_page *req; | 717 | struct nfs_page *req; |
789 | int status = 0; | 718 | int do_flush, status; |
790 | /* | 719 | /* |
791 | * Look for a request corresponding to this page. If there | 720 | * Look for a request corresponding to this page. If there |
792 | * is one, and it belongs to another file, we flush it out | 721 | * is one, and it belongs to another file, we flush it out |
@@ -795,13 +724,18 @@ int nfs_flush_incompatible(struct file *file, struct page *page) | |||
795 | * Also do the same if we find a request from an existing | 724 | * Also do the same if we find a request from an existing |
796 | * dropped page. | 725 | * dropped page. |
797 | */ | 726 | */ |
798 | req = nfs_find_request(inode, page->index); | 727 | do { |
799 | if (req) { | 728 | req = nfs_page_find_request(page); |
800 | if (req->wb_page != page || ctx != req->wb_context) | 729 | if (req == NULL) |
801 | status = nfs_wb_page(inode, page); | 730 | return 0; |
731 | do_flush = req->wb_page != page || req->wb_context != ctx | ||
732 | || !nfs_dirty_request(req); | ||
802 | nfs_release_request(req); | 733 | nfs_release_request(req); |
803 | } | 734 | if (!do_flush) |
804 | return (status < 0) ? status : 0; | 735 | return 0; |
736 | status = nfs_wb_page(page->mapping->host, page); | ||
737 | } while (status == 0); | ||
738 | return status; | ||
805 | } | 739 | } |
806 | 740 | ||
807 | /* | 741 | /* |
@@ -815,72 +749,27 @@ int nfs_updatepage(struct file *file, struct page *page, | |||
815 | { | 749 | { |
816 | struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; | 750 | struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; |
817 | struct inode *inode = page->mapping->host; | 751 | struct inode *inode = page->mapping->host; |
818 | struct nfs_page *req; | ||
819 | int status = 0; | 752 | int status = 0; |
820 | 753 | ||
821 | nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE); | 754 | nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE); |
822 | 755 | ||
823 | dprintk("NFS: nfs_updatepage(%s/%s %d@%Ld)\n", | 756 | dprintk("NFS: nfs_updatepage(%s/%s %d@%Ld)\n", |
824 | file->f_dentry->d_parent->d_name.name, | 757 | file->f_path.dentry->d_parent->d_name.name, |
825 | file->f_dentry->d_name.name, count, | 758 | file->f_path.dentry->d_name.name, count, |
826 | (long long)(page_offset(page) +offset)); | 759 | (long long)(page_offset(page) +offset)); |
827 | 760 | ||
828 | if (IS_SYNC(inode)) { | ||
829 | status = nfs_writepage_sync(ctx, inode, page, offset, count, 0); | ||
830 | if (status > 0) { | ||
831 | if (offset == 0 && status == PAGE_CACHE_SIZE) | ||
832 | SetPageUptodate(page); | ||
833 | return 0; | ||
834 | } | ||
835 | return status; | ||
836 | } | ||
837 | |||
838 | /* If we're not using byte range locks, and we know the page | 761 | /* If we're not using byte range locks, and we know the page |
839 | * is entirely in cache, it may be more efficient to avoid | 762 | * is entirely in cache, it may be more efficient to avoid |
840 | * fragmenting write requests. | 763 | * fragmenting write requests. |
841 | */ | 764 | */ |
842 | if (PageUptodate(page) && inode->i_flock == NULL && !(file->f_mode & O_SYNC)) { | 765 | if (PageUptodate(page) && inode->i_flock == NULL && !(file->f_mode & O_SYNC)) { |
843 | loff_t end_offs = i_size_read(inode) - 1; | 766 | count = max(count + offset, nfs_page_length(page)); |
844 | unsigned long end_index = end_offs >> PAGE_CACHE_SHIFT; | ||
845 | |||
846 | count += offset; | ||
847 | offset = 0; | 767 | offset = 0; |
848 | if (unlikely(end_offs < 0)) { | ||
849 | /* Do nothing */ | ||
850 | } else if (page->index == end_index) { | ||
851 | unsigned int pglen; | ||
852 | pglen = (unsigned int)(end_offs & (PAGE_CACHE_SIZE-1)) + 1; | ||
853 | if (count < pglen) | ||
854 | count = pglen; | ||
855 | } else if (page->index < end_index) | ||
856 | count = PAGE_CACHE_SIZE; | ||
857 | } | 768 | } |
858 | 769 | ||
859 | /* | 770 | status = nfs_writepage_setup(ctx, page, offset, count); |
860 | * Try to find an NFS request corresponding to this page | 771 | __set_page_dirty_nobuffers(page); |
861 | * and update it. | ||
862 | * If the existing request cannot be updated, we must flush | ||
863 | * it out now. | ||
864 | */ | ||
865 | do { | ||
866 | req = nfs_update_request(ctx, inode, page, offset, count); | ||
867 | status = (IS_ERR(req)) ? PTR_ERR(req) : 0; | ||
868 | if (status != -EBUSY) | ||
869 | break; | ||
870 | /* Request could not be updated. Flush it out and try again */ | ||
871 | status = nfs_wb_page(inode, page); | ||
872 | } while (status >= 0); | ||
873 | if (status < 0) | ||
874 | goto done; | ||
875 | 772 | ||
876 | status = 0; | ||
877 | |||
878 | /* Update file length */ | ||
879 | nfs_grow_file(page, offset, count); | ||
880 | /* Set the PG_uptodate flag? */ | ||
881 | nfs_mark_uptodate(page, req->wb_pgbase, req->wb_bytes); | ||
882 | nfs_unlock_request(req); | ||
883 | done: | ||
884 | dprintk("NFS: nfs_updatepage returns %d (isize %Ld)\n", | 773 | dprintk("NFS: nfs_updatepage returns %d (isize %Ld)\n", |
885 | status, (long long)i_size_read(inode)); | 774 | status, (long long)i_size_read(inode)); |
886 | if (status < 0) | 775 | if (status < 0) |
@@ -895,7 +784,7 @@ static void nfs_writepage_release(struct nfs_page *req) | |||
895 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 784 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
896 | if (!PageError(req->wb_page)) { | 785 | if (!PageError(req->wb_page)) { |
897 | if (NFS_NEED_RESCHED(req)) { | 786 | if (NFS_NEED_RESCHED(req)) { |
898 | nfs_mark_request_dirty(req); | 787 | nfs_redirty_request(req); |
899 | goto out; | 788 | goto out; |
900 | } else if (NFS_NEED_COMMIT(req)) { | 789 | } else if (NFS_NEED_COMMIT(req)) { |
901 | nfs_mark_request_commit(req); | 790 | nfs_mark_request_commit(req); |
@@ -977,9 +866,7 @@ static void nfs_execute_write(struct nfs_write_data *data) | |||
977 | sigset_t oldset; | 866 | sigset_t oldset; |
978 | 867 | ||
979 | rpc_clnt_sigmask(clnt, &oldset); | 868 | rpc_clnt_sigmask(clnt, &oldset); |
980 | lock_kernel(); | ||
981 | rpc_execute(&data->task); | 869 | rpc_execute(&data->task); |
982 | unlock_kernel(); | ||
983 | rpc_clnt_sigunmask(clnt, &oldset); | 870 | rpc_clnt_sigunmask(clnt, &oldset); |
984 | } | 871 | } |
985 | 872 | ||
@@ -1013,7 +900,6 @@ static int nfs_flush_multi(struct inode *inode, struct list_head *head, int how) | |||
1013 | atomic_set(&req->wb_complete, requests); | 900 | atomic_set(&req->wb_complete, requests); |
1014 | 901 | ||
1015 | ClearPageError(page); | 902 | ClearPageError(page); |
1016 | set_page_writeback(page); | ||
1017 | offset = 0; | 903 | offset = 0; |
1018 | nbytes = req->wb_bytes; | 904 | nbytes = req->wb_bytes; |
1019 | do { | 905 | do { |
@@ -1041,9 +927,9 @@ out_bad: | |||
1041 | while (!list_empty(&list)) { | 927 | while (!list_empty(&list)) { |
1042 | data = list_entry(list.next, struct nfs_write_data, pages); | 928 | data = list_entry(list.next, struct nfs_write_data, pages); |
1043 | list_del(&data->pages); | 929 | list_del(&data->pages); |
1044 | nfs_writedata_free(data); | 930 | nfs_writedata_release(data); |
1045 | } | 931 | } |
1046 | nfs_mark_request_dirty(req); | 932 | nfs_redirty_request(req); |
1047 | nfs_clear_page_writeback(req); | 933 | nfs_clear_page_writeback(req); |
1048 | return -ENOMEM; | 934 | return -ENOMEM; |
1049 | } | 935 | } |
@@ -1074,7 +960,6 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, int how) | |||
1074 | nfs_list_remove_request(req); | 960 | nfs_list_remove_request(req); |
1075 | nfs_list_add_request(req, &data->pages); | 961 | nfs_list_add_request(req, &data->pages); |
1076 | ClearPageError(req->wb_page); | 962 | ClearPageError(req->wb_page); |
1077 | set_page_writeback(req->wb_page); | ||
1078 | *pages++ = req->wb_page; | 963 | *pages++ = req->wb_page; |
1079 | count += req->wb_bytes; | 964 | count += req->wb_bytes; |
1080 | } | 965 | } |
@@ -1089,7 +974,7 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, int how) | |||
1089 | while (!list_empty(head)) { | 974 | while (!list_empty(head)) { |
1090 | struct nfs_page *req = nfs_list_entry(head->next); | 975 | struct nfs_page *req = nfs_list_entry(head->next); |
1091 | nfs_list_remove_request(req); | 976 | nfs_list_remove_request(req); |
1092 | nfs_mark_request_dirty(req); | 977 | nfs_redirty_request(req); |
1093 | nfs_clear_page_writeback(req); | 978 | nfs_clear_page_writeback(req); |
1094 | } | 979 | } |
1095 | return -ENOMEM; | 980 | return -ENOMEM; |
@@ -1124,7 +1009,7 @@ out_err: | |||
1124 | while (!list_empty(head)) { | 1009 | while (!list_empty(head)) { |
1125 | req = nfs_list_entry(head->next); | 1010 | req = nfs_list_entry(head->next); |
1126 | nfs_list_remove_request(req); | 1011 | nfs_list_remove_request(req); |
1127 | nfs_mark_request_dirty(req); | 1012 | nfs_redirty_request(req); |
1128 | nfs_clear_page_writeback(req); | 1013 | nfs_clear_page_writeback(req); |
1129 | } | 1014 | } |
1130 | return error; | 1015 | return error; |
@@ -1440,7 +1325,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata) | |||
1440 | } | 1325 | } |
1441 | /* We have a mismatch. Write the page again */ | 1326 | /* We have a mismatch. Write the page again */ |
1442 | dprintk(" mismatch\n"); | 1327 | dprintk(" mismatch\n"); |
1443 | nfs_mark_request_dirty(req); | 1328 | nfs_redirty_request(req); |
1444 | next: | 1329 | next: |
1445 | nfs_clear_page_writeback(req); | 1330 | nfs_clear_page_writeback(req); |
1446 | } | 1331 | } |
@@ -1457,18 +1342,17 @@ static inline int nfs_commit_list(struct inode *inode, struct list_head *head, i | |||
1457 | } | 1342 | } |
1458 | #endif | 1343 | #endif |
1459 | 1344 | ||
1460 | static int nfs_flush_inode(struct inode *inode, unsigned long idx_start, | 1345 | static long nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how) |
1461 | unsigned int npages, int how) | ||
1462 | { | 1346 | { |
1463 | struct nfs_inode *nfsi = NFS_I(inode); | 1347 | struct nfs_inode *nfsi = NFS_I(mapping->host); |
1464 | LIST_HEAD(head); | 1348 | LIST_HEAD(head); |
1465 | int res; | 1349 | long res; |
1466 | 1350 | ||
1467 | spin_lock(&nfsi->req_lock); | 1351 | spin_lock(&nfsi->req_lock); |
1468 | res = nfs_scan_dirty(inode, &head, idx_start, npages); | 1352 | res = nfs_scan_dirty(mapping, wbc, &head); |
1469 | spin_unlock(&nfsi->req_lock); | 1353 | spin_unlock(&nfsi->req_lock); |
1470 | if (res) { | 1354 | if (res) { |
1471 | int error = nfs_flush_list(inode, &head, res, how); | 1355 | int error = nfs_flush_list(mapping->host, &head, res, how); |
1472 | if (error < 0) | 1356 | if (error < 0) |
1473 | return error; | 1357 | return error; |
1474 | } | 1358 | } |
@@ -1494,38 +1378,62 @@ int nfs_commit_inode(struct inode *inode, int how) | |||
1494 | } | 1378 | } |
1495 | #endif | 1379 | #endif |
1496 | 1380 | ||
1497 | int nfs_sync_inode_wait(struct inode *inode, unsigned long idx_start, | 1381 | long nfs_sync_mapping_wait(struct address_space *mapping, struct writeback_control *wbc, int how) |
1498 | unsigned int npages, int how) | ||
1499 | { | 1382 | { |
1383 | struct inode *inode = mapping->host; | ||
1500 | struct nfs_inode *nfsi = NFS_I(inode); | 1384 | struct nfs_inode *nfsi = NFS_I(inode); |
1385 | unsigned long idx_start, idx_end; | ||
1386 | unsigned int npages = 0; | ||
1501 | LIST_HEAD(head); | 1387 | LIST_HEAD(head); |
1502 | int nocommit = how & FLUSH_NOCOMMIT; | 1388 | int nocommit = how & FLUSH_NOCOMMIT; |
1503 | int pages, ret; | 1389 | long pages, ret; |
1504 | 1390 | ||
1391 | /* FIXME */ | ||
1392 | if (wbc->range_cyclic) | ||
1393 | idx_start = 0; | ||
1394 | else { | ||
1395 | idx_start = wbc->range_start >> PAGE_CACHE_SHIFT; | ||
1396 | idx_end = wbc->range_end >> PAGE_CACHE_SHIFT; | ||
1397 | if (idx_end > idx_start) { | ||
1398 | unsigned long l_npages = 1 + idx_end - idx_start; | ||
1399 | npages = l_npages; | ||
1400 | if (sizeof(npages) != sizeof(l_npages) && | ||
1401 | (unsigned long)npages != l_npages) | ||
1402 | npages = 0; | ||
1403 | } | ||
1404 | } | ||
1505 | how &= ~FLUSH_NOCOMMIT; | 1405 | how &= ~FLUSH_NOCOMMIT; |
1506 | spin_lock(&nfsi->req_lock); | 1406 | spin_lock(&nfsi->req_lock); |
1507 | do { | 1407 | do { |
1408 | wbc->pages_skipped = 0; | ||
1508 | ret = nfs_wait_on_requests_locked(inode, idx_start, npages); | 1409 | ret = nfs_wait_on_requests_locked(inode, idx_start, npages); |
1509 | if (ret != 0) | 1410 | if (ret != 0) |
1510 | continue; | 1411 | continue; |
1511 | pages = nfs_scan_dirty(inode, &head, idx_start, npages); | 1412 | pages = nfs_scan_dirty(mapping, wbc, &head); |
1512 | if (pages != 0) { | 1413 | if (pages != 0) { |
1513 | spin_unlock(&nfsi->req_lock); | 1414 | spin_unlock(&nfsi->req_lock); |
1514 | if (how & FLUSH_INVALIDATE) | 1415 | if (how & FLUSH_INVALIDATE) { |
1515 | nfs_cancel_dirty_list(&head); | 1416 | nfs_cancel_dirty_list(&head); |
1516 | else | 1417 | ret = pages; |
1418 | } else | ||
1517 | ret = nfs_flush_list(inode, &head, pages, how); | 1419 | ret = nfs_flush_list(inode, &head, pages, how); |
1518 | spin_lock(&nfsi->req_lock); | 1420 | spin_lock(&nfsi->req_lock); |
1519 | continue; | 1421 | continue; |
1520 | } | 1422 | } |
1423 | if (wbc->pages_skipped != 0) | ||
1424 | continue; | ||
1521 | if (nocommit) | 1425 | if (nocommit) |
1522 | break; | 1426 | break; |
1523 | pages = nfs_scan_commit(inode, &head, idx_start, npages); | 1427 | pages = nfs_scan_commit(inode, &head, idx_start, npages); |
1524 | if (pages == 0) | 1428 | if (pages == 0) { |
1429 | if (wbc->pages_skipped != 0) | ||
1430 | continue; | ||
1525 | break; | 1431 | break; |
1432 | } | ||
1526 | if (how & FLUSH_INVALIDATE) { | 1433 | if (how & FLUSH_INVALIDATE) { |
1527 | spin_unlock(&nfsi->req_lock); | 1434 | spin_unlock(&nfsi->req_lock); |
1528 | nfs_cancel_commit_list(&head); | 1435 | nfs_cancel_commit_list(&head); |
1436 | ret = pages; | ||
1529 | spin_lock(&nfsi->req_lock); | 1437 | spin_lock(&nfsi->req_lock); |
1530 | continue; | 1438 | continue; |
1531 | } | 1439 | } |
@@ -1538,6 +1446,106 @@ int nfs_sync_inode_wait(struct inode *inode, unsigned long idx_start, | |||
1538 | return ret; | 1446 | return ret; |
1539 | } | 1447 | } |
1540 | 1448 | ||
1449 | /* | ||
1450 | * flush the inode to disk. | ||
1451 | */ | ||
1452 | int nfs_wb_all(struct inode *inode) | ||
1453 | { | ||
1454 | struct address_space *mapping = inode->i_mapping; | ||
1455 | struct writeback_control wbc = { | ||
1456 | .bdi = mapping->backing_dev_info, | ||
1457 | .sync_mode = WB_SYNC_ALL, | ||
1458 | .nr_to_write = LONG_MAX, | ||
1459 | .for_writepages = 1, | ||
1460 | .range_cyclic = 1, | ||
1461 | }; | ||
1462 | int ret; | ||
1463 | |||
1464 | ret = generic_writepages(mapping, &wbc); | ||
1465 | if (ret < 0) | ||
1466 | goto out; | ||
1467 | ret = nfs_sync_mapping_wait(mapping, &wbc, 0); | ||
1468 | if (ret >= 0) | ||
1469 | return 0; | ||
1470 | out: | ||
1471 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); | ||
1472 | return ret; | ||
1473 | } | ||
1474 | |||
1475 | int nfs_sync_mapping_range(struct address_space *mapping, loff_t range_start, loff_t range_end, int how) | ||
1476 | { | ||
1477 | struct writeback_control wbc = { | ||
1478 | .bdi = mapping->backing_dev_info, | ||
1479 | .sync_mode = WB_SYNC_ALL, | ||
1480 | .nr_to_write = LONG_MAX, | ||
1481 | .range_start = range_start, | ||
1482 | .range_end = range_end, | ||
1483 | .for_writepages = 1, | ||
1484 | }; | ||
1485 | int ret; | ||
1486 | |||
1487 | if (!(how & FLUSH_NOWRITEPAGE)) { | ||
1488 | ret = generic_writepages(mapping, &wbc); | ||
1489 | if (ret < 0) | ||
1490 | goto out; | ||
1491 | } | ||
1492 | ret = nfs_sync_mapping_wait(mapping, &wbc, how); | ||
1493 | if (ret >= 0) | ||
1494 | return 0; | ||
1495 | out: | ||
1496 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); | ||
1497 | return ret; | ||
1498 | } | ||
1499 | |||
1500 | int nfs_wb_page_priority(struct inode *inode, struct page *page, int how) | ||
1501 | { | ||
1502 | loff_t range_start = page_offset(page); | ||
1503 | loff_t range_end = range_start + (loff_t)(PAGE_CACHE_SIZE - 1); | ||
1504 | struct writeback_control wbc = { | ||
1505 | .bdi = page->mapping->backing_dev_info, | ||
1506 | .sync_mode = WB_SYNC_ALL, | ||
1507 | .nr_to_write = LONG_MAX, | ||
1508 | .range_start = range_start, | ||
1509 | .range_end = range_end, | ||
1510 | }; | ||
1511 | int ret; | ||
1512 | |||
1513 | BUG_ON(!PageLocked(page)); | ||
1514 | if (!(how & FLUSH_NOWRITEPAGE) && clear_page_dirty_for_io(page)) { | ||
1515 | ret = nfs_writepage_locked(page, &wbc); | ||
1516 | if (ret < 0) | ||
1517 | goto out; | ||
1518 | } | ||
1519 | ret = nfs_sync_mapping_wait(page->mapping, &wbc, how); | ||
1520 | if (ret >= 0) | ||
1521 | return 0; | ||
1522 | out: | ||
1523 | __mark_inode_dirty(inode, I_DIRTY_PAGES); | ||
1524 | return ret; | ||
1525 | } | ||
1526 | |||
1527 | /* | ||
1528 | * Write back all requests on one page - we do this before reading it. | ||
1529 | */ | ||
1530 | int nfs_wb_page(struct inode *inode, struct page* page) | ||
1531 | { | ||
1532 | return nfs_wb_page_priority(inode, page, FLUSH_STABLE); | ||
1533 | } | ||
1534 | |||
1535 | int nfs_set_page_dirty(struct page *page) | ||
1536 | { | ||
1537 | struct nfs_page *req; | ||
1538 | |||
1539 | req = nfs_page_find_request(page); | ||
1540 | if (req != NULL) { | ||
1541 | /* Mark any existing write requests for flushing */ | ||
1542 | set_bit(PG_NEED_FLUSH, &req->wb_flags); | ||
1543 | nfs_release_request(req); | ||
1544 | } | ||
1545 | return __set_page_dirty_nobuffers(page); | ||
1546 | } | ||
1547 | |||
1548 | |||
1541 | int __init nfs_init_writepagecache(void) | 1549 | int __init nfs_init_writepagecache(void) |
1542 | { | 1550 | { |
1543 | nfs_wdata_cachep = kmem_cache_create("nfs_write_data", | 1551 | nfs_wdata_cachep = kmem_cache_create("nfs_write_data", |