aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/client.c5
-rw-r--r--fs/nfs/internal.h12
-rw-r--r--fs/nfs/nfs4proc.c67
-rw-r--r--include/linux/nfs_fs_sb.h8
4 files changed, 73 insertions, 19 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index f1506f148521..a9828baaa445 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -194,6 +194,8 @@ static void nfs4_clear_client_minor_version(struct nfs_client *clp)
194 nfs4_destroy_session(clp->cl_session); 194 nfs4_destroy_session(clp->cl_session);
195 clp->cl_session = NULL; 195 clp->cl_session = NULL;
196 } 196 }
197
198 clp->cl_call_sync = _nfs4_call_sync;
197#endif /* CONFIG_NFS_V4_1 */ 199#endif /* CONFIG_NFS_V4_1 */
198} 200}
199 201
@@ -1073,6 +1075,8 @@ error:
1073 */ 1075 */
1074static int nfs4_init_client_minor_version(struct nfs_client *clp) 1076static int nfs4_init_client_minor_version(struct nfs_client *clp)
1075{ 1077{
1078 clp->cl_call_sync = _nfs4_call_sync;
1079
1076#if defined(CONFIG_NFS_V4_1) 1080#if defined(CONFIG_NFS_V4_1)
1077 if (clp->cl_minorversion) { 1081 if (clp->cl_minorversion) {
1078 struct nfs4_session *session = NULL; 1082 struct nfs4_session *session = NULL;
@@ -1086,6 +1090,7 @@ static int nfs4_init_client_minor_version(struct nfs_client *clp)
1086 return -ENOMEM; 1090 return -ENOMEM;
1087 1091
1088 clp->cl_session = session; 1092 clp->cl_session = session;
1093 clp->cl_call_sync = _nfs4_call_sync_session;
1089 } 1094 }
1090#endif /* CONFIG_NFS_V4_1 */ 1095#endif /* CONFIG_NFS_V4_1 */
1091 1096
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 7cef45db9257..8d67c2865dc3 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -206,6 +206,18 @@ extern int nfs4_path_walk(struct nfs_server *server,
206 const char *path); 206 const char *path);
207#endif 207#endif
208 208
209/* nfs4proc.c */
210extern int _nfs4_call_sync(struct nfs_server *server,
211 struct rpc_message *msg,
212 struct nfs4_sequence_args *args,
213 struct nfs4_sequence_res *res,
214 int cache_reply);
215extern int _nfs4_call_sync_session(struct nfs_server *server,
216 struct rpc_message *msg,
217 struct nfs4_sequence_args *args,
218 struct nfs4_sequence_res *res,
219 int cache_reply);
220
209/* 221/*
210 * Determine if sessions are in use. 222 * Determine if sessions are in use.
211 */ 223 */
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index e08edc99faac..4fc5b385f61e 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -271,6 +271,33 @@ static void renew_lease(const struct nfs_server *server, unsigned long timestamp
271 spin_unlock(&clp->cl_lock); 271 spin_unlock(&clp->cl_lock);
272} 272}
273 273
274#if defined(CONFIG_NFS_V4_1)
275
276int _nfs4_call_sync_session(struct nfs_server *server,
277 struct rpc_message *msg,
278 struct nfs4_sequence_args *args,
279 struct nfs4_sequence_res *res,
280 int cache_reply)
281{
282 /* in preparation for setting up the sequence op */
283 return rpc_call_sync(server->client, msg, 0);
284}
285
286#endif /* CONFIG_NFS_V4_1 */
287
288int _nfs4_call_sync(struct nfs_server *server,
289 struct rpc_message *msg,
290 struct nfs4_sequence_args *args,
291 struct nfs4_sequence_res *res,
292 int cache_reply)
293{
294 return rpc_call_sync(server->client, msg, 0);
295}
296
297#define nfs4_call_sync(server, msg, args, res, cache_reply) \
298 (server)->nfs_client->cl_call_sync((server), (msg), &(args)->seq_args, \
299 &(res)->seq_res, (cache_reply))
300
274static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) 301static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo)
275{ 302{
276 struct nfs_inode *nfsi = NFS_I(dir); 303 struct nfs_inode *nfsi = NFS_I(dir);
@@ -1269,7 +1296,7 @@ static int _nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
1269 } else 1296 } else
1270 memcpy(&arg.stateid, &zero_stateid, sizeof(arg.stateid)); 1297 memcpy(&arg.stateid, &zero_stateid, sizeof(arg.stateid));
1271 1298
1272 status = rpc_call_sync(server->client, &msg, 0); 1299 status = nfs4_call_sync(server, &msg, &arg, &res, 1);
1273 if (status == 0 && state != NULL) 1300 if (status == 0 && state != NULL)
1274 renew_lease(server, timestamp); 1301 renew_lease(server, timestamp);
1275 return status; 1302 return status;
@@ -1595,7 +1622,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
1595 }; 1622 };
1596 int status; 1623 int status;
1597 1624
1598 status = rpc_call_sync(server->client, &msg, 0); 1625 status = nfs4_call_sync(server, &msg, &args, &res, 0);
1599 if (status == 0) { 1626 if (status == 0) {
1600 memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask)); 1627 memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask));
1601 if (res.attr_bitmask[0] & FATTR4_WORD0_ACL) 1628 if (res.attr_bitmask[0] & FATTR4_WORD0_ACL)
@@ -1609,6 +1636,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
1609 server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY; 1636 server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY;
1610 server->acl_bitmask = res.acl_bitmask; 1637 server->acl_bitmask = res.acl_bitmask;
1611 } 1638 }
1639
1612 return status; 1640 return status;
1613} 1641}
1614 1642
@@ -1641,7 +1669,7 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
1641 .rpc_resp = &res, 1669 .rpc_resp = &res,
1642 }; 1670 };
1643 nfs_fattr_init(info->fattr); 1671 nfs_fattr_init(info->fattr);
1644 return rpc_call_sync(server->client, &msg, 0); 1672 return nfs4_call_sync(server, &msg, &args, &res, 0);
1645} 1673}
1646 1674
1647static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, 1675static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
@@ -1731,7 +1759,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
1731 }; 1759 };
1732 1760
1733 nfs_fattr_init(fattr); 1761 nfs_fattr_init(fattr);
1734 return rpc_call_sync(server->client, &msg, 0); 1762 return nfs4_call_sync(server, &msg, &args, &res, 0);
1735} 1763}
1736 1764
1737static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr) 1765static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr)
@@ -1815,7 +1843,7 @@ static int _nfs4_proc_lookupfh(struct nfs_server *server, const struct nfs_fh *d
1815 nfs_fattr_init(fattr); 1843 nfs_fattr_init(fattr);
1816 1844
1817 dprintk("NFS call lookupfh %s\n", name->name); 1845 dprintk("NFS call lookupfh %s\n", name->name);
1818 status = rpc_call_sync(server->client, &msg, 0); 1846 status = nfs4_call_sync(server, &msg, &args, &res, 0);
1819 dprintk("NFS reply lookupfh: %d\n", status); 1847 dprintk("NFS reply lookupfh: %d\n", status);
1820 return status; 1848 return status;
1821} 1849}
@@ -1901,7 +1929,7 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry
1901 args.access |= NFS4_ACCESS_EXECUTE; 1929 args.access |= NFS4_ACCESS_EXECUTE;
1902 } 1930 }
1903 nfs_fattr_init(&fattr); 1931 nfs_fattr_init(&fattr);
1904 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); 1932 status = nfs4_call_sync(server, &msg, &args, &res, 0);
1905 if (!status) { 1933 if (!status) {
1906 entry->mask = 0; 1934 entry->mask = 0;
1907 if (res.access & NFS4_ACCESS_READ) 1935 if (res.access & NFS4_ACCESS_READ)
@@ -1967,7 +1995,7 @@ static int _nfs4_proc_readlink(struct inode *inode, struct page *page,
1967 .rpc_resp = &res, 1995 .rpc_resp = &res,
1968 }; 1996 };
1969 1997
1970 return rpc_call_sync(NFS_CLIENT(inode), &msg, 0); 1998 return nfs4_call_sync(NFS_SERVER(inode), &msg, &args, &res, 0);
1971} 1999}
1972 2000
1973static int nfs4_proc_readlink(struct inode *inode, struct page *page, 2001static int nfs4_proc_readlink(struct inode *inode, struct page *page,
@@ -2061,7 +2089,7 @@ static int _nfs4_proc_remove(struct inode *dir, struct qstr *name)
2061 int status; 2089 int status;
2062 2090
2063 nfs_fattr_init(&res.dir_attr); 2091 nfs_fattr_init(&res.dir_attr);
2064 status = rpc_call_sync(server->client, &msg, 0); 2092 status = nfs4_call_sync(server, &msg, &args, &res, 1);
2065 if (status == 0) { 2093 if (status == 0) {
2066 update_changeattr(dir, &res.cinfo); 2094 update_changeattr(dir, &res.cinfo);
2067 nfs_post_op_update_inode(dir, &res.dir_attr); 2095 nfs_post_op_update_inode(dir, &res.dir_attr);
@@ -2129,7 +2157,7 @@ static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,
2129 2157
2130 nfs_fattr_init(res.old_fattr); 2158 nfs_fattr_init(res.old_fattr);
2131 nfs_fattr_init(res.new_fattr); 2159 nfs_fattr_init(res.new_fattr);
2132 status = rpc_call_sync(server->client, &msg, 0); 2160 status = nfs4_call_sync(server, &msg, &arg, &res, 1);
2133 2161
2134 if (!status) { 2162 if (!status) {
2135 update_changeattr(old_dir, &res.old_cinfo); 2163 update_changeattr(old_dir, &res.old_cinfo);
@@ -2178,7 +2206,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *
2178 2206
2179 nfs_fattr_init(res.fattr); 2207 nfs_fattr_init(res.fattr);
2180 nfs_fattr_init(res.dir_attr); 2208 nfs_fattr_init(res.dir_attr);
2181 status = rpc_call_sync(server->client, &msg, 0); 2209 status = nfs4_call_sync(server, &msg, &arg, &res, 1);
2182 if (!status) { 2210 if (!status) {
2183 update_changeattr(dir, &res.cinfo); 2211 update_changeattr(dir, &res.cinfo);
2184 nfs_post_op_update_inode(dir, res.dir_attr); 2212 nfs_post_op_update_inode(dir, res.dir_attr);
@@ -2239,7 +2267,8 @@ static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir,
2239 2267
2240static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_createdata *data) 2268static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_createdata *data)
2241{ 2269{
2242 int status = rpc_call_sync(NFS_CLIENT(dir), &data->msg, 0); 2270 int status = nfs4_call_sync(NFS_SERVER(dir), &data->msg,
2271 &data->arg, &data->res, 1);
2243 if (status == 0) { 2272 if (status == 0) {
2244 update_changeattr(dir, &data->res.dir_cinfo); 2273 update_changeattr(dir, &data->res.dir_cinfo);
2245 nfs_post_op_update_inode(dir, data->res.dir_fattr); 2274 nfs_post_op_update_inode(dir, data->res.dir_fattr);
@@ -2348,7 +2377,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
2348 (unsigned long long)cookie); 2377 (unsigned long long)cookie);
2349 nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args); 2378 nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args);
2350 res.pgbase = args.pgbase; 2379 res.pgbase = args.pgbase;
2351 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 2380 status = nfs4_call_sync(NFS_SERVER(dir), &msg, &args, &res, 0);
2352 if (status == 0) 2381 if (status == 0)
2353 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE); 2382 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE);
2354 2383
@@ -2436,7 +2465,7 @@ static int _nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
2436 }; 2465 };
2437 2466
2438 nfs_fattr_init(fsstat->fattr); 2467 nfs_fattr_init(fsstat->fattr);
2439 return rpc_call_sync(server->client, &msg, 0); 2468 return nfs4_call_sync(server, &msg, &args, &res, 0);
2440} 2469}
2441 2470
2442static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat) 2471static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat)
@@ -2467,7 +2496,7 @@ static int _nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
2467 .rpc_resp = &res, 2496 .rpc_resp = &res,
2468 }; 2497 };
2469 2498
2470 return rpc_call_sync(server->client, &msg, 0); 2499 return nfs4_call_sync(server, &msg, &args, &res, 0);
2471} 2500}
2472 2501
2473static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) 2502static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo)
@@ -2512,7 +2541,7 @@ static int _nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle
2512 } 2541 }
2513 2542
2514 nfs_fattr_init(pathconf->fattr); 2543 nfs_fattr_init(pathconf->fattr);
2515 return rpc_call_sync(server->client, &msg, 0); 2544 return nfs4_call_sync(server, &msg, &args, &res, 0);
2516} 2545}
2517 2546
2518static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, 2547static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
@@ -2781,7 +2810,7 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu
2781 resp_buf = buf; 2810 resp_buf = buf;
2782 buf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase); 2811 buf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase);
2783 } 2812 }
2784 ret = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); 2813 ret = nfs4_call_sync(NFS_SERVER(inode), &msg, &args, &res, 0);
2785 if (ret) 2814 if (ret)
2786 goto out_free; 2815 goto out_free;
2787 if (res.acl_len > args.acl_len) 2816 if (res.acl_len > args.acl_len)
@@ -2854,7 +2883,7 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl
2854 return -EOPNOTSUPP; 2883 return -EOPNOTSUPP;
2855 nfs_inode_return_delegation(inode); 2884 nfs_inode_return_delegation(inode);
2856 buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase); 2885 buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase);
2857 ret = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); 2886 ret = nfs4_call_sync(server, &msg, &arg, &res, 1);
2858 nfs_access_zap_cache(inode); 2887 nfs_access_zap_cache(inode);
2859 nfs_zap_acl_cache(inode); 2888 nfs_zap_acl_cache(inode);
2860 return ret; 2889 return ret;
@@ -3143,7 +3172,7 @@ static int _nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock
3143 goto out; 3172 goto out;
3144 lsp = request->fl_u.nfs4_fl.owner; 3173 lsp = request->fl_u.nfs4_fl.owner;
3145 arg.lock_owner.id = lsp->ls_id.id; 3174 arg.lock_owner.id = lsp->ls_id.id;
3146 status = rpc_call_sync(server->client, &msg, 0); 3175 status = nfs4_call_sync(server, &msg, &arg, &res, 1);
3147 switch (status) { 3176 switch (status) {
3148 case 0: 3177 case 0:
3149 request->fl_type = F_UNLCK; 3178 request->fl_type = F_UNLCK;
@@ -3736,7 +3765,7 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,
3736 nfs_fattr_init(&fs_locations->fattr); 3765 nfs_fattr_init(&fs_locations->fattr);
3737 fs_locations->server = server; 3766 fs_locations->server = server;
3738 fs_locations->nlocations = 0; 3767 fs_locations->nlocations = 0;
3739 status = rpc_call_sync(server->client, &msg, 0); 3768 status = nfs4_call_sync(server, &msg, &args, &res, 0);
3740 nfs_fixup_referral_attributes(&fs_locations->fattr); 3769 nfs_fixup_referral_attributes(&fs_locations->fattr);
3741 dprintk("%s: returned status = %d\n", __func__, status); 3770 dprintk("%s: returned status = %d\n", __func__, status);
3742 return status; 3771 return status;
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index b47c0fc55d42..206485e5082f 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -12,6 +12,9 @@
12struct nfs4_session; 12struct nfs4_session;
13struct nfs_iostats; 13struct nfs_iostats;
14struct nlm_host; 14struct nlm_host;
15struct nfs4_sequence_args;
16struct nfs4_sequence_res;
17struct nfs_server;
15 18
16/* 19/*
17 * The nfs_client identifies our client state to the server. 20 * The nfs_client identifies our client state to the server.
@@ -67,6 +70,11 @@ struct nfs_client {
67 */ 70 */
68 char cl_ipaddr[48]; 71 char cl_ipaddr[48];
69 unsigned char cl_id_uniquifier; 72 unsigned char cl_id_uniquifier;
73 int (* cl_call_sync)(struct nfs_server *server,
74 struct rpc_message *msg,
75 struct nfs4_sequence_args *args,
76 struct nfs4_sequence_res *res,
77 int cache_reply);
70#endif /* CONFIG_NFS_V4 */ 78#endif /* CONFIG_NFS_V4 */
71 79
72#ifdef CONFIG_NFS_V4_1 80#ifdef CONFIG_NFS_V4_1