aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs3proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs3proc.c')
-rw-r--r--fs/nfs/nfs3proc.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index cf186f0d2b3b..3b234d4601e7 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -20,11 +20,10 @@
20#include <linux/nfs_mount.h> 20#include <linux/nfs_mount.h>
21 21
22#include "iostat.h" 22#include "iostat.h"
23#include "internal.h"
23 24
24#define NFSDBG_FACILITY NFSDBG_PROC 25#define NFSDBG_FACILITY NFSDBG_PROC
25 26
26extern struct rpc_procinfo nfs3_procedures[];
27
28/* A wrapper to handle the EJUKEBOX error message */ 27/* A wrapper to handle the EJUKEBOX error message */
29static int 28static int
30nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags) 29nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
@@ -82,7 +81,7 @@ do_proc_get_root(struct rpc_clnt *client, struct nfs_fh *fhandle,
82} 81}
83 82
84/* 83/*
85 * Bare-bones access to getattr: this is for nfs_read_super. 84 * Bare-bones access to getattr: this is for nfs_get_root/nfs_get_sb
86 */ 85 */
87static int 86static int
88nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, 87nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
@@ -91,8 +90,8 @@ nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
91 int status; 90 int status;
92 91
93 status = do_proc_get_root(server->client, fhandle, info); 92 status = do_proc_get_root(server->client, fhandle, info);
94 if (status && server->client_sys != server->client) 93 if (status && server->nfs_client->cl_rpcclient != server->client)
95 status = do_proc_get_root(server->client_sys, fhandle, info); 94 status = do_proc_get_root(server->nfs_client->cl_rpcclient, fhandle, info);
96 return status; 95 return status;
97} 96}
98 97
@@ -450,7 +449,7 @@ nfs3_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr
450 struct nfs_fattr res; 449 struct nfs_fattr res;
451 } *ptr; 450 } *ptr;
452 451
453 ptr = (struct unlinkxdr *)kmalloc(sizeof(*ptr), GFP_KERNEL); 452 ptr = kmalloc(sizeof(*ptr), GFP_KERNEL);
454 if (!ptr) 453 if (!ptr)
455 return -ENOMEM; 454 return -ENOMEM;
456 ptr->arg.fh = NFS_FH(dir->d_inode); 455 ptr->arg.fh = NFS_FH(dir->d_inode);
@@ -545,23 +544,23 @@ nfs3_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
545} 544}
546 545
547static int 546static int
548nfs3_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path, 547nfs3_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page,
549 struct iattr *sattr, struct nfs_fh *fhandle, 548 unsigned int len, struct iattr *sattr)
550 struct nfs_fattr *fattr)
551{ 549{
552 struct nfs_fattr dir_attr; 550 struct nfs_fh fhandle;
551 struct nfs_fattr fattr, dir_attr;
553 struct nfs3_symlinkargs arg = { 552 struct nfs3_symlinkargs arg = {
554 .fromfh = NFS_FH(dir), 553 .fromfh = NFS_FH(dir),
555 .fromname = name->name, 554 .fromname = dentry->d_name.name,
556 .fromlen = name->len, 555 .fromlen = dentry->d_name.len,
557 .topath = path->name, 556 .pages = &page,
558 .tolen = path->len, 557 .pathlen = len,
559 .sattr = sattr 558 .sattr = sattr
560 }; 559 };
561 struct nfs3_diropres res = { 560 struct nfs3_diropres res = {
562 .dir_attr = &dir_attr, 561 .dir_attr = &dir_attr,
563 .fh = fhandle, 562 .fh = &fhandle,
564 .fattr = fattr 563 .fattr = &fattr
565 }; 564 };
566 struct rpc_message msg = { 565 struct rpc_message msg = {
567 .rpc_proc = &nfs3_procedures[NFS3PROC_SYMLINK], 566 .rpc_proc = &nfs3_procedures[NFS3PROC_SYMLINK],
@@ -570,13 +569,19 @@ nfs3_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path,
570 }; 569 };
571 int status; 570 int status;
572 571
573 if (path->len > NFS3_MAXPATHLEN) 572 if (len > NFS3_MAXPATHLEN)
574 return -ENAMETOOLONG; 573 return -ENAMETOOLONG;
575 dprintk("NFS call symlink %s -> %s\n", name->name, path->name); 574
575 dprintk("NFS call symlink %s\n", dentry->d_name.name);
576
576 nfs_fattr_init(&dir_attr); 577 nfs_fattr_init(&dir_attr);
577 nfs_fattr_init(fattr); 578 nfs_fattr_init(&fattr);
578 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 579 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
579 nfs_post_op_update_inode(dir, &dir_attr); 580 nfs_post_op_update_inode(dir, &dir_attr);
581 if (status != 0)
582 goto out;
583 status = nfs_instantiate(dentry, &fhandle, &fattr);
584out:
580 dprintk("NFS reply symlink: %d\n", status); 585 dprintk("NFS reply symlink: %d\n", status);
581 return status; 586 return status;
582} 587}
@@ -786,7 +791,7 @@ nfs3_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
786 791
787 dprintk("NFS call fsinfo\n"); 792 dprintk("NFS call fsinfo\n");
788 nfs_fattr_init(info->fattr); 793 nfs_fattr_init(info->fattr);
789 status = rpc_call_sync(server->client_sys, &msg, 0); 794 status = rpc_call_sync(server->nfs_client->cl_rpcclient, &msg, 0);
790 dprintk("NFS reply fsinfo: %d\n", status); 795 dprintk("NFS reply fsinfo: %d\n", status);
791 return status; 796 return status;
792} 797}
@@ -809,8 +814,6 @@ nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
809 return status; 814 return status;
810} 815}
811 816
812extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int);
813
814static int nfs3_read_done(struct rpc_task *task, struct nfs_read_data *data) 817static int nfs3_read_done(struct rpc_task *task, struct nfs_read_data *data)
815{ 818{
816 if (nfs3_async_handle_jukebox(task, data->inode)) 819 if (nfs3_async_handle_jukebox(task, data->inode))
@@ -889,7 +892,7 @@ nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
889 return nlmclnt_proc(filp->f_dentry->d_inode, cmd, fl); 892 return nlmclnt_proc(filp->f_dentry->d_inode, cmd, fl);
890} 893}
891 894
892struct nfs_rpc_ops nfs_v3_clientops = { 895const struct nfs_rpc_ops nfs_v3_clientops = {
893 .version = 3, /* protocol version */ 896 .version = 3, /* protocol version */
894 .dentry_ops = &nfs_dentry_operations, 897 .dentry_ops = &nfs_dentry_operations,
895 .dir_inode_ops = &nfs3_dir_inode_operations, 898 .dir_inode_ops = &nfs3_dir_inode_operations,