aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2011-03-24 13:12:24 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-03-24 13:52:41 -0400
commit7c5130588d691a3b34d02312f1bd1b6d56fe0100 (patch)
tree154ccea3a837ca1aae2c5676e0946b79fb4bb671
parente73b83f270828630a9ce33728f6ef61c37a82340 (diff)
NFS: lookup supports alternate client
A later patch will need to perform a lookup using an alternate client with a different security flavor. This patch adds support for doing that on NFS v4. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/dir.c6
-rw-r--r--fs/nfs/internal.h6
-rw-r--r--fs/nfs/namespace.c2
-rw-r--r--fs/nfs/nfs3proc.c2
-rw-r--r--fs/nfs/nfs4_fs.h3
-rw-r--r--fs/nfs/nfs4proc.c86
-rw-r--r--fs/nfs/proc.c2
-rw-r--r--include/linux/nfs_xdr.h2
8 files changed, 60 insertions, 49 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index abdf38d5971d..a83cd0d9dfab 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1068,7 +1068,7 @@ static int nfs_lookup_revalidate(struct dentry *dentry, struct nameidata *nd)
1068 if (fhandle == NULL || fattr == NULL) 1068 if (fhandle == NULL || fattr == NULL)
1069 goto out_error; 1069 goto out_error;
1070 1070
1071 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr); 1071 error = NFS_PROTO(dir)->lookup(NFS_SERVER(dir)->client, dir, &dentry->d_name, fhandle, fattr);
1072 if (error) 1072 if (error)
1073 goto out_bad; 1073 goto out_bad;
1074 if (nfs_compare_fh(NFS_FH(inode), fhandle)) 1074 if (nfs_compare_fh(NFS_FH(inode), fhandle))
@@ -1224,7 +1224,7 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru
1224 parent = dentry->d_parent; 1224 parent = dentry->d_parent;
1225 /* Protect against concurrent sillydeletes */ 1225 /* Protect against concurrent sillydeletes */
1226 nfs_block_sillyrename(parent); 1226 nfs_block_sillyrename(parent);
1227 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr); 1227 error = NFS_PROTO(dir)->lookup(NFS_SERVER(dir)->client, dir, &dentry->d_name, fhandle, fattr);
1228 if (error == -ENOENT) 1228 if (error == -ENOENT)
1229 goto no_entry; 1229 goto no_entry;
1230 if (error < 0) { 1230 if (error < 0) {
@@ -1562,7 +1562,7 @@ int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle,
1562 if (dentry->d_inode) 1562 if (dentry->d_inode)
1563 goto out; 1563 goto out;
1564 if (fhandle->size == 0) { 1564 if (fhandle->size == 0) {
1565 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr); 1565 error = NFS_PROTO(dir)->lookup(NFS_SERVER(dir)->client, dir, &dentry->d_name, fhandle, fattr);
1566 if (error) 1566 if (error)
1567 goto out_error; 1567 goto out_error;
1568 } 1568 }
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 72e0bddf7a2f..1ec5d0662ede 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -296,12 +296,14 @@ extern int nfs4_init_client(struct nfs_client *clp,
296 rpc_authflavor_t authflavour, 296 rpc_authflavor_t authflavour,
297 int noresvport); 297 int noresvport);
298extern void nfs4_reset_write(struct rpc_task *task, struct nfs_write_data *data); 298extern void nfs4_reset_write(struct rpc_task *task, struct nfs_write_data *data);
299extern int _nfs4_call_sync(struct nfs_server *server, 299extern int _nfs4_call_sync(struct rpc_clnt *clnt,
300 struct nfs_server *server,
300 struct rpc_message *msg, 301 struct rpc_message *msg,
301 struct nfs4_sequence_args *args, 302 struct nfs4_sequence_args *args,
302 struct nfs4_sequence_res *res, 303 struct nfs4_sequence_res *res,
303 int cache_reply); 304 int cache_reply);
304extern int _nfs4_call_sync_session(struct nfs_server *server, 305extern int _nfs4_call_sync_session(struct rpc_clnt *clnt,
306 struct nfs_server *server,
305 struct rpc_message *msg, 307 struct rpc_message *msg,
306 struct nfs4_sequence_args *args, 308 struct nfs4_sequence_args *args,
307 struct nfs4_sequence_res *res, 309 struct nfs4_sequence_res *res,
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index bf1c68009ffd..b02720864ded 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -153,7 +153,7 @@ struct vfsmount *nfs_d_automount(struct path *path)
153 153
154 /* Look it up again to get its attributes */ 154 /* Look it up again to get its attributes */
155 parent = dget_parent(path->dentry); 155 parent = dget_parent(path->dentry);
156 err = server->nfs_client->rpc_ops->lookup(parent->d_inode, 156 err = server->nfs_client->rpc_ops->lookup(server->client, parent->d_inode,
157 &path->dentry->d_name, 157 &path->dentry->d_name,
158 fh, fattr); 158 fh, fattr);
159 dput(parent); 159 dput(parent);
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index d0c80d8b3f96..38053d823eb0 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -141,7 +141,7 @@ nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
141} 141}
142 142
143static int 143static int
144nfs3_proc_lookup(struct inode *dir, struct qstr *name, 144nfs3_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qstr *name,
145 struct nfs_fh *fhandle, struct nfs_fattr *fattr) 145 struct nfs_fh *fhandle, struct nfs_fattr *fattr)
146{ 146{
147 struct nfs3_diropargs arg = { 147 struct nfs3_diropargs arg = {
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index c64be1cff080..72e5f1a2883e 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -57,7 +57,8 @@ enum nfs4_session_state {
57struct nfs4_minor_version_ops { 57struct nfs4_minor_version_ops {
58 u32 minor_version; 58 u32 minor_version;
59 59
60 int (*call_sync)(struct nfs_server *server, 60 int (*call_sync)(struct rpc_clnt *clnt,
61 struct nfs_server *server,
61 struct rpc_message *msg, 62 struct rpc_message *msg,
62 struct nfs4_sequence_args *args, 63 struct nfs4_sequence_args *args,
63 struct nfs4_sequence_res *res, 64 struct nfs4_sequence_res *res,
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index e403d7a84466..448657456b68 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -71,7 +71,9 @@ static int _nfs4_proc_open(struct nfs4_opendata *data);
71static int _nfs4_recover_proc_open(struct nfs4_opendata *data); 71static int _nfs4_recover_proc_open(struct nfs4_opendata *data);
72static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); 72static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *);
73static int nfs4_async_handle_error(struct rpc_task *, const struct nfs_server *, struct nfs4_state *); 73static int nfs4_async_handle_error(struct rpc_task *, const struct nfs_server *, struct nfs4_state *);
74static int _nfs4_proc_lookup(struct inode *dir, const struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr); 74static int _nfs4_proc_lookup(struct rpc_clnt *client, struct inode *dir,
75 const struct qstr *name, struct nfs_fh *fhandle,
76 struct nfs_fattr *fattr);
75static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr); 77static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr);
76static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, 78static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
77 struct nfs_fattr *fattr, struct iattr *sattr, 79 struct nfs_fattr *fattr, struct iattr *sattr,
@@ -657,7 +659,8 @@ struct rpc_call_ops nfs41_call_priv_sync_ops = {
657 .rpc_call_done = nfs41_call_sync_done, 659 .rpc_call_done = nfs41_call_sync_done,
658}; 660};
659 661
660static int nfs4_call_sync_sequence(struct nfs_server *server, 662static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
663 struct nfs_server *server,
661 struct rpc_message *msg, 664 struct rpc_message *msg,
662 struct nfs4_sequence_args *args, 665 struct nfs4_sequence_args *args,
663 struct nfs4_sequence_res *res, 666 struct nfs4_sequence_res *res,
@@ -673,7 +676,7 @@ static int nfs4_call_sync_sequence(struct nfs_server *server,
673 .cache_reply = cache_reply, 676 .cache_reply = cache_reply,
674 }; 677 };
675 struct rpc_task_setup task_setup = { 678 struct rpc_task_setup task_setup = {
676 .rpc_client = server->client, 679 .rpc_client = clnt,
677 .rpc_message = msg, 680 .rpc_message = msg,
678 .callback_ops = &nfs41_call_sync_ops, 681 .callback_ops = &nfs41_call_sync_ops,
679 .callback_data = &data 682 .callback_data = &data
@@ -692,13 +695,14 @@ static int nfs4_call_sync_sequence(struct nfs_server *server,
692 return ret; 695 return ret;
693} 696}
694 697
695int _nfs4_call_sync_session(struct nfs_server *server, 698int _nfs4_call_sync_session(struct rpc_clnt *clnt,
699 struct nfs_server *server,
696 struct rpc_message *msg, 700 struct rpc_message *msg,
697 struct nfs4_sequence_args *args, 701 struct nfs4_sequence_args *args,
698 struct nfs4_sequence_res *res, 702 struct nfs4_sequence_res *res,
699 int cache_reply) 703 int cache_reply)
700{ 704{
701 return nfs4_call_sync_sequence(server, msg, args, res, cache_reply, 0); 705 return nfs4_call_sync_sequence(clnt, server, msg, args, res, cache_reply, 0);
702} 706}
703 707
704#else 708#else
@@ -709,25 +713,27 @@ static int nfs4_sequence_done(struct rpc_task *task,
709} 713}
710#endif /* CONFIG_NFS_V4_1 */ 714#endif /* CONFIG_NFS_V4_1 */
711 715
712int _nfs4_call_sync(struct nfs_server *server, 716int _nfs4_call_sync(struct rpc_clnt *clnt,
717 struct nfs_server *server,
713 struct rpc_message *msg, 718 struct rpc_message *msg,
714 struct nfs4_sequence_args *args, 719 struct nfs4_sequence_args *args,
715 struct nfs4_sequence_res *res, 720 struct nfs4_sequence_res *res,
716 int cache_reply) 721 int cache_reply)
717{ 722{
718 args->sa_session = res->sr_session = NULL; 723 args->sa_session = res->sr_session = NULL;
719 return rpc_call_sync(server->client, msg, 0); 724 return rpc_call_sync(clnt, msg, 0);
720} 725}
721 726
722static inline 727static inline
723int nfs4_call_sync(struct nfs_server *server, 728int nfs4_call_sync(struct rpc_clnt *clnt,
729 struct nfs_server *server,
724 struct rpc_message *msg, 730 struct rpc_message *msg,
725 struct nfs4_sequence_args *args, 731 struct nfs4_sequence_args *args,
726 struct nfs4_sequence_res *res, 732 struct nfs4_sequence_res *res,
727 int cache_reply) 733 int cache_reply)
728{ 734{
729 return server->nfs_client->cl_mvops->call_sync(server, msg, args, 735 return server->nfs_client->cl_mvops->call_sync(clnt, server, msg,
730 res, cache_reply); 736 args, res, cache_reply);
731} 737}
732 738
733static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) 739static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo)
@@ -1838,7 +1844,7 @@ static int _nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
1838 } else 1844 } else
1839 memcpy(&arg.stateid, &zero_stateid, sizeof(arg.stateid)); 1845 memcpy(&arg.stateid, &zero_stateid, sizeof(arg.stateid));
1840 1846
1841 status = nfs4_call_sync(server, &msg, &arg.seq_args, &res.seq_res, 1); 1847 status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
1842 if (status == 0 && state != NULL) 1848 if (status == 0 && state != NULL)
1843 renew_lease(server, timestamp); 1849 renew_lease(server, timestamp);
1844 return status; 1850 return status;
@@ -2097,7 +2103,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
2097 }; 2103 };
2098 int status; 2104 int status;
2099 2105
2100 status = nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0); 2106 status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
2101 if (status == 0) { 2107 if (status == 0) {
2102 memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask)); 2108 memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask));
2103 server->caps &= ~(NFS_CAP_ACLS|NFS_CAP_HARDLINKS| 2109 server->caps &= ~(NFS_CAP_ACLS|NFS_CAP_HARDLINKS|
@@ -2167,7 +2173,7 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
2167 }; 2173 };
2168 2174
2169 nfs_fattr_init(info->fattr); 2175 nfs_fattr_init(info->fattr);
2170 return nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0); 2176 return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
2171} 2177}
2172 2178
2173static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, 2179static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
@@ -2256,7 +2262,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
2256 }; 2262 };
2257 2263
2258 nfs_fattr_init(fattr); 2264 nfs_fattr_init(fattr);
2259 return nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0); 2265 return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
2260} 2266}
2261 2267
2262static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr) 2268static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr)
@@ -2316,9 +2322,9 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
2316 return status; 2322 return status;
2317} 2323}
2318 2324
2319static int _nfs4_proc_lookupfh(struct nfs_server *server, const struct nfs_fh *dirfh, 2325static int _nfs4_proc_lookupfh(struct rpc_clnt *clnt, struct nfs_server *server,
2320 const struct qstr *name, struct nfs_fh *fhandle, 2326 const struct nfs_fh *dirfh, const struct qstr *name,
2321 struct nfs_fattr *fattr) 2327 struct nfs_fh *fhandle, struct nfs_fattr *fattr)
2322{ 2328{
2323 int status; 2329 int status;
2324 struct nfs4_lookup_arg args = { 2330 struct nfs4_lookup_arg args = {
@@ -2340,7 +2346,7 @@ static int _nfs4_proc_lookupfh(struct nfs_server *server, const struct nfs_fh *d
2340 nfs_fattr_init(fattr); 2346 nfs_fattr_init(fattr);
2341 2347
2342 dprintk("NFS call lookupfh %s\n", name->name); 2348 dprintk("NFS call lookupfh %s\n", name->name);
2343 status = nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0); 2349 status = nfs4_call_sync(clnt, server, &msg, &args.seq_args, &res.seq_res, 0);
2344 dprintk("NFS reply lookupfh: %d\n", status); 2350 dprintk("NFS reply lookupfh: %d\n", status);
2345 return status; 2351 return status;
2346} 2352}
@@ -2352,7 +2358,7 @@ static int nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh,
2352 struct nfs4_exception exception = { }; 2358 struct nfs4_exception exception = { };
2353 int err; 2359 int err;
2354 do { 2360 do {
2355 err = _nfs4_proc_lookupfh(server, dirfh, name, fhandle, fattr); 2361 err = _nfs4_proc_lookupfh(server->client, server, dirfh, name, fhandle, fattr);
2356 /* FIXME: !!!! */ 2362 /* FIXME: !!!! */
2357 if (err == -NFS4ERR_MOVED) { 2363 if (err == -NFS4ERR_MOVED) {
2358 err = -EREMOTE; 2364 err = -EREMOTE;
@@ -2363,26 +2369,28 @@ static int nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh,
2363 return err; 2369 return err;
2364} 2370}
2365 2371
2366static int _nfs4_proc_lookup(struct inode *dir, const struct qstr *name, 2372static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir,
2367 struct nfs_fh *fhandle, struct nfs_fattr *fattr) 2373 const struct qstr *name, struct nfs_fh *fhandle,
2374 struct nfs_fattr *fattr)
2368{ 2375{
2369 int status; 2376 int status;
2370 2377
2371 dprintk("NFS call lookup %s\n", name->name); 2378 dprintk("NFS call lookup %s\n", name->name);
2372 status = _nfs4_proc_lookupfh(NFS_SERVER(dir), NFS_FH(dir), name, fhandle, fattr); 2379 status = _nfs4_proc_lookupfh(clnt, NFS_SERVER(dir), NFS_FH(dir), name, fhandle, fattr);
2373 if (status == -NFS4ERR_MOVED) 2380 if (status == -NFS4ERR_MOVED)
2374 status = nfs4_get_referral(dir, name, fattr, fhandle); 2381 status = nfs4_get_referral(dir, name, fattr, fhandle);
2375 dprintk("NFS reply lookup: %d\n", status); 2382 dprintk("NFS reply lookup: %d\n", status);
2376 return status; 2383 return status;
2377} 2384}
2378 2385
2379static int nfs4_proc_lookup(struct inode *dir, struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr) 2386static int nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qstr *name,
2387 struct nfs_fh *fhandle, struct nfs_fattr *fattr)
2380{ 2388{
2381 struct nfs4_exception exception = { }; 2389 struct nfs4_exception exception = { };
2382 int err; 2390 int err;
2383 do { 2391 do {
2384 err = nfs4_handle_exception(NFS_SERVER(dir), 2392 err = nfs4_handle_exception(NFS_SERVER(dir),
2385 _nfs4_proc_lookup(dir, name, fhandle, fattr), 2393 _nfs4_proc_lookup(clnt, dir, name, fhandle, fattr),
2386 &exception); 2394 &exception);
2387 } while (exception.retry); 2395 } while (exception.retry);
2388 return err; 2396 return err;
@@ -2428,7 +2436,7 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry
2428 if (res.fattr == NULL) 2436 if (res.fattr == NULL)
2429 return -ENOMEM; 2437 return -ENOMEM;
2430 2438
2431 status = nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0); 2439 status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
2432 if (!status) { 2440 if (!status) {
2433 entry->mask = 0; 2441 entry->mask = 0;
2434 if (res.access & NFS4_ACCESS_READ) 2442 if (res.access & NFS4_ACCESS_READ)
@@ -2495,7 +2503,7 @@ static int _nfs4_proc_readlink(struct inode *inode, struct page *page,
2495 .rpc_resp = &res, 2503 .rpc_resp = &res,
2496 }; 2504 };
2497 2505
2498 return nfs4_call_sync(NFS_SERVER(inode), &msg, &args.seq_args, &res.seq_res, 0); 2506 return nfs4_call_sync(NFS_SERVER(inode)->client, NFS_SERVER(inode), &msg, &args.seq_args, &res.seq_res, 0);
2499} 2507}
2500 2508
2501static int nfs4_proc_readlink(struct inode *inode, struct page *page, 2509static int nfs4_proc_readlink(struct inode *inode, struct page *page,
@@ -2584,7 +2592,7 @@ static int _nfs4_proc_remove(struct inode *dir, struct qstr *name)
2584 if (res.dir_attr == NULL) 2592 if (res.dir_attr == NULL)
2585 goto out; 2593 goto out;
2586 2594
2587 status = nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 1); 2595 status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 1);
2588 if (status == 0) { 2596 if (status == 0) {
2589 update_changeattr(dir, &res.cinfo); 2597 update_changeattr(dir, &res.cinfo);
2590 nfs_post_op_update_inode(dir, res.dir_attr); 2598 nfs_post_op_update_inode(dir, res.dir_attr);
@@ -2685,7 +2693,7 @@ static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,
2685 if (res.old_fattr == NULL || res.new_fattr == NULL) 2693 if (res.old_fattr == NULL || res.new_fattr == NULL)
2686 goto out; 2694 goto out;
2687 2695
2688 status = nfs4_call_sync(server, &msg, &arg.seq_args, &res.seq_res, 1); 2696 status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
2689 if (!status) { 2697 if (!status) {
2690 update_changeattr(old_dir, &res.old_cinfo); 2698 update_changeattr(old_dir, &res.old_cinfo);
2691 nfs_post_op_update_inode(old_dir, res.old_fattr); 2699 nfs_post_op_update_inode(old_dir, res.old_fattr);
@@ -2736,7 +2744,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *
2736 if (res.fattr == NULL || res.dir_attr == NULL) 2744 if (res.fattr == NULL || res.dir_attr == NULL)
2737 goto out; 2745 goto out;
2738 2746
2739 status = nfs4_call_sync(server, &msg, &arg.seq_args, &res.seq_res, 1); 2747 status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
2740 if (!status) { 2748 if (!status) {
2741 update_changeattr(dir, &res.cinfo); 2749 update_changeattr(dir, &res.cinfo);
2742 nfs_post_op_update_inode(dir, res.dir_attr); 2750 nfs_post_op_update_inode(dir, res.dir_attr);
@@ -2799,7 +2807,7 @@ static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir,
2799 2807
2800static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_createdata *data) 2808static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_createdata *data)
2801{ 2809{
2802 int status = nfs4_call_sync(NFS_SERVER(dir), &data->msg, 2810 int status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &data->msg,
2803 &data->arg.seq_args, &data->res.seq_res, 1); 2811 &data->arg.seq_args, &data->res.seq_res, 1);
2804 if (status == 0) { 2812 if (status == 0) {
2805 update_changeattr(dir, &data->res.dir_cinfo); 2813 update_changeattr(dir, &data->res.dir_cinfo);
@@ -2912,7 +2920,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
2912 (unsigned long long)cookie); 2920 (unsigned long long)cookie);
2913 nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args); 2921 nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args);
2914 res.pgbase = args.pgbase; 2922 res.pgbase = args.pgbase;
2915 status = nfs4_call_sync(NFS_SERVER(dir), &msg, &args.seq_args, &res.seq_res, 0); 2923 status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &msg, &args.seq_args, &res.seq_res, 0);
2916 if (status >= 0) { 2924 if (status >= 0) {
2917 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE); 2925 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE);
2918 status += args.pgbase; 2926 status += args.pgbase;
@@ -3004,7 +3012,7 @@ static int _nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
3004 }; 3012 };
3005 3013
3006 nfs_fattr_init(fsstat->fattr); 3014 nfs_fattr_init(fsstat->fattr);
3007 return nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0); 3015 return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
3008} 3016}
3009 3017
3010static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat) 3018static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat)
@@ -3035,7 +3043,7 @@ static int _nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
3035 .rpc_resp = &res, 3043 .rpc_resp = &res,
3036 }; 3044 };
3037 3045
3038 return nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0); 3046 return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
3039} 3047}
3040 3048
3041static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) 3049static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo)
@@ -3080,7 +3088,7 @@ static int _nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle
3080 } 3088 }
3081 3089
3082 nfs_fattr_init(pathconf->fattr); 3090 nfs_fattr_init(pathconf->fattr);
3083 return nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0); 3091 return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
3084} 3092}
3085 3093
3086static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, 3094static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
@@ -3459,7 +3467,7 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu
3459 resp_buf = buf; 3467 resp_buf = buf;
3460 buf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase); 3468 buf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase);
3461 } 3469 }
3462 ret = nfs4_call_sync(NFS_SERVER(inode), &msg, &args.seq_args, &res.seq_res, 0); 3470 ret = nfs4_call_sync(NFS_SERVER(inode)->client, NFS_SERVER(inode), &msg, &args.seq_args, &res.seq_res, 0);
3463 if (ret) 3471 if (ret)
3464 goto out_free; 3472 goto out_free;
3465 if (res.acl_len > args.acl_len) 3473 if (res.acl_len > args.acl_len)
@@ -3534,7 +3542,7 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl
3534 if (i < 0) 3542 if (i < 0)
3535 return i; 3543 return i;
3536 nfs_inode_return_delegation(inode); 3544 nfs_inode_return_delegation(inode);
3537 ret = nfs4_call_sync(server, &msg, &arg.seq_args, &res.seq_res, 1); 3545 ret = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
3538 3546
3539 /* 3547 /*
3540 * Free each page after tx, so the only ref left is 3548 * Free each page after tx, so the only ref left is
@@ -3897,7 +3905,7 @@ static int _nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock
3897 lsp = request->fl_u.nfs4_fl.owner; 3905 lsp = request->fl_u.nfs4_fl.owner;
3898 arg.lock_owner.id = lsp->ls_id.id; 3906 arg.lock_owner.id = lsp->ls_id.id;
3899 arg.lock_owner.s_dev = server->s_dev; 3907 arg.lock_owner.s_dev = server->s_dev;
3900 status = nfs4_call_sync(server, &msg, &arg.seq_args, &res.seq_res, 1); 3908 status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
3901 switch (status) { 3909 switch (status) {
3902 case 0: 3910 case 0:
3903 request->fl_type = F_UNLCK; 3911 request->fl_type = F_UNLCK;
@@ -4625,7 +4633,7 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,
4625 nfs_fattr_init(&fs_locations->fattr); 4633 nfs_fattr_init(&fs_locations->fattr);
4626 fs_locations->server = server; 4634 fs_locations->server = server;
4627 fs_locations->nlocations = 0; 4635 fs_locations->nlocations = 0;
4628 status = nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0); 4636 status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
4629 nfs_fixup_referral_attributes(&fs_locations->fattr); 4637 nfs_fixup_referral_attributes(&fs_locations->fattr);
4630 dprintk("%s: returned status = %d\n", __func__, status); 4638 dprintk("%s: returned status = %d\n", __func__, status);
4631 return status; 4639 return status;
@@ -5593,7 +5601,7 @@ _nfs4_proc_getdeviceinfo(struct nfs_server *server, struct pnfs_device *pdev)
5593 int status; 5601 int status;
5594 5602
5595 dprintk("--> %s\n", __func__); 5603 dprintk("--> %s\n", __func__);
5596 status = nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0); 5604 status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
5597 dprintk("<-- %s status=%d\n", __func__, status); 5605 dprintk("<-- %s status=%d\n", __func__, status);
5598 5606
5599 return status; 5607 return status;
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index b8ec170f2a0f..ac40b8535d7e 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -177,7 +177,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
177} 177}
178 178
179static int 179static int
180nfs_proc_lookup(struct inode *dir, struct qstr *name, 180nfs_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qstr *name,
181 struct nfs_fh *fhandle, struct nfs_fattr *fattr) 181 struct nfs_fh *fhandle, struct nfs_fattr *fattr)
182{ 182{
183 struct nfs_diropargs arg = { 183 struct nfs_diropargs arg = {
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 2c2c67d2eb42..71ee6799db9b 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1071,7 +1071,7 @@ struct nfs_rpc_ops {
1071 struct nfs_fattr *); 1071 struct nfs_fattr *);
1072 int (*setattr) (struct dentry *, struct nfs_fattr *, 1072 int (*setattr) (struct dentry *, struct nfs_fattr *,
1073 struct iattr *); 1073 struct iattr *);
1074 int (*lookup) (struct inode *, struct qstr *, 1074 int (*lookup) (struct rpc_clnt *clnt, struct inode *, struct qstr *,
1075 struct nfs_fh *, struct nfs_fattr *); 1075 struct nfs_fh *, struct nfs_fattr *);
1076 int (*access) (struct inode *, struct nfs_access_entry *); 1076 int (*access) (struct inode *, struct nfs_access_entry *);
1077 int (*readlink)(struct inode *, struct page *, unsigned int, 1077 int (*readlink)(struct inode *, struct page *, unsigned int,