diff options
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/callback.c | 1 | ||||
-rw-r--r-- | fs/nfs/delegation.c | 1 | ||||
-rw-r--r-- | fs/nfs/dir.c | 100 | ||||
-rw-r--r-- | fs/nfs/nfs2xdr.c | 4 | ||||
-rw-r--r-- | fs/nfs/nfs3xdr.c | 4 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 4 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 2 | ||||
-rw-r--r-- | fs/nfs/super.c | 9 |
8 files changed, 80 insertions, 45 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index aeec017fe814..93a8b3bd69e3 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/completion.h> | 9 | #include <linux/completion.h> |
10 | #include <linux/ip.h> | 10 | #include <linux/ip.h> |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/smp_lock.h> | ||
13 | #include <linux/sunrpc/svc.h> | 12 | #include <linux/sunrpc/svc.h> |
14 | #include <linux/sunrpc/svcsock.h> | 13 | #include <linux/sunrpc/svcsock.h> |
15 | #include <linux/nfs_fs.h> | 14 | #include <linux/nfs_fs.h> |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 232a7eead33a..1fd62fc49be3 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
14 | #include <linux/smp_lock.h> | ||
15 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
16 | 15 | ||
17 | #include <linux/nfs4.h> | 16 | #include <linux/nfs4.h> |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 07ac3847e562..662df2a5fad5 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/mount.h> | 34 | #include <linux/mount.h> |
35 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
36 | #include <linux/vmalloc.h> | 36 | #include <linux/vmalloc.h> |
37 | #include <linux/kmemleak.h> | ||
37 | 38 | ||
38 | #include "delegation.h" | 39 | #include "delegation.h" |
39 | #include "iostat.h" | 40 | #include "iostat.h" |
@@ -194,9 +195,13 @@ typedef struct { | |||
194 | static | 195 | static |
195 | struct nfs_cache_array *nfs_readdir_get_array(struct page *page) | 196 | struct nfs_cache_array *nfs_readdir_get_array(struct page *page) |
196 | { | 197 | { |
198 | void *ptr; | ||
197 | if (page == NULL) | 199 | if (page == NULL) |
198 | return ERR_PTR(-EIO); | 200 | return ERR_PTR(-EIO); |
199 | return (struct nfs_cache_array *)kmap(page); | 201 | ptr = kmap(page); |
202 | if (ptr == NULL) | ||
203 | return ERR_PTR(-ENOMEM); | ||
204 | return ptr; | ||
200 | } | 205 | } |
201 | 206 | ||
202 | static | 207 | static |
@@ -213,6 +218,9 @@ int nfs_readdir_clear_array(struct page *page, gfp_t mask) | |||
213 | { | 218 | { |
214 | struct nfs_cache_array *array = nfs_readdir_get_array(page); | 219 | struct nfs_cache_array *array = nfs_readdir_get_array(page); |
215 | int i; | 220 | int i; |
221 | |||
222 | if (IS_ERR(array)) | ||
223 | return PTR_ERR(array); | ||
216 | for (i = 0; i < array->size; i++) | 224 | for (i = 0; i < array->size; i++) |
217 | kfree(array->array[i].string.name); | 225 | kfree(array->array[i].string.name); |
218 | nfs_readdir_release_array(page); | 226 | nfs_readdir_release_array(page); |
@@ -231,6 +239,11 @@ int nfs_readdir_make_qstr(struct qstr *string, const char *name, unsigned int le | |||
231 | string->name = kmemdup(name, len, GFP_KERNEL); | 239 | string->name = kmemdup(name, len, GFP_KERNEL); |
232 | if (string->name == NULL) | 240 | if (string->name == NULL) |
233 | return -ENOMEM; | 241 | return -ENOMEM; |
242 | /* | ||
243 | * Avoid a kmemleak false positive. The pointer to the name is stored | ||
244 | * in a page cache page which kmemleak does not scan. | ||
245 | */ | ||
246 | kmemleak_not_leak(string->name); | ||
234 | string->hash = full_name_hash(name, len); | 247 | string->hash = full_name_hash(name, len); |
235 | return 0; | 248 | return 0; |
236 | } | 249 | } |
@@ -244,7 +257,7 @@ int nfs_readdir_add_to_array(struct nfs_entry *entry, struct page *page) | |||
244 | 257 | ||
245 | if (IS_ERR(array)) | 258 | if (IS_ERR(array)) |
246 | return PTR_ERR(array); | 259 | return PTR_ERR(array); |
247 | ret = -EIO; | 260 | ret = -ENOSPC; |
248 | if (array->size >= MAX_READDIR_ARRAY) | 261 | if (array->size >= MAX_READDIR_ARRAY) |
249 | goto out; | 262 | goto out; |
250 | 263 | ||
@@ -255,9 +268,9 @@ int nfs_readdir_add_to_array(struct nfs_entry *entry, struct page *page) | |||
255 | if (ret) | 268 | if (ret) |
256 | goto out; | 269 | goto out; |
257 | array->last_cookie = entry->cookie; | 270 | array->last_cookie = entry->cookie; |
271 | array->size++; | ||
258 | if (entry->eof == 1) | 272 | if (entry->eof == 1) |
259 | array->eof_index = array->size; | 273 | array->eof_index = array->size; |
260 | array->size++; | ||
261 | out: | 274 | out: |
262 | nfs_readdir_release_array(page); | 275 | nfs_readdir_release_array(page); |
263 | return ret; | 276 | return ret; |
@@ -272,7 +285,7 @@ int nfs_readdir_search_for_pos(struct nfs_cache_array *array, nfs_readdir_descri | |||
272 | if (diff < 0) | 285 | if (diff < 0) |
273 | goto out_eof; | 286 | goto out_eof; |
274 | if (diff >= array->size) { | 287 | if (diff >= array->size) { |
275 | if (array->eof_index > 0) | 288 | if (array->eof_index >= 0) |
276 | goto out_eof; | 289 | goto out_eof; |
277 | desc->current_index += array->size; | 290 | desc->current_index += array->size; |
278 | return -EAGAIN; | 291 | return -EAGAIN; |
@@ -281,8 +294,6 @@ int nfs_readdir_search_for_pos(struct nfs_cache_array *array, nfs_readdir_descri | |||
281 | index = (unsigned int)diff; | 294 | index = (unsigned int)diff; |
282 | *desc->dir_cookie = array->array[index].cookie; | 295 | *desc->dir_cookie = array->array[index].cookie; |
283 | desc->cache_entry_index = index; | 296 | desc->cache_entry_index = index; |
284 | if (index == array->eof_index) | ||
285 | desc->eof = 1; | ||
286 | return 0; | 297 | return 0; |
287 | out_eof: | 298 | out_eof: |
288 | desc->eof = 1; | 299 | desc->eof = 1; |
@@ -296,17 +307,17 @@ int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_des | |||
296 | int status = -EAGAIN; | 307 | int status = -EAGAIN; |
297 | 308 | ||
298 | for (i = 0; i < array->size; i++) { | 309 | for (i = 0; i < array->size; i++) { |
299 | if (i == array->eof_index) { | ||
300 | desc->eof = 1; | ||
301 | status = -EBADCOOKIE; | ||
302 | } | ||
303 | if (array->array[i].cookie == *desc->dir_cookie) { | 310 | if (array->array[i].cookie == *desc->dir_cookie) { |
304 | desc->cache_entry_index = i; | 311 | desc->cache_entry_index = i; |
305 | status = 0; | 312 | status = 0; |
306 | break; | 313 | goto out; |
307 | } | 314 | } |
308 | } | 315 | } |
309 | 316 | if (i == array->eof_index) { | |
317 | desc->eof = 1; | ||
318 | status = -EBADCOOKIE; | ||
319 | } | ||
320 | out: | ||
310 | return status; | 321 | return status; |
311 | } | 322 | } |
312 | 323 | ||
@@ -449,7 +460,7 @@ out: | |||
449 | 460 | ||
450 | /* Perform conversion from xdr to cache array */ | 461 | /* Perform conversion from xdr to cache array */ |
451 | static | 462 | static |
452 | void nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *entry, | 463 | int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *entry, |
453 | void *xdr_page, struct page *page, unsigned int buflen) | 464 | void *xdr_page, struct page *page, unsigned int buflen) |
454 | { | 465 | { |
455 | struct xdr_stream stream; | 466 | struct xdr_stream stream; |
@@ -471,21 +482,29 @@ void nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *e | |||
471 | 482 | ||
472 | do { | 483 | do { |
473 | status = xdr_decode(desc, entry, &stream); | 484 | status = xdr_decode(desc, entry, &stream); |
474 | if (status != 0) | 485 | if (status != 0) { |
486 | if (status == -EAGAIN) | ||
487 | status = 0; | ||
475 | break; | 488 | break; |
489 | } | ||
476 | 490 | ||
477 | if (nfs_readdir_add_to_array(entry, page) == -1) | ||
478 | break; | ||
479 | if (desc->plus == 1) | 491 | if (desc->plus == 1) |
480 | nfs_prime_dcache(desc->file->f_path.dentry, entry); | 492 | nfs_prime_dcache(desc->file->f_path.dentry, entry); |
493 | |||
494 | status = nfs_readdir_add_to_array(entry, page); | ||
495 | if (status != 0) | ||
496 | break; | ||
481 | } while (!entry->eof); | 497 | } while (!entry->eof); |
482 | 498 | ||
483 | if (status == -EBADCOOKIE && entry->eof) { | 499 | if (status == -EBADCOOKIE && entry->eof) { |
484 | array = nfs_readdir_get_array(page); | 500 | array = nfs_readdir_get_array(page); |
485 | array->eof_index = array->size - 1; | 501 | if (!IS_ERR(array)) { |
486 | status = 0; | 502 | array->eof_index = array->size; |
487 | nfs_readdir_release_array(page); | 503 | status = 0; |
504 | nfs_readdir_release_array(page); | ||
505 | } | ||
488 | } | 506 | } |
507 | return status; | ||
489 | } | 508 | } |
490 | 509 | ||
491 | static | 510 | static |
@@ -537,7 +556,7 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, | |||
537 | struct nfs_entry entry; | 556 | struct nfs_entry entry; |
538 | struct file *file = desc->file; | 557 | struct file *file = desc->file; |
539 | struct nfs_cache_array *array; | 558 | struct nfs_cache_array *array; |
540 | int status = 0; | 559 | int status = -ENOMEM; |
541 | unsigned int array_size = ARRAY_SIZE(pages); | 560 | unsigned int array_size = ARRAY_SIZE(pages); |
542 | 561 | ||
543 | entry.prev_cookie = 0; | 562 | entry.prev_cookie = 0; |
@@ -549,6 +568,10 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, | |||
549 | goto out; | 568 | goto out; |
550 | 569 | ||
551 | array = nfs_readdir_get_array(page); | 570 | array = nfs_readdir_get_array(page); |
571 | if (IS_ERR(array)) { | ||
572 | status = PTR_ERR(array); | ||
573 | goto out; | ||
574 | } | ||
552 | memset(array, 0, sizeof(struct nfs_cache_array)); | 575 | memset(array, 0, sizeof(struct nfs_cache_array)); |
553 | array->eof_index = -1; | 576 | array->eof_index = -1; |
554 | 577 | ||
@@ -556,12 +579,19 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, | |||
556 | if (!pages_ptr) | 579 | if (!pages_ptr) |
557 | goto out_release_array; | 580 | goto out_release_array; |
558 | do { | 581 | do { |
582 | unsigned int pglen; | ||
559 | status = nfs_readdir_xdr_filler(pages, desc, &entry, file, inode); | 583 | status = nfs_readdir_xdr_filler(pages, desc, &entry, file, inode); |
560 | 584 | ||
561 | if (status < 0) | 585 | if (status < 0) |
562 | break; | 586 | break; |
563 | nfs_readdir_page_filler(desc, &entry, pages_ptr, page, array_size * PAGE_SIZE); | 587 | pglen = status; |
564 | } while (array->eof_index < 0 && array->size < MAX_READDIR_ARRAY); | 588 | status = nfs_readdir_page_filler(desc, &entry, pages_ptr, page, pglen); |
589 | if (status < 0) { | ||
590 | if (status == -ENOSPC) | ||
591 | status = 0; | ||
592 | break; | ||
593 | } | ||
594 | } while (array->eof_index < 0); | ||
565 | 595 | ||
566 | nfs_readdir_free_large_page(pages_ptr, pages, array_size); | 596 | nfs_readdir_free_large_page(pages_ptr, pages, array_size); |
567 | out_release_array: | 597 | out_release_array: |
@@ -582,8 +612,10 @@ static | |||
582 | int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page* page) | 612 | int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page* page) |
583 | { | 613 | { |
584 | struct inode *inode = desc->file->f_path.dentry->d_inode; | 614 | struct inode *inode = desc->file->f_path.dentry->d_inode; |
615 | int ret; | ||
585 | 616 | ||
586 | if (nfs_readdir_xdr_to_array(desc, page, inode) < 0) | 617 | ret = nfs_readdir_xdr_to_array(desc, page, inode); |
618 | if (ret < 0) | ||
587 | goto error; | 619 | goto error; |
588 | SetPageUptodate(page); | 620 | SetPageUptodate(page); |
589 | 621 | ||
@@ -595,7 +627,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page* page) | |||
595 | return 0; | 627 | return 0; |
596 | error: | 628 | error: |
597 | unlock_page(page); | 629 | unlock_page(page); |
598 | return -EIO; | 630 | return ret; |
599 | } | 631 | } |
600 | 632 | ||
601 | static | 633 | static |
@@ -608,12 +640,8 @@ void cache_page_release(nfs_readdir_descriptor_t *desc) | |||
608 | static | 640 | static |
609 | struct page *get_cache_page(nfs_readdir_descriptor_t *desc) | 641 | struct page *get_cache_page(nfs_readdir_descriptor_t *desc) |
610 | { | 642 | { |
611 | struct page *page; | 643 | return read_cache_page(desc->file->f_path.dentry->d_inode->i_mapping, |
612 | page = read_cache_page(desc->file->f_path.dentry->d_inode->i_mapping, | ||
613 | desc->page_index, (filler_t *)nfs_readdir_filler, desc); | 644 | desc->page_index, (filler_t *)nfs_readdir_filler, desc); |
614 | if (IS_ERR(page)) | ||
615 | desc->eof = 1; | ||
616 | return page; | ||
617 | } | 645 | } |
618 | 646 | ||
619 | /* | 647 | /* |
@@ -639,8 +667,10 @@ int find_cache_page(nfs_readdir_descriptor_t *desc) | |||
639 | static inline | 667 | static inline |
640 | int readdir_search_pagecache(nfs_readdir_descriptor_t *desc) | 668 | int readdir_search_pagecache(nfs_readdir_descriptor_t *desc) |
641 | { | 669 | { |
642 | int res = -EAGAIN; | 670 | int res; |
643 | 671 | ||
672 | if (desc->page_index == 0) | ||
673 | desc->current_index = 0; | ||
644 | while (1) { | 674 | while (1) { |
645 | res = find_cache_page(desc); | 675 | res = find_cache_page(desc); |
646 | if (res != -EAGAIN) | 676 | if (res != -EAGAIN) |
@@ -670,6 +700,8 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent, | |||
670 | struct dentry *dentry = NULL; | 700 | struct dentry *dentry = NULL; |
671 | 701 | ||
672 | array = nfs_readdir_get_array(desc->page); | 702 | array = nfs_readdir_get_array(desc->page); |
703 | if (IS_ERR(array)) | ||
704 | return PTR_ERR(array); | ||
673 | 705 | ||
674 | for (i = desc->cache_entry_index; i < array->size; i++) { | 706 | for (i = desc->cache_entry_index; i < array->size; i++) { |
675 | d_type = DT_UNKNOWN; | 707 | d_type = DT_UNKNOWN; |
@@ -685,11 +717,9 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent, | |||
685 | *desc->dir_cookie = array->array[i+1].cookie; | 717 | *desc->dir_cookie = array->array[i+1].cookie; |
686 | else | 718 | else |
687 | *desc->dir_cookie = array->last_cookie; | 719 | *desc->dir_cookie = array->last_cookie; |
688 | if (i == array->eof_index) { | ||
689 | desc->eof = 1; | ||
690 | break; | ||
691 | } | ||
692 | } | 720 | } |
721 | if (i == array->eof_index) | ||
722 | desc->eof = 1; | ||
693 | 723 | ||
694 | nfs_readdir_release_array(desc->page); | 724 | nfs_readdir_release_array(desc->page); |
695 | cache_page_release(desc); | 725 | cache_page_release(desc); |
@@ -1345,12 +1375,12 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry | |||
1345 | res = NULL; | 1375 | res = NULL; |
1346 | goto out; | 1376 | goto out; |
1347 | /* This turned out not to be a regular file */ | 1377 | /* This turned out not to be a regular file */ |
1348 | case -EISDIR: | ||
1349 | case -ENOTDIR: | 1378 | case -ENOTDIR: |
1350 | goto no_open; | 1379 | goto no_open; |
1351 | case -ELOOP: | 1380 | case -ELOOP: |
1352 | if (!(nd->intent.open.flags & O_NOFOLLOW)) | 1381 | if (!(nd->intent.open.flags & O_NOFOLLOW)) |
1353 | goto no_open; | 1382 | goto no_open; |
1383 | /* case -EISDIR: */ | ||
1354 | /* case -EINVAL: */ | 1384 | /* case -EINVAL: */ |
1355 | default: | 1385 | default: |
1356 | res = ERR_CAST(inode); | 1386 | res = ERR_CAST(inode); |
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index e6bf45710cc7..2563f765c9b4 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c | |||
@@ -423,7 +423,7 @@ nfs_xdr_readdirres(struct rpc_rqst *req, __be32 *p, void *dummy) | |||
423 | struct page **page; | 423 | struct page **page; |
424 | size_t hdrlen; | 424 | size_t hdrlen; |
425 | unsigned int pglen, recvd; | 425 | unsigned int pglen, recvd; |
426 | int status, nr = 0; | 426 | int status; |
427 | 427 | ||
428 | if ((status = ntohl(*p++))) | 428 | if ((status = ntohl(*p++))) |
429 | return nfs_stat_to_errno(status); | 429 | return nfs_stat_to_errno(status); |
@@ -443,7 +443,7 @@ nfs_xdr_readdirres(struct rpc_rqst *req, __be32 *p, void *dummy) | |||
443 | if (pglen > recvd) | 443 | if (pglen > recvd) |
444 | pglen = recvd; | 444 | pglen = recvd; |
445 | page = rcvbuf->pages; | 445 | page = rcvbuf->pages; |
446 | return nr; | 446 | return pglen; |
447 | } | 447 | } |
448 | 448 | ||
449 | static void print_overflow_msg(const char *func, const struct xdr_stream *xdr) | 449 | static void print_overflow_msg(const char *func, const struct xdr_stream *xdr) |
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index d9a5e832c257..748dc91a4a14 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c | |||
@@ -555,7 +555,7 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res | |||
555 | struct page **page; | 555 | struct page **page; |
556 | size_t hdrlen; | 556 | size_t hdrlen; |
557 | u32 recvd, pglen; | 557 | u32 recvd, pglen; |
558 | int status, nr = 0; | 558 | int status; |
559 | 559 | ||
560 | status = ntohl(*p++); | 560 | status = ntohl(*p++); |
561 | /* Decode post_op_attrs */ | 561 | /* Decode post_op_attrs */ |
@@ -586,7 +586,7 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res | |||
586 | pglen = recvd; | 586 | pglen = recvd; |
587 | page = rcvbuf->pages; | 587 | page = rcvbuf->pages; |
588 | 588 | ||
589 | return nr; | 589 | return pglen; |
590 | } | 590 | } |
591 | 591 | ||
592 | __be32 * | 592 | __be32 * |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 0f24cdf2cb13..6a653ffd8e4e 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2852,8 +2852,10 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | |||
2852 | nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args); | 2852 | nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args); |
2853 | res.pgbase = args.pgbase; | 2853 | res.pgbase = args.pgbase; |
2854 | status = nfs4_call_sync(NFS_SERVER(dir), &msg, &args, &res, 0); | 2854 | status = nfs4_call_sync(NFS_SERVER(dir), &msg, &args, &res, 0); |
2855 | if (status == 0) | 2855 | if (status >= 0) { |
2856 | memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE); | 2856 | memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE); |
2857 | status += args.pgbase; | ||
2858 | } | ||
2857 | 2859 | ||
2858 | nfs_invalidate_atime(dir); | 2860 | nfs_invalidate_atime(dir); |
2859 | 2861 | ||
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index f313c4cce7e4..b7a204ff6fe1 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -4518,7 +4518,7 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n | |||
4518 | xdr_read_pages(xdr, pglen); | 4518 | xdr_read_pages(xdr, pglen); |
4519 | 4519 | ||
4520 | 4520 | ||
4521 | return 0; | 4521 | return pglen; |
4522 | } | 4522 | } |
4523 | 4523 | ||
4524 | static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req) | 4524 | static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req) |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 0a42e8f4adcb..3c045044fca2 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <linux/nfs_mount.h> | 39 | #include <linux/nfs_mount.h> |
40 | #include <linux/nfs4_mount.h> | 40 | #include <linux/nfs4_mount.h> |
41 | #include <linux/lockd/bind.h> | 41 | #include <linux/lockd/bind.h> |
42 | #include <linux/smp_lock.h> | ||
43 | #include <linux/seq_file.h> | 42 | #include <linux/seq_file.h> |
44 | #include <linux/mount.h> | 43 | #include <linux/mount.h> |
45 | #include <linux/mnt_namespace.h> | 44 | #include <linux/mnt_namespace.h> |
@@ -67,6 +66,12 @@ | |||
67 | 66 | ||
68 | #define NFSDBG_FACILITY NFSDBG_VFS | 67 | #define NFSDBG_FACILITY NFSDBG_VFS |
69 | 68 | ||
69 | #ifdef CONFIG_NFS_V3 | ||
70 | #define NFS_DEFAULT_VERSION 3 | ||
71 | #else | ||
72 | #define NFS_DEFAULT_VERSION 2 | ||
73 | #endif | ||
74 | |||
70 | enum { | 75 | enum { |
71 | /* Mount options that take no arguments */ | 76 | /* Mount options that take no arguments */ |
72 | Opt_soft, Opt_hard, | 77 | Opt_soft, Opt_hard, |
@@ -2277,7 +2282,7 @@ static int nfs_get_sb(struct file_system_type *fs_type, | |||
2277 | }; | 2282 | }; |
2278 | int error = -ENOMEM; | 2283 | int error = -ENOMEM; |
2279 | 2284 | ||
2280 | data = nfs_alloc_parsed_mount_data(3); | 2285 | data = nfs_alloc_parsed_mount_data(NFS_DEFAULT_VERSION); |
2281 | mntfh = nfs_alloc_fhandle(); | 2286 | mntfh = nfs_alloc_fhandle(); |
2282 | if (data == NULL || mntfh == NULL) | 2287 | if (data == NULL || mntfh == NULL) |
2283 | goto out_free_fh; | 2288 | goto out_free_fh; |