diff options
Diffstat (limited to 'fs/nfs')
| -rw-r--r-- | fs/nfs/callback_xdr.c | 2 | ||||
| -rw-r--r-- | fs/nfs/client.c | 29 | ||||
| -rw-r--r-- | fs/nfs/dir.c | 2 | ||||
| -rw-r--r-- | fs/nfs/direct.c | 1 | ||||
| -rw-r--r-- | fs/nfs/file.c | 5 | ||||
| -rw-r--r-- | fs/nfs/fscache.c | 35 | ||||
| -rw-r--r-- | fs/nfs/fscache.h | 6 | ||||
| -rw-r--r-- | fs/nfs/inode.c | 54 | ||||
| -rw-r--r-- | fs/nfs/nfs2xdr.c | 1 | ||||
| -rw-r--r-- | fs/nfs/nfs3proc.c | 1 | ||||
| -rw-r--r-- | fs/nfs/nfs3xdr.c | 1 | ||||
| -rw-r--r-- | fs/nfs/nfs4namespace.c | 12 | ||||
| -rw-r--r-- | fs/nfs/nfs4proc.c | 18 | ||||
| -rw-r--r-- | fs/nfs/nfs4renewd.c | 6 | ||||
| -rw-r--r-- | fs/nfs/nfs4state.c | 2 | ||||
| -rw-r--r-- | fs/nfs/nfs4xdr.c | 2 | ||||
| -rw-r--r-- | fs/nfs/proc.c | 1 | ||||
| -rw-r--r-- | fs/nfs/super.c | 105 |
18 files changed, 138 insertions, 145 deletions
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index e5a2dac5f715..76b0aa0f73bf 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c | |||
| @@ -222,7 +222,7 @@ static unsigned decode_sessionid(struct xdr_stream *xdr, | |||
| 222 | 222 | ||
| 223 | p = read_buf(xdr, len); | 223 | p = read_buf(xdr, len); |
| 224 | if (unlikely(p == NULL)) | 224 | if (unlikely(p == NULL)) |
| 225 | return htonl(NFS4ERR_RESOURCE);; | 225 | return htonl(NFS4ERR_RESOURCE); |
| 226 | 226 | ||
| 227 | memcpy(sid->data, p, len); | 227 | memcpy(sid->data, p, len); |
| 228 | return 0; | 228 | return 0; |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index e350bd6a2334..99ea196f071f 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
| @@ -648,8 +648,6 @@ static int nfs_start_lockd(struct nfs_server *server) | |||
| 648 | .hostname = clp->cl_hostname, | 648 | .hostname = clp->cl_hostname, |
| 649 | .address = (struct sockaddr *)&clp->cl_addr, | 649 | .address = (struct sockaddr *)&clp->cl_addr, |
| 650 | .addrlen = clp->cl_addrlen, | 650 | .addrlen = clp->cl_addrlen, |
| 651 | .protocol = server->flags & NFS_MOUNT_TCP ? | ||
| 652 | IPPROTO_TCP : IPPROTO_UDP, | ||
| 653 | .nfs_version = clp->rpc_ops->version, | 651 | .nfs_version = clp->rpc_ops->version, |
| 654 | .noresvport = server->flags & NFS_MOUNT_NORESVPORT ? | 652 | .noresvport = server->flags & NFS_MOUNT_NORESVPORT ? |
| 655 | 1 : 0, | 653 | 1 : 0, |
| @@ -660,6 +658,14 @@ static int nfs_start_lockd(struct nfs_server *server) | |||
| 660 | if (server->flags & NFS_MOUNT_NONLM) | 658 | if (server->flags & NFS_MOUNT_NONLM) |
| 661 | return 0; | 659 | return 0; |
| 662 | 660 | ||
| 661 | switch (clp->cl_proto) { | ||
| 662 | default: | ||
| 663 | nlm_init.protocol = IPPROTO_TCP; | ||
| 664 | break; | ||
| 665 | case XPRT_TRANSPORT_UDP: | ||
| 666 | nlm_init.protocol = IPPROTO_UDP; | ||
| 667 | } | ||
| 668 | |||
| 663 | host = nlmclnt_init(&nlm_init); | 669 | host = nlmclnt_init(&nlm_init); |
| 664 | if (IS_ERR(host)) | 670 | if (IS_ERR(host)) |
| 665 | return PTR_ERR(host); | 671 | return PTR_ERR(host); |
| @@ -787,7 +793,7 @@ static int nfs_init_server(struct nfs_server *server, | |||
| 787 | dprintk("--> nfs_init_server()\n"); | 793 | dprintk("--> nfs_init_server()\n"); |
| 788 | 794 | ||
| 789 | #ifdef CONFIG_NFS_V3 | 795 | #ifdef CONFIG_NFS_V3 |
| 790 | if (data->flags & NFS_MOUNT_VER3) | 796 | if (data->version == 3) |
| 791 | cl_init.rpc_ops = &nfs_v3_clientops; | 797 | cl_init.rpc_ops = &nfs_v3_clientops; |
| 792 | #endif | 798 | #endif |
| 793 | 799 | ||
| @@ -933,10 +939,6 @@ static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, str | |||
| 933 | goto out_error; | 939 | goto out_error; |
| 934 | 940 | ||
| 935 | nfs_server_set_fsinfo(server, &fsinfo); | 941 | nfs_server_set_fsinfo(server, &fsinfo); |
| 936 | error = bdi_init(&server->backing_dev_info); | ||
| 937 | if (error) | ||
| 938 | goto out_error; | ||
| 939 | |||
| 940 | 942 | ||
| 941 | /* Get some general file system info */ | 943 | /* Get some general file system info */ |
| 942 | if (server->namelen == 0) { | 944 | if (server->namelen == 0) { |
| @@ -968,6 +970,7 @@ static void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_serve | |||
| 968 | target->acdirmin = source->acdirmin; | 970 | target->acdirmin = source->acdirmin; |
| 969 | target->acdirmax = source->acdirmax; | 971 | target->acdirmax = source->acdirmax; |
| 970 | target->caps = source->caps; | 972 | target->caps = source->caps; |
| 973 | target->options = source->options; | ||
| 971 | } | 974 | } |
| 972 | 975 | ||
| 973 | /* | 976 | /* |
| @@ -995,6 +998,12 @@ static struct nfs_server *nfs_alloc_server(void) | |||
| 995 | return NULL; | 998 | return NULL; |
| 996 | } | 999 | } |
| 997 | 1000 | ||
| 1001 | if (bdi_init(&server->backing_dev_info)) { | ||
| 1002 | nfs_free_iostats(server->io_stats); | ||
| 1003 | kfree(server); | ||
| 1004 | return NULL; | ||
| 1005 | } | ||
| 1006 | |||
| 998 | return server; | 1007 | return server; |
| 999 | } | 1008 | } |
| 1000 | 1009 | ||
| @@ -1171,7 +1180,7 @@ static int nfs4_init_client(struct nfs_client *clp, | |||
| 1171 | 1, flags & NFS_MOUNT_NORESVPORT); | 1180 | 1, flags & NFS_MOUNT_NORESVPORT); |
| 1172 | if (error < 0) | 1181 | if (error < 0) |
| 1173 | goto error; | 1182 | goto error; |
| 1174 | memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr)); | 1183 | strlcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr)); |
| 1175 | 1184 | ||
| 1176 | error = nfs_idmap_new(clp); | 1185 | error = nfs_idmap_new(clp); |
| 1177 | if (error < 0) { | 1186 | if (error < 0) { |
| @@ -1529,7 +1538,7 @@ static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos); | |||
| 1529 | static void nfs_server_list_stop(struct seq_file *p, void *v); | 1538 | static void nfs_server_list_stop(struct seq_file *p, void *v); |
| 1530 | static int nfs_server_list_show(struct seq_file *m, void *v); | 1539 | static int nfs_server_list_show(struct seq_file *m, void *v); |
| 1531 | 1540 | ||
| 1532 | static struct seq_operations nfs_server_list_ops = { | 1541 | static const struct seq_operations nfs_server_list_ops = { |
| 1533 | .start = nfs_server_list_start, | 1542 | .start = nfs_server_list_start, |
| 1534 | .next = nfs_server_list_next, | 1543 | .next = nfs_server_list_next, |
| 1535 | .stop = nfs_server_list_stop, | 1544 | .stop = nfs_server_list_stop, |
| @@ -1550,7 +1559,7 @@ static void *nfs_volume_list_next(struct seq_file *p, void *v, loff_t *pos); | |||
| 1550 | static void nfs_volume_list_stop(struct seq_file *p, void *v); | 1559 | static void nfs_volume_list_stop(struct seq_file *p, void *v); |
| 1551 | static int nfs_volume_list_show(struct seq_file *m, void *v); | 1560 | static int nfs_volume_list_show(struct seq_file *m, void *v); |
| 1552 | 1561 | ||
| 1553 | static struct seq_operations nfs_volume_list_ops = { | 1562 | static const struct seq_operations nfs_volume_list_ops = { |
| 1554 | .start = nfs_volume_list_start, | 1563 | .start = nfs_volume_list_start, |
| 1555 | .next = nfs_volume_list_next, | 1564 | .next = nfs_volume_list_next, |
| 1556 | .stop = nfs_volume_list_stop, | 1565 | .stop = nfs_volume_list_stop, |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 32062c33c859..7cb298525eef 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -1536,6 +1536,8 @@ nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) | |||
| 1536 | old_dentry->d_parent->d_name.name, old_dentry->d_name.name, | 1536 | old_dentry->d_parent->d_name.name, old_dentry->d_name.name, |
| 1537 | dentry->d_parent->d_name.name, dentry->d_name.name); | 1537 | dentry->d_parent->d_name.name, dentry->d_name.name); |
| 1538 | 1538 | ||
| 1539 | nfs_inode_return_delegation(inode); | ||
| 1540 | |||
| 1539 | d_drop(dentry); | 1541 | d_drop(dentry); |
| 1540 | error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name); | 1542 | error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name); |
| 1541 | if (error == 0) { | 1543 | if (error == 0) { |
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 6c3210099d51..e1d415e97849 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
| @@ -457,6 +457,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) | |||
| 457 | }; | 457 | }; |
| 458 | struct rpc_task_setup task_setup_data = { | 458 | struct rpc_task_setup task_setup_data = { |
| 459 | .rpc_client = NFS_CLIENT(inode), | 459 | .rpc_client = NFS_CLIENT(inode), |
| 460 | .rpc_message = &msg, | ||
| 460 | .callback_ops = &nfs_write_direct_ops, | 461 | .callback_ops = &nfs_write_direct_ops, |
| 461 | .workqueue = nfsiod_workqueue, | 462 | .workqueue = nfsiod_workqueue, |
| 462 | .flags = RPC_TASK_ASYNC, | 463 | .flags = RPC_TASK_ASYNC, |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 5021b75d2d1e..f5fdd39e037a 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
| @@ -59,7 +59,7 @@ static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl); | |||
| 59 | static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl); | 59 | static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl); |
| 60 | static int nfs_setlease(struct file *file, long arg, struct file_lock **fl); | 60 | static int nfs_setlease(struct file *file, long arg, struct file_lock **fl); |
| 61 | 61 | ||
| 62 | static struct vm_operations_struct nfs_file_vm_ops; | 62 | static const struct vm_operations_struct nfs_file_vm_ops; |
| 63 | 63 | ||
| 64 | const struct file_operations nfs_file_operations = { | 64 | const struct file_operations nfs_file_operations = { |
| 65 | .llseek = nfs_file_llseek, | 65 | .llseek = nfs_file_llseek, |
| @@ -525,6 +525,7 @@ const struct address_space_operations nfs_file_aops = { | |||
| 525 | .direct_IO = nfs_direct_IO, | 525 | .direct_IO = nfs_direct_IO, |
| 526 | .migratepage = nfs_migrate_page, | 526 | .migratepage = nfs_migrate_page, |
| 527 | .launder_page = nfs_launder_page, | 527 | .launder_page = nfs_launder_page, |
| 528 | .error_remove_page = generic_error_remove_page, | ||
| 528 | }; | 529 | }; |
| 529 | 530 | ||
| 530 | /* | 531 | /* |
| @@ -571,7 +572,7 @@ out_unlock: | |||
| 571 | return VM_FAULT_SIGBUS; | 572 | return VM_FAULT_SIGBUS; |
| 572 | } | 573 | } |
| 573 | 574 | ||
| 574 | static struct vm_operations_struct nfs_file_vm_ops = { | 575 | static const struct vm_operations_struct nfs_file_vm_ops = { |
| 575 | .fault = filemap_fault, | 576 | .fault = filemap_fault, |
| 576 | .page_mkwrite = nfs_vm_page_mkwrite, | 577 | .page_mkwrite = nfs_vm_page_mkwrite, |
| 577 | }; | 578 | }; |
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c index 379be678cb7e..fa588006588d 100644 --- a/fs/nfs/fscache.c +++ b/fs/nfs/fscache.c | |||
| @@ -58,17 +58,34 @@ void nfs_fscache_release_client_cookie(struct nfs_client *clp) | |||
| 58 | /* | 58 | /* |
| 59 | * Get the cache cookie for an NFS superblock. We have to handle | 59 | * Get the cache cookie for an NFS superblock. We have to handle |
| 60 | * uniquification here because the cache doesn't do it for us. | 60 | * uniquification here because the cache doesn't do it for us. |
| 61 | * | ||
| 62 | * The default uniquifier is just an empty string, but it may be overridden | ||
| 63 | * either by the 'fsc=xxx' option to mount, or by inheriting it from the parent | ||
| 64 | * superblock across an automount point of some nature. | ||
| 61 | */ | 65 | */ |
| 62 | void nfs_fscache_get_super_cookie(struct super_block *sb, | 66 | void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, |
| 63 | struct nfs_parsed_mount_data *data) | 67 | struct nfs_clone_mount *mntdata) |
| 64 | { | 68 | { |
| 65 | struct nfs_fscache_key *key, *xkey; | 69 | struct nfs_fscache_key *key, *xkey; |
| 66 | struct nfs_server *nfss = NFS_SB(sb); | 70 | struct nfs_server *nfss = NFS_SB(sb); |
| 67 | struct rb_node **p, *parent; | 71 | struct rb_node **p, *parent; |
| 68 | const char *uniq = data->fscache_uniq ?: ""; | ||
| 69 | int diff, ulen; | 72 | int diff, ulen; |
| 70 | 73 | ||
| 71 | ulen = strlen(uniq); | 74 | if (uniq) { |
| 75 | ulen = strlen(uniq); | ||
| 76 | } else if (mntdata) { | ||
| 77 | struct nfs_server *mnt_s = NFS_SB(mntdata->sb); | ||
| 78 | if (mnt_s->fscache_key) { | ||
| 79 | uniq = mnt_s->fscache_key->key.uniquifier; | ||
| 80 | ulen = mnt_s->fscache_key->key.uniq_len; | ||
| 81 | } | ||
| 82 | } | ||
| 83 | |||
| 84 | if (!uniq) { | ||
| 85 | uniq = ""; | ||
| 86 | ulen = 1; | ||
| 87 | } | ||
| 88 | |||
| 72 | key = kzalloc(sizeof(*key) + ulen, GFP_KERNEL); | 89 | key = kzalloc(sizeof(*key) + ulen, GFP_KERNEL); |
| 73 | if (!key) | 90 | if (!key) |
| 74 | return; | 91 | return; |
| @@ -342,17 +359,13 @@ int nfs_fscache_release_page(struct page *page, gfp_t gfp) | |||
| 342 | 359 | ||
| 343 | BUG_ON(!cookie); | 360 | BUG_ON(!cookie); |
| 344 | 361 | ||
| 345 | if (fscache_check_page_write(cookie, page)) { | ||
| 346 | if (!(gfp & __GFP_WAIT)) | ||
| 347 | return 0; | ||
| 348 | fscache_wait_on_page_write(cookie, page); | ||
| 349 | } | ||
| 350 | |||
| 351 | if (PageFsCache(page)) { | 362 | if (PageFsCache(page)) { |
| 352 | dfprintk(FSCACHE, "NFS: fscache releasepage (0x%p/0x%p/0x%p)\n", | 363 | dfprintk(FSCACHE, "NFS: fscache releasepage (0x%p/0x%p/0x%p)\n", |
| 353 | cookie, page, nfsi); | 364 | cookie, page, nfsi); |
| 354 | 365 | ||
| 355 | fscache_uncache_page(cookie, page); | 366 | if (!fscache_maybe_release_page(cookie, page, gfp)) |
| 367 | return 0; | ||
| 368 | |||
| 356 | nfs_add_fscache_stats(page->mapping->host, | 369 | nfs_add_fscache_stats(page->mapping->host, |
| 357 | NFSIOS_FSCACHE_PAGES_UNCACHED, 1); | 370 | NFSIOS_FSCACHE_PAGES_UNCACHED, 1); |
| 358 | } | 371 | } |
diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h index 6e809bb0ff08..b9c572d0679f 100644 --- a/fs/nfs/fscache.h +++ b/fs/nfs/fscache.h | |||
| @@ -74,7 +74,8 @@ extern void nfs_fscache_get_client_cookie(struct nfs_client *); | |||
| 74 | extern void nfs_fscache_release_client_cookie(struct nfs_client *); | 74 | extern void nfs_fscache_release_client_cookie(struct nfs_client *); |
| 75 | 75 | ||
| 76 | extern void nfs_fscache_get_super_cookie(struct super_block *, | 76 | extern void nfs_fscache_get_super_cookie(struct super_block *, |
| 77 | struct nfs_parsed_mount_data *); | 77 | const char *, |
| 78 | struct nfs_clone_mount *); | ||
| 78 | extern void nfs_fscache_release_super_cookie(struct super_block *); | 79 | extern void nfs_fscache_release_super_cookie(struct super_block *); |
| 79 | 80 | ||
| 80 | extern void nfs_fscache_init_inode_cookie(struct inode *); | 81 | extern void nfs_fscache_init_inode_cookie(struct inode *); |
| @@ -173,7 +174,8 @@ static inline void nfs_fscache_release_client_cookie(struct nfs_client *clp) {} | |||
| 173 | 174 | ||
| 174 | static inline void nfs_fscache_get_super_cookie( | 175 | static inline void nfs_fscache_get_super_cookie( |
| 175 | struct super_block *sb, | 176 | struct super_block *sb, |
| 176 | struct nfs_parsed_mount_data *data) | 177 | const char *uniq, |
| 178 | struct nfs_clone_mount *mntdata) | ||
| 177 | { | 179 | { |
| 178 | } | 180 | } |
| 179 | static inline void nfs_fscache_release_super_cookie(struct super_block *sb) {} | 181 | static inline void nfs_fscache_release_super_cookie(struct super_block *sb) {} |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 060022b4651c..faa091865ad0 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
| @@ -458,49 +458,21 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 458 | */ | 458 | */ |
| 459 | static int nfs_vmtruncate(struct inode * inode, loff_t offset) | 459 | static int nfs_vmtruncate(struct inode * inode, loff_t offset) |
| 460 | { | 460 | { |
| 461 | if (i_size_read(inode) < offset) { | 461 | loff_t oldsize; |
| 462 | unsigned long limit; | 462 | int err; |
| 463 | |||
| 464 | limit = current->signal->rlim[RLIMIT_FSIZE].rlim_cur; | ||
| 465 | if (limit != RLIM_INFINITY && offset > limit) | ||
| 466 | goto out_sig; | ||
| 467 | if (offset > inode->i_sb->s_maxbytes) | ||
| 468 | goto out_big; | ||
| 469 | spin_lock(&inode->i_lock); | ||
| 470 | i_size_write(inode, offset); | ||
| 471 | spin_unlock(&inode->i_lock); | ||
| 472 | } else { | ||
| 473 | struct address_space *mapping = inode->i_mapping; | ||
| 474 | 463 | ||
| 475 | /* | 464 | err = inode_newsize_ok(inode, offset); |
| 476 | * truncation of in-use swapfiles is disallowed - it would | 465 | if (err) |
| 477 | * cause subsequent swapout to scribble on the now-freed | 466 | goto out; |
| 478 | * blocks. | ||
| 479 | */ | ||
| 480 | if (IS_SWAPFILE(inode)) | ||
| 481 | return -ETXTBSY; | ||
| 482 | spin_lock(&inode->i_lock); | ||
| 483 | i_size_write(inode, offset); | ||
| 484 | spin_unlock(&inode->i_lock); | ||
| 485 | 467 | ||
| 486 | /* | 468 | spin_lock(&inode->i_lock); |
| 487 | * unmap_mapping_range is called twice, first simply for | 469 | oldsize = inode->i_size; |
| 488 | * efficiency so that truncate_inode_pages does fewer | 470 | i_size_write(inode, offset); |
| 489 | * single-page unmaps. However after this first call, and | 471 | spin_unlock(&inode->i_lock); |
| 490 | * before truncate_inode_pages finishes, it is possible for | 472 | |
| 491 | * private pages to be COWed, which remain after | 473 | truncate_pagecache(inode, oldsize, offset); |
| 492 | * truncate_inode_pages finishes, hence the second | 474 | out: |
| 493 | * unmap_mapping_range call must be made for correctness. | 475 | return err; |
| 494 | */ | ||
| 495 | unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1); | ||
| 496 | truncate_inode_pages(mapping, offset); | ||
| 497 | unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1); | ||
| 498 | } | ||
| 499 | return 0; | ||
| 500 | out_sig: | ||
| 501 | send_sig(SIGXFSZ, current, 0); | ||
| 502 | out_big: | ||
| 503 | return -EFBIG; | ||
| 504 | } | 476 | } |
| 505 | 477 | ||
| 506 | /** | 478 | /** |
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index c862c9340f9a..5e078b222b4e 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | #include <linux/time.h> | 13 | #include <linux/time.h> |
| 14 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
| 15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
| 16 | #include <linux/utsname.h> | ||
| 17 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
| 18 | #include <linux/string.h> | 17 | #include <linux/string.h> |
| 19 | #include <linux/in.h> | 18 | #include <linux/in.h> |
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index ee6a13f05443..3f8881d1a050 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/mm.h> | 9 | #include <linux/mm.h> |
| 10 | #include <linux/utsname.h> | ||
| 11 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
| 12 | #include <linux/string.h> | 11 | #include <linux/string.h> |
| 13 | #include <linux/sunrpc/clnt.h> | 12 | #include <linux/sunrpc/clnt.h> |
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index 35869a4921f1..5fe5492fbd29 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c | |||
| @@ -10,7 +10,6 @@ | |||
| 10 | #include <linux/time.h> | 10 | #include <linux/time.h> |
| 11 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
| 12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
| 13 | #include <linux/utsname.h> | ||
| 14 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
| 15 | #include <linux/string.h> | 14 | #include <linux/string.h> |
| 16 | #include <linux/in.h> | 15 | #include <linux/in.h> |
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 2636c26d56fa..fa3408f20112 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
| @@ -121,7 +121,7 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, | |||
| 121 | 121 | ||
| 122 | mnt_path = nfs4_pathname_string(&location->rootpath, page2, PAGE_SIZE); | 122 | mnt_path = nfs4_pathname_string(&location->rootpath, page2, PAGE_SIZE); |
| 123 | if (IS_ERR(mnt_path)) | 123 | if (IS_ERR(mnt_path)) |
| 124 | return mnt; | 124 | return ERR_CAST(mnt_path); |
| 125 | mountdata->mnt_path = mnt_path; | 125 | mountdata->mnt_path = mnt_path; |
| 126 | maxbuflen = mnt_path - 1 - page2; | 126 | maxbuflen = mnt_path - 1 - page2; |
| 127 | 127 | ||
| @@ -132,15 +132,15 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, | |||
| 132 | if (buf->len <= 0 || buf->len >= maxbuflen) | 132 | if (buf->len <= 0 || buf->len >= maxbuflen) |
| 133 | continue; | 133 | continue; |
| 134 | 134 | ||
| 135 | mountdata->addr = (struct sockaddr *)&addr; | ||
| 136 | |||
| 137 | if (memchr(buf->data, IPV6_SCOPE_DELIMITER, buf->len)) | 135 | if (memchr(buf->data, IPV6_SCOPE_DELIMITER, buf->len)) |
| 138 | continue; | 136 | continue; |
| 139 | mountdata->addrlen = nfs_parse_server_name(buf->data, | 137 | |
| 140 | buf->len, | 138 | mountdata->addrlen = nfs_parse_server_name(buf->data, buf->len, |
| 141 | mountdata->addr, mountdata->addrlen); | 139 | (struct sockaddr *)&addr, sizeof(addr)); |
| 142 | if (mountdata->addrlen == 0) | 140 | if (mountdata->addrlen == 0) |
| 143 | continue; | 141 | continue; |
| 142 | |||
| 143 | mountdata->addr = (struct sockaddr *)&addr; | ||
| 144 | rpc_set_port(mountdata->addr, NFS_PORT); | 144 | rpc_set_port(mountdata->addr, NFS_PORT); |
| 145 | 145 | ||
| 146 | memcpy(page2, buf->data, buf->len); | 146 | memcpy(page2, buf->data, buf->len); |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index be6544aef41f..741a562177fc 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -36,7 +36,6 @@ | |||
| 36 | */ | 36 | */ |
| 37 | 37 | ||
| 38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
| 39 | #include <linux/utsname.h> | ||
| 40 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
| 41 | #include <linux/errno.h> | 40 | #include <linux/errno.h> |
| 42 | #include <linux/string.h> | 41 | #include <linux/string.h> |
| @@ -73,12 +72,17 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, | |||
| 73 | /* Prevent leaks of NFSv4 errors into userland */ | 72 | /* Prevent leaks of NFSv4 errors into userland */ |
| 74 | static int nfs4_map_errors(int err) | 73 | static int nfs4_map_errors(int err) |
| 75 | { | 74 | { |
| 76 | if (err < -1000) { | 75 | if (err >= -1000) |
| 76 | return err; | ||
| 77 | switch (err) { | ||
| 78 | case -NFS4ERR_RESOURCE: | ||
| 79 | return -EREMOTEIO; | ||
| 80 | default: | ||
| 77 | dprintk("%s could not handle NFSv4 error %d\n", | 81 | dprintk("%s could not handle NFSv4 error %d\n", |
| 78 | __func__, -err); | 82 | __func__, -err); |
| 79 | return -EIO; | 83 | break; |
| 80 | } | 84 | } |
| 81 | return err; | 85 | return -EIO; |
| 82 | } | 86 | } |
| 83 | 87 | ||
| 84 | /* | 88 | /* |
| @@ -2763,7 +2767,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | |||
| 2763 | .pages = &page, | 2767 | .pages = &page, |
| 2764 | .pgbase = 0, | 2768 | .pgbase = 0, |
| 2765 | .count = count, | 2769 | .count = count, |
| 2766 | .bitmask = NFS_SERVER(dentry->d_inode)->cache_consistency_bitmask, | 2770 | .bitmask = NFS_SERVER(dentry->d_inode)->attr_bitmask, |
| 2767 | }; | 2771 | }; |
| 2768 | struct nfs4_readdir_res res; | 2772 | struct nfs4_readdir_res res; |
| 2769 | struct rpc_message msg = { | 2773 | struct rpc_message msg = { |
| @@ -3061,9 +3065,6 @@ static void nfs4_renew_done(struct rpc_task *task, void *data) | |||
| 3061 | if (time_before(clp->cl_last_renewal,timestamp)) | 3065 | if (time_before(clp->cl_last_renewal,timestamp)) |
| 3062 | clp->cl_last_renewal = timestamp; | 3066 | clp->cl_last_renewal = timestamp; |
| 3063 | spin_unlock(&clp->cl_lock); | 3067 | spin_unlock(&clp->cl_lock); |
| 3064 | dprintk("%s calling put_rpccred on rpc_cred %p\n", __func__, | ||
| 3065 | task->tk_msg.rpc_cred); | ||
| 3066 | put_rpccred(task->tk_msg.rpc_cred); | ||
| 3067 | } | 3068 | } |
| 3068 | 3069 | ||
| 3069 | static const struct rpc_call_ops nfs4_renew_ops = { | 3070 | static const struct rpc_call_ops nfs4_renew_ops = { |
| @@ -4878,7 +4879,6 @@ void nfs41_sequence_call_done(struct rpc_task *task, void *data) | |||
| 4878 | nfs41_sequence_free_slot(clp, task->tk_msg.rpc_resp); | 4879 | nfs41_sequence_free_slot(clp, task->tk_msg.rpc_resp); |
| 4879 | dprintk("%s rpc_cred %p\n", __func__, task->tk_msg.rpc_cred); | 4880 | dprintk("%s rpc_cred %p\n", __func__, task->tk_msg.rpc_cred); |
| 4880 | 4881 | ||
| 4881 | put_rpccred(task->tk_msg.rpc_cred); | ||
| 4882 | kfree(task->tk_msg.rpc_argp); | 4882 | kfree(task->tk_msg.rpc_argp); |
| 4883 | kfree(task->tk_msg.rpc_resp); | 4883 | kfree(task->tk_msg.rpc_resp); |
| 4884 | 4884 | ||
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c index e27c6cef18f2..0156c01c212c 100644 --- a/fs/nfs/nfs4renewd.c +++ b/fs/nfs/nfs4renewd.c | |||
| @@ -127,12 +127,6 @@ nfs4_schedule_state_renewal(struct nfs_client *clp) | |||
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | void | 129 | void |
| 130 | nfs4_renewd_prepare_shutdown(struct nfs_server *server) | ||
| 131 | { | ||
| 132 | cancel_delayed_work(&server->nfs_client->cl_renewd); | ||
| 133 | } | ||
| 134 | |||
| 135 | void | ||
| 136 | nfs4_kill_renewd(struct nfs_client *clp) | 130 | nfs4_kill_renewd(struct nfs_client *clp) |
| 137 | { | 131 | { |
| 138 | cancel_delayed_work_sync(&clp->cl_renewd); | 132 | cancel_delayed_work_sync(&clp->cl_renewd); |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 1434080aefeb..2ef4fecf3984 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
| @@ -638,7 +638,7 @@ static void nfs4_fl_release_lock(struct file_lock *fl) | |||
| 638 | nfs4_put_lock_state(fl->fl_u.nfs4_fl.owner); | 638 | nfs4_put_lock_state(fl->fl_u.nfs4_fl.owner); |
| 639 | } | 639 | } |
| 640 | 640 | ||
| 641 | static struct file_lock_operations nfs4_fl_lock_ops = { | 641 | static const struct file_lock_operations nfs4_fl_lock_ops = { |
| 642 | .fl_copy_lock = nfs4_fl_copy_lock, | 642 | .fl_copy_lock = nfs4_fl_copy_lock, |
| 643 | .fl_release_private = nfs4_fl_release_lock, | 643 | .fl_release_private = nfs4_fl_release_lock, |
| 644 | }; | 644 | }; |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index cfc30d362f94..20b4e30e6c82 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
| @@ -39,7 +39,6 @@ | |||
| 39 | #include <linux/time.h> | 39 | #include <linux/time.h> |
| 40 | #include <linux/mm.h> | 40 | #include <linux/mm.h> |
| 41 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
| 42 | #include <linux/utsname.h> | ||
| 43 | #include <linux/errno.h> | 42 | #include <linux/errno.h> |
| 44 | #include <linux/string.h> | 43 | #include <linux/string.h> |
| 45 | #include <linux/in.h> | 44 | #include <linux/in.h> |
| @@ -5682,7 +5681,6 @@ static struct { | |||
| 5682 | { NFS4ERR_SERVERFAULT, -ESERVERFAULT }, | 5681 | { NFS4ERR_SERVERFAULT, -ESERVERFAULT }, |
| 5683 | { NFS4ERR_BADTYPE, -EBADTYPE }, | 5682 | { NFS4ERR_BADTYPE, -EBADTYPE }, |
| 5684 | { NFS4ERR_LOCKED, -EAGAIN }, | 5683 | { NFS4ERR_LOCKED, -EAGAIN }, |
| 5685 | { NFS4ERR_RESOURCE, -EREMOTEIO }, | ||
| 5686 | { NFS4ERR_SYMLINK, -ELOOP }, | 5684 | { NFS4ERR_SYMLINK, -ELOOP }, |
| 5687 | { NFS4ERR_OP_ILLEGAL, -EOPNOTSUPP }, | 5685 | { NFS4ERR_OP_ILLEGAL, -EOPNOTSUPP }, |
| 5688 | { NFS4ERR_DEADLOCK, -EDEADLK }, | 5686 | { NFS4ERR_DEADLOCK, -EDEADLK }, |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 7be72d90d49d..ef583854d8d0 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
| @@ -32,7 +32,6 @@ | |||
| 32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
| 33 | #include <linux/time.h> | 33 | #include <linux/time.h> |
| 34 | #include <linux/mm.h> | 34 | #include <linux/mm.h> |
| 35 | #include <linux/utsname.h> | ||
| 36 | #include <linux/errno.h> | 35 | #include <linux/errno.h> |
| 37 | #include <linux/string.h> | 36 | #include <linux/string.h> |
| 38 | #include <linux/in.h> | 37 | #include <linux/in.h> |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index de935692d40d..90be551b80c1 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
| @@ -728,6 +728,29 @@ static void nfs_umount_begin(struct super_block *sb) | |||
| 728 | unlock_kernel(); | 728 | unlock_kernel(); |
| 729 | } | 729 | } |
| 730 | 730 | ||
| 731 | static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(unsigned int version) | ||
| 732 | { | ||
| 733 | struct nfs_parsed_mount_data *data; | ||
| 734 | |||
| 735 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
| 736 | if (data) { | ||
| 737 | data->rsize = NFS_MAX_FILE_IO_SIZE; | ||
| 738 | data->wsize = NFS_MAX_FILE_IO_SIZE; | ||
| 739 | data->acregmin = NFS_DEF_ACREGMIN; | ||
| 740 | data->acregmax = NFS_DEF_ACREGMAX; | ||
| 741 | data->acdirmin = NFS_DEF_ACDIRMIN; | ||
| 742 | data->acdirmax = NFS_DEF_ACDIRMAX; | ||
| 743 | data->mount_server.port = NFS_UNSPEC_PORT; | ||
| 744 | data->nfs_server.port = NFS_UNSPEC_PORT; | ||
| 745 | data->nfs_server.protocol = XPRT_TRANSPORT_TCP; | ||
| 746 | data->auth_flavors[0] = RPC_AUTH_UNIX; | ||
| 747 | data->auth_flavor_len = 1; | ||
| 748 | data->version = version; | ||
| 749 | data->minorversion = 0; | ||
| 750 | } | ||
| 751 | return data; | ||
| 752 | } | ||
| 753 | |||
| 731 | /* | 754 | /* |
| 732 | * Sanity-check a server address provided by the mount command. | 755 | * Sanity-check a server address provided by the mount command. |
| 733 | * | 756 | * |
| @@ -755,15 +778,13 @@ static int nfs_verify_server_address(struct sockaddr *addr) | |||
| 755 | * Select between a default port value and a user-specified port value. | 778 | * Select between a default port value and a user-specified port value. |
| 756 | * If a zero value is set, then autobind will be used. | 779 | * If a zero value is set, then autobind will be used. |
| 757 | */ | 780 | */ |
| 758 | static void nfs_set_default_port(struct sockaddr *sap, const int parsed_port, | 781 | static void nfs_set_port(struct sockaddr *sap, int *port, |
| 759 | const unsigned short default_port) | 782 | const unsigned short default_port) |
| 760 | { | 783 | { |
| 761 | unsigned short port = default_port; | 784 | if (*port == NFS_UNSPEC_PORT) |
| 762 | 785 | *port = default_port; | |
| 763 | if (parsed_port != NFS_UNSPEC_PORT) | ||
| 764 | port = parsed_port; | ||
| 765 | 786 | ||
| 766 | rpc_set_port(sap, port); | 787 | rpc_set_port(sap, *port); |
| 767 | } | 788 | } |
| 768 | 789 | ||
| 769 | /* | 790 | /* |
| @@ -1232,6 +1253,7 @@ static int nfs_parse_mount_options(char *raw, | |||
| 1232 | default: | 1253 | default: |
| 1233 | dfprintk(MOUNT, "NFS: unrecognized " | 1254 | dfprintk(MOUNT, "NFS: unrecognized " |
| 1234 | "transport protocol\n"); | 1255 | "transport protocol\n"); |
| 1256 | kfree(string); | ||
| 1235 | return 0; | 1257 | return 0; |
| 1236 | } | 1258 | } |
| 1237 | break; | 1259 | break; |
| @@ -1430,10 +1452,13 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args, | |||
| 1430 | int status; | 1452 | int status; |
| 1431 | 1453 | ||
| 1432 | if (args->mount_server.version == 0) { | 1454 | if (args->mount_server.version == 0) { |
| 1433 | if (args->flags & NFS_MOUNT_VER3) | 1455 | switch (args->version) { |
| 1434 | args->mount_server.version = NFS_MNT3_VERSION; | 1456 | default: |
| 1435 | else | 1457 | args->mount_server.version = NFS_MNT3_VERSION; |
| 1436 | args->mount_server.version = NFS_MNT_VERSION; | 1458 | break; |
| 1459 | case 2: | ||
| 1460 | args->mount_server.version = NFS_MNT_VERSION; | ||
| 1461 | } | ||
| 1437 | } | 1462 | } |
| 1438 | request.version = args->mount_server.version; | 1463 | request.version = args->mount_server.version; |
| 1439 | 1464 | ||
| @@ -1451,7 +1476,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args, | |||
| 1451 | args->mount_server.addrlen = args->nfs_server.addrlen; | 1476 | args->mount_server.addrlen = args->nfs_server.addrlen; |
| 1452 | } | 1477 | } |
| 1453 | request.salen = args->mount_server.addrlen; | 1478 | request.salen = args->mount_server.addrlen; |
| 1454 | nfs_set_default_port(request.sap, args->mount_server.port, 0); | 1479 | nfs_set_port(request.sap, &args->mount_server.port, 0); |
| 1455 | 1480 | ||
| 1456 | /* | 1481 | /* |
| 1457 | * Now ask the mount server to map our export path | 1482 | * Now ask the mount server to map our export path |
| @@ -1634,20 +1659,6 @@ static int nfs_validate_mount_data(void *options, | |||
| 1634 | if (data == NULL) | 1659 | if (data == NULL) |
| 1635 | goto out_no_data; | 1660 | goto out_no_data; |
| 1636 | 1661 | ||
| 1637 | args->flags = (NFS_MOUNT_VER3 | NFS_MOUNT_TCP); | ||
| 1638 | args->rsize = NFS_MAX_FILE_IO_SIZE; | ||
| 1639 | args->wsize = NFS_MAX_FILE_IO_SIZE; | ||
| 1640 | args->acregmin = NFS_DEF_ACREGMIN; | ||
| 1641 | args->acregmax = NFS_DEF_ACREGMAX; | ||
| 1642 | args->acdirmin = NFS_DEF_ACDIRMIN; | ||
| 1643 | args->acdirmax = NFS_DEF_ACDIRMAX; | ||
| 1644 | args->mount_server.port = NFS_UNSPEC_PORT; | ||
| 1645 | args->nfs_server.port = NFS_UNSPEC_PORT; | ||
| 1646 | args->nfs_server.protocol = XPRT_TRANSPORT_TCP; | ||
| 1647 | args->auth_flavors[0] = RPC_AUTH_UNIX; | ||
| 1648 | args->auth_flavor_len = 1; | ||
| 1649 | args->minorversion = 0; | ||
| 1650 | |||
| 1651 | switch (data->version) { | 1662 | switch (data->version) { |
| 1652 | case 1: | 1663 | case 1: |
| 1653 | data->namlen = 0; | 1664 | data->namlen = 0; |
| @@ -1755,7 +1766,7 @@ static int nfs_validate_mount_data(void *options, | |||
| 1755 | goto out_v4_not_compiled; | 1766 | goto out_v4_not_compiled; |
| 1756 | #endif | 1767 | #endif |
| 1757 | 1768 | ||
| 1758 | nfs_set_default_port(sap, args->nfs_server.port, 0); | 1769 | nfs_set_port(sap, &args->nfs_server.port, 0); |
| 1759 | 1770 | ||
| 1760 | nfs_set_mount_transport_protocol(args); | 1771 | nfs_set_mount_transport_protocol(args); |
| 1761 | 1772 | ||
| @@ -1778,7 +1789,7 @@ static int nfs_validate_mount_data(void *options, | |||
| 1778 | } | 1789 | } |
| 1779 | 1790 | ||
| 1780 | #ifndef CONFIG_NFS_V3 | 1791 | #ifndef CONFIG_NFS_V3 |
| 1781 | if (args->flags & NFS_MOUNT_VER3) | 1792 | if (args->version == 3) |
| 1782 | goto out_v3_not_compiled; | 1793 | goto out_v3_not_compiled; |
| 1783 | #endif /* !CONFIG_NFS_V3 */ | 1794 | #endif /* !CONFIG_NFS_V3 */ |
| 1784 | 1795 | ||
| @@ -1836,9 +1847,10 @@ nfs_compare_remount_data(struct nfs_server *nfss, | |||
| 1836 | data->acdirmin != nfss->acdirmin / HZ || | 1847 | data->acdirmin != nfss->acdirmin / HZ || |
| 1837 | data->acdirmax != nfss->acdirmax / HZ || | 1848 | data->acdirmax != nfss->acdirmax / HZ || |
| 1838 | data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || | 1849 | data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || |
| 1850 | data->nfs_server.port != nfss->port || | ||
| 1839 | data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || | 1851 | data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || |
| 1840 | memcmp(&data->nfs_server.address, &nfss->nfs_client->cl_addr, | 1852 | !rpc_cmp_addr((struct sockaddr *)&data->nfs_server.address, |
| 1841 | data->nfs_server.addrlen) != 0) | 1853 | (struct sockaddr *)&nfss->nfs_client->cl_addr)) |
| 1842 | return -EINVAL; | 1854 | return -EINVAL; |
| 1843 | 1855 | ||
| 1844 | return 0; | 1856 | return 0; |
| @@ -1881,6 +1893,7 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data) | |||
| 1881 | data->acdirmin = nfss->acdirmin / HZ; | 1893 | data->acdirmin = nfss->acdirmin / HZ; |
| 1882 | data->acdirmax = nfss->acdirmax / HZ; | 1894 | data->acdirmax = nfss->acdirmax / HZ; |
| 1883 | data->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ; | 1895 | data->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ; |
| 1896 | data->nfs_server.port = nfss->port; | ||
| 1884 | data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen; | 1897 | data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen; |
| 1885 | memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr, | 1898 | memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr, |
| 1886 | data->nfs_server.addrlen); | 1899 | data->nfs_server.addrlen); |
| @@ -1936,7 +1949,7 @@ static void nfs_fill_super(struct super_block *sb, | |||
| 1936 | if (data->bsize) | 1949 | if (data->bsize) |
| 1937 | sb->s_blocksize = nfs_block_size(data->bsize, &sb->s_blocksize_bits); | 1950 | sb->s_blocksize = nfs_block_size(data->bsize, &sb->s_blocksize_bits); |
| 1938 | 1951 | ||
| 1939 | if (server->flags & NFS_MOUNT_VER3) { | 1952 | if (server->nfs_client->rpc_ops->version == 3) { |
| 1940 | /* The VFS shouldn't apply the umask to mode bits. We will do | 1953 | /* The VFS shouldn't apply the umask to mode bits. We will do |
| 1941 | * so ourselves when necessary. | 1954 | * so ourselves when necessary. |
| 1942 | */ | 1955 | */ |
| @@ -1960,7 +1973,7 @@ static void nfs_clone_super(struct super_block *sb, | |||
| 1960 | sb->s_blocksize = old_sb->s_blocksize; | 1973 | sb->s_blocksize = old_sb->s_blocksize; |
| 1961 | sb->s_maxbytes = old_sb->s_maxbytes; | 1974 | sb->s_maxbytes = old_sb->s_maxbytes; |
| 1962 | 1975 | ||
| 1963 | if (server->flags & NFS_MOUNT_VER3) { | 1976 | if (server->nfs_client->rpc_ops->version == 3) { |
| 1964 | /* The VFS shouldn't apply the umask to mode bits. We will do | 1977 | /* The VFS shouldn't apply the umask to mode bits. We will do |
| 1965 | * so ourselves when necessary. | 1978 | * so ourselves when necessary. |
| 1966 | */ | 1979 | */ |
| @@ -2094,7 +2107,7 @@ static int nfs_get_sb(struct file_system_type *fs_type, | |||
| 2094 | }; | 2107 | }; |
| 2095 | int error = -ENOMEM; | 2108 | int error = -ENOMEM; |
| 2096 | 2109 | ||
| 2097 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 2110 | data = nfs_alloc_parsed_mount_data(3); |
| 2098 | mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL); | 2111 | mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL); |
| 2099 | if (data == NULL || mntfh == NULL) | 2112 | if (data == NULL || mntfh == NULL) |
| 2100 | goto out_free_fh; | 2113 | goto out_free_fh; |
| @@ -2144,7 +2157,8 @@ static int nfs_get_sb(struct file_system_type *fs_type, | |||
| 2144 | if (!s->s_root) { | 2157 | if (!s->s_root) { |
| 2145 | /* initial superblock/root creation */ | 2158 | /* initial superblock/root creation */ |
| 2146 | nfs_fill_super(s, data); | 2159 | nfs_fill_super(s, data); |
| 2147 | nfs_fscache_get_super_cookie(s, data); | 2160 | nfs_fscache_get_super_cookie( |
| 2161 | s, data ? data->fscache_uniq : NULL, NULL); | ||
| 2148 | } | 2162 | } |
| 2149 | 2163 | ||
| 2150 | mntroot = nfs_get_root(s, mntfh); | 2164 | mntroot = nfs_get_root(s, mntfh); |
| @@ -2190,8 +2204,8 @@ static void nfs_kill_super(struct super_block *s) | |||
| 2190 | { | 2204 | { |
| 2191 | struct nfs_server *server = NFS_SB(s); | 2205 | struct nfs_server *server = NFS_SB(s); |
| 2192 | 2206 | ||
| 2193 | bdi_unregister(&server->backing_dev_info); | ||
| 2194 | kill_anon_super(s); | 2207 | kill_anon_super(s); |
| 2208 | bdi_unregister(&server->backing_dev_info); | ||
| 2195 | nfs_fscache_release_super_cookie(s); | 2209 | nfs_fscache_release_super_cookie(s); |
| 2196 | nfs_free_server(server); | 2210 | nfs_free_server(server); |
| 2197 | } | 2211 | } |
| @@ -2245,6 +2259,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, | |||
| 2245 | if (!s->s_root) { | 2259 | if (!s->s_root) { |
| 2246 | /* initial superblock/root creation */ | 2260 | /* initial superblock/root creation */ |
| 2247 | nfs_clone_super(s, data->sb); | 2261 | nfs_clone_super(s, data->sb); |
| 2262 | nfs_fscache_get_super_cookie(s, NULL, data); | ||
| 2248 | } | 2263 | } |
| 2249 | 2264 | ||
| 2250 | mntroot = nfs_get_root(s, data->fh); | 2265 | mntroot = nfs_get_root(s, data->fh); |
| @@ -2317,7 +2332,7 @@ static int nfs4_validate_text_mount_data(void *options, | |||
| 2317 | { | 2332 | { |
| 2318 | struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address; | 2333 | struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address; |
| 2319 | 2334 | ||
| 2320 | nfs_set_default_port(sap, args->nfs_server.port, NFS_PORT); | 2335 | nfs_set_port(sap, &args->nfs_server.port, NFS_PORT); |
| 2321 | 2336 | ||
| 2322 | nfs_validate_transport_protocol(args); | 2337 | nfs_validate_transport_protocol(args); |
| 2323 | 2338 | ||
| @@ -2362,18 +2377,6 @@ static int nfs4_validate_mount_data(void *options, | |||
| 2362 | if (data == NULL) | 2377 | if (data == NULL) |
| 2363 | goto out_no_data; | 2378 | goto out_no_data; |
| 2364 | 2379 | ||
| 2365 | args->rsize = NFS_MAX_FILE_IO_SIZE; | ||
| 2366 | args->wsize = NFS_MAX_FILE_IO_SIZE; | ||
| 2367 | args->acregmin = NFS_DEF_ACREGMIN; | ||
| 2368 | args->acregmax = NFS_DEF_ACREGMAX; | ||
| 2369 | args->acdirmin = NFS_DEF_ACDIRMIN; | ||
| 2370 | args->acdirmax = NFS_DEF_ACDIRMAX; | ||
| 2371 | args->nfs_server.port = NFS_UNSPEC_PORT; | ||
| 2372 | args->auth_flavors[0] = RPC_AUTH_UNIX; | ||
| 2373 | args->auth_flavor_len = 1; | ||
| 2374 | args->version = 4; | ||
| 2375 | args->minorversion = 0; | ||
| 2376 | |||
| 2377 | switch (data->version) { | 2380 | switch (data->version) { |
| 2378 | case 1: | 2381 | case 1: |
| 2379 | if (data->host_addrlen > sizeof(args->nfs_server.address)) | 2382 | if (data->host_addrlen > sizeof(args->nfs_server.address)) |
| @@ -2508,7 +2511,8 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type, | |||
| 2508 | if (!s->s_root) { | 2511 | if (!s->s_root) { |
| 2509 | /* initial superblock/root creation */ | 2512 | /* initial superblock/root creation */ |
| 2510 | nfs4_fill_super(s); | 2513 | nfs4_fill_super(s); |
| 2511 | nfs_fscache_get_super_cookie(s, data); | 2514 | nfs_fscache_get_super_cookie( |
| 2515 | s, data ? data->fscache_uniq : NULL, NULL); | ||
| 2512 | } | 2516 | } |
| 2513 | 2517 | ||
| 2514 | mntroot = nfs4_get_root(s, mntfh); | 2518 | mntroot = nfs4_get_root(s, mntfh); |
| @@ -2656,7 +2660,7 @@ static int nfs4_get_sb(struct file_system_type *fs_type, | |||
| 2656 | struct nfs_parsed_mount_data *data; | 2660 | struct nfs_parsed_mount_data *data; |
| 2657 | int error = -ENOMEM; | 2661 | int error = -ENOMEM; |
| 2658 | 2662 | ||
| 2659 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 2663 | data = nfs_alloc_parsed_mount_data(4); |
| 2660 | if (data == NULL) | 2664 | if (data == NULL) |
| 2661 | goto out_free_data; | 2665 | goto out_free_data; |
| 2662 | 2666 | ||
| @@ -2686,7 +2690,6 @@ static void nfs4_kill_super(struct super_block *sb) | |||
| 2686 | dprintk("--> %s\n", __func__); | 2690 | dprintk("--> %s\n", __func__); |
| 2687 | nfs_super_return_all_delegations(sb); | 2691 | nfs_super_return_all_delegations(sb); |
| 2688 | kill_anon_super(sb); | 2692 | kill_anon_super(sb); |
| 2689 | nfs4_renewd_prepare_shutdown(server); | ||
| 2690 | nfs_fscache_release_super_cookie(sb); | 2693 | nfs_fscache_release_super_cookie(sb); |
| 2691 | nfs_free_server(server); | 2694 | nfs_free_server(server); |
| 2692 | dprintk("<-- %s\n", __func__); | 2695 | dprintk("<-- %s\n", __func__); |
| @@ -2741,6 +2744,7 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, | |||
| 2741 | if (!s->s_root) { | 2744 | if (!s->s_root) { |
| 2742 | /* initial superblock/root creation */ | 2745 | /* initial superblock/root creation */ |
| 2743 | nfs4_clone_super(s, data->sb); | 2746 | nfs4_clone_super(s, data->sb); |
| 2747 | nfs_fscache_get_super_cookie(s, NULL, data); | ||
| 2744 | } | 2748 | } |
| 2745 | 2749 | ||
| 2746 | mntroot = nfs4_get_root(s, data->fh); | 2750 | mntroot = nfs4_get_root(s, data->fh); |
| @@ -2822,6 +2826,7 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, | |||
| 2822 | if (!s->s_root) { | 2826 | if (!s->s_root) { |
| 2823 | /* initial superblock/root creation */ | 2827 | /* initial superblock/root creation */ |
| 2824 | nfs4_fill_super(s); | 2828 | nfs4_fill_super(s); |
| 2829 | nfs_fscache_get_super_cookie(s, NULL, data); | ||
| 2825 | } | 2830 | } |
| 2826 | 2831 | ||
| 2827 | mntroot = nfs4_get_root(s, &mntfh); | 2832 | mntroot = nfs4_get_root(s, &mntfh); |
