nfs4proc.c (e73b83f270828630a9ce33728f6ef61c37a82340) | nfs4proc.c (7c5130588d691a3b34d02312f1bd1b6d56fe0100) |
---|---|
1/* 2 * fs/nfs/nfs4proc.c 3 * 4 * Client-side procedure declarations for NFSv4. 5 * 6 * Copyright (c) 2002 The Regents of the University of Michigan. 7 * All rights reserved. 8 * --- 57 unchanged lines hidden (view full) --- 66 67#define NFS4_MAX_LOOP_ON_RECOVER (10) 68 69struct nfs4_opendata; 70static int _nfs4_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 *); 73static int nfs4_async_handle_error(struct rpc_task *, const struct nfs_server *, struct nfs4_state *); | 1/* 2 * fs/nfs/nfs4proc.c 3 * 4 * Client-side procedure declarations for NFSv4. 5 * 6 * Copyright (c) 2002 The Regents of the University of Michigan. 7 * All rights reserved. 8 * --- 57 unchanged lines hidden (view full) --- 66 67#define NFS4_MAX_LOOP_ON_RECOVER (10) 68 69struct nfs4_opendata; 70static int _nfs4_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 *); 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); 76static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, 77 struct nfs_fattr *fattr, struct iattr *sattr, 78 struct nfs4_state *state); 79 80/* Prevent leaks of NFSv4 errors into userland */ 81static int nfs4_map_errors(int err) 82{ --- 569 unchanged lines hidden (view full) --- 652 .rpc_call_done = nfs41_call_sync_done, 653}; 654 655struct rpc_call_ops nfs41_call_priv_sync_ops = { 656 .rpc_call_prepare = nfs41_call_priv_sync_prepare, 657 .rpc_call_done = nfs41_call_sync_done, 658}; 659 | 77static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr); 78static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, 79 struct nfs_fattr *fattr, struct iattr *sattr, 80 struct nfs4_state *state); 81 82/* Prevent leaks of NFSv4 errors into userland */ 83static int nfs4_map_errors(int err) 84{ --- 569 unchanged lines hidden (view full) --- 654 .rpc_call_done = nfs41_call_sync_done, 655}; 656 657struct rpc_call_ops nfs41_call_priv_sync_ops = { 658 .rpc_call_prepare = nfs41_call_priv_sync_prepare, 659 .rpc_call_done = nfs41_call_sync_done, 660}; 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, 662 struct nfs4_sequence_args *args, 663 struct nfs4_sequence_res *res, 664 int cache_reply, 665 int privileged) 666{ 667 int ret; 668 struct rpc_task *task; 669 struct nfs41_call_sync_data data = { 670 .seq_server = server, 671 .seq_args = args, 672 .seq_res = res, 673 .cache_reply = cache_reply, 674 }; 675 struct rpc_task_setup task_setup = { | 664 struct rpc_message *msg, 665 struct nfs4_sequence_args *args, 666 struct nfs4_sequence_res *res, 667 int cache_reply, 668 int privileged) 669{ 670 int ret; 671 struct rpc_task *task; 672 struct nfs41_call_sync_data data = { 673 .seq_server = server, 674 .seq_args = args, 675 .seq_res = res, 676 .cache_reply = cache_reply, 677 }; 678 struct rpc_task_setup task_setup = { |
676 .rpc_client = server->client, | 679 .rpc_client = clnt, |
677 .rpc_message = msg, 678 .callback_ops = &nfs41_call_sync_ops, 679 .callback_data = &data 680 }; 681 682 res->sr_slot = NULL; 683 if (privileged) 684 task_setup.callback_ops = &nfs41_call_priv_sync_ops; 685 task = rpc_run_task(&task_setup); 686 if (IS_ERR(task)) 687 ret = PTR_ERR(task); 688 else { 689 ret = task->tk_status; 690 rpc_put_task(task); 691 } 692 return ret; 693} 694 | 680 .rpc_message = msg, 681 .callback_ops = &nfs41_call_sync_ops, 682 .callback_data = &data 683 }; 684 685 res->sr_slot = NULL; 686 if (privileged) 687 task_setup.callback_ops = &nfs41_call_priv_sync_ops; 688 task = rpc_run_task(&task_setup); 689 if (IS_ERR(task)) 690 ret = PTR_ERR(task); 691 else { 692 ret = task->tk_status; 693 rpc_put_task(task); 694 } 695 return ret; 696} 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, 697 struct nfs4_sequence_args *args, 698 struct nfs4_sequence_res *res, 699 int cache_reply) 700{ | 700 struct rpc_message *msg, 701 struct nfs4_sequence_args *args, 702 struct nfs4_sequence_res *res, 703 int cache_reply) 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} 703 704#else 705static int nfs4_sequence_done(struct rpc_task *task, 706 struct nfs4_sequence_res *res) 707{ 708 return 1; 709} 710#endif /* CONFIG_NFS_V4_1 */ 711 | 706} 707 708#else 709static int nfs4_sequence_done(struct rpc_task *task, 710 struct nfs4_sequence_res *res) 711{ 712 return 1; 713} 714#endif /* CONFIG_NFS_V4_1 */ 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, 714 struct nfs4_sequence_args *args, 715 struct nfs4_sequence_res *res, 716 int cache_reply) 717{ 718 args->sa_session = res->sr_session = NULL; | 718 struct rpc_message *msg, 719 struct nfs4_sequence_args *args, 720 struct nfs4_sequence_res *res, 721 int cache_reply) 722{ 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} 721 722static inline | 725} 726 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, 725 struct nfs4_sequence_args *args, 726 struct nfs4_sequence_res *res, 727 int cache_reply) 728{ | 730 struct rpc_message *msg, 731 struct nfs4_sequence_args *args, 732 struct nfs4_sequence_res *res, 733 int cache_reply) 734{ |
729 return server->nfs_client->cl_mvops->call_sync(server, msg, args, 730 res, cache_reply); | 735 return server->nfs_client->cl_mvops->call_sync(clnt, server, msg, 736 args, res, cache_reply); |
731} 732 733static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) 734{ 735 struct nfs_inode *nfsi = NFS_I(dir); 736 737 spin_lock(&dir->i_lock); 738 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA; --- 1094 unchanged lines hidden (view full) --- 1833 1834 if (nfs4_copy_delegation_stateid(&arg.stateid, inode)) { 1835 /* Use that stateid */ 1836 } else if (state != NULL) { 1837 nfs4_copy_stateid(&arg.stateid, state, current->files, current->tgid); 1838 } else 1839 memcpy(&arg.stateid, &zero_stateid, sizeof(arg.stateid)); 1840 | 737} 738 739static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) 740{ 741 struct nfs_inode *nfsi = NFS_I(dir); 742 743 spin_lock(&dir->i_lock); 744 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA; --- 1094 unchanged lines hidden (view full) --- 1839 1840 if (nfs4_copy_delegation_stateid(&arg.stateid, inode)) { 1841 /* Use that stateid */ 1842 } else if (state != NULL) { 1843 nfs4_copy_stateid(&arg.stateid, state, current->files, current->tgid); 1844 } else 1845 memcpy(&arg.stateid, &zero_stateid, sizeof(arg.stateid)); 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) 1843 renew_lease(server, timestamp); 1844 return status; 1845} 1846 1847static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, 1848 struct nfs_fattr *fattr, struct iattr *sattr, 1849 struct nfs4_state *state) --- 242 unchanged lines hidden (view full) --- 2092 struct nfs4_server_caps_res res = {}; 2093 struct rpc_message msg = { 2094 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SERVER_CAPS], 2095 .rpc_argp = &args, 2096 .rpc_resp = &res, 2097 }; 2098 int status; 2099 | 1848 if (status == 0 && state != NULL) 1849 renew_lease(server, timestamp); 1850 return status; 1851} 1852 1853static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, 1854 struct nfs_fattr *fattr, struct iattr *sattr, 1855 struct nfs4_state *state) --- 242 unchanged lines hidden (view full) --- 2098 struct nfs4_server_caps_res res = {}; 2099 struct rpc_message msg = { 2100 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SERVER_CAPS], 2101 .rpc_argp = &args, 2102 .rpc_resp = &res, 2103 }; 2104 int status; 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) { 2102 memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask)); 2103 server->caps &= ~(NFS_CAP_ACLS|NFS_CAP_HARDLINKS| 2104 NFS_CAP_SYMLINKS|NFS_CAP_FILEID| 2105 NFS_CAP_MODE|NFS_CAP_NLINK|NFS_CAP_OWNER| 2106 NFS_CAP_OWNER_GROUP|NFS_CAP_ATIME| 2107 NFS_CAP_CTIME|NFS_CAP_MTIME); 2108 if (res.attr_bitmask[0] & FATTR4_WORD0_ACL) --- 53 unchanged lines hidden (view full) --- 2162 }; 2163 struct rpc_message msg = { 2164 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LOOKUP_ROOT], 2165 .rpc_argp = &args, 2166 .rpc_resp = &res, 2167 }; 2168 2169 nfs_fattr_init(info->fattr); | 2107 if (status == 0) { 2108 memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask)); 2109 server->caps &= ~(NFS_CAP_ACLS|NFS_CAP_HARDLINKS| 2110 NFS_CAP_SYMLINKS|NFS_CAP_FILEID| 2111 NFS_CAP_MODE|NFS_CAP_NLINK|NFS_CAP_OWNER| 2112 NFS_CAP_OWNER_GROUP|NFS_CAP_ATIME| 2113 NFS_CAP_CTIME|NFS_CAP_MTIME); 2114 if (res.attr_bitmask[0] & FATTR4_WORD0_ACL) --- 53 unchanged lines hidden (view full) --- 2168 }; 2169 struct rpc_message msg = { 2170 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LOOKUP_ROOT], 2171 .rpc_argp = &args, 2172 .rpc_resp = &res, 2173 }; 2174 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} 2172 2173static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, 2174 struct nfs_fsinfo *info) 2175{ 2176 struct nfs4_exception exception = { }; 2177 int err; 2178 do { --- 72 unchanged lines hidden (view full) --- 2251 }; 2252 struct rpc_message msg = { 2253 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETATTR], 2254 .rpc_argp = &args, 2255 .rpc_resp = &res, 2256 }; 2257 2258 nfs_fattr_init(fattr); | 2177} 2178 2179static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, 2180 struct nfs_fsinfo *info) 2181{ 2182 struct nfs4_exception exception = { }; 2183 int err; 2184 do { --- 72 unchanged lines hidden (view full) --- 2257 }; 2258 struct rpc_message msg = { 2259 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETATTR], 2260 .rpc_argp = &args, 2261 .rpc_resp = &res, 2262 }; 2263 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} 2261 2262static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr) 2263{ 2264 struct nfs4_exception exception = { }; 2265 int err; 2266 do { 2267 err = nfs4_handle_exception(server, --- 43 unchanged lines hidden (view full) --- 2311 } 2312 2313 status = nfs4_do_setattr(inode, cred, fattr, sattr, state); 2314 if (status == 0) 2315 nfs_setattr_update_inode(inode, sattr); 2316 return status; 2317} 2318 | 2266} 2267 2268static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr) 2269{ 2270 struct nfs4_exception exception = { }; 2271 int err; 2272 do { 2273 err = nfs4_handle_exception(server, --- 43 unchanged lines hidden (view full) --- 2317 } 2318 2319 status = nfs4_do_setattr(inode, cred, fattr, sattr, state); 2320 if (status == 0) 2321 nfs_setattr_update_inode(inode, sattr); 2322 return status; 2323} 2324 |
2319static int _nfs4_proc_lookupfh(struct nfs_server *server, const struct nfs_fh *dirfh, 2320 const struct qstr *name, struct nfs_fh *fhandle, 2321 struct nfs_fattr *fattr) | 2325static int _nfs4_proc_lookupfh(struct rpc_clnt *clnt, struct nfs_server *server, 2326 const struct nfs_fh *dirfh, const struct qstr *name, 2327 struct nfs_fh *fhandle, struct nfs_fattr *fattr) |
2322{ 2323 int status; 2324 struct nfs4_lookup_arg args = { 2325 .bitmask = server->attr_bitmask, 2326 .dir_fh = dirfh, 2327 .name = name, 2328 }; 2329 struct nfs4_lookup_res res = { --- 5 unchanged lines hidden (view full) --- 2335 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LOOKUP], 2336 .rpc_argp = &args, 2337 .rpc_resp = &res, 2338 }; 2339 2340 nfs_fattr_init(fattr); 2341 2342 dprintk("NFS call lookupfh %s\n", name->name); | 2328{ 2329 int status; 2330 struct nfs4_lookup_arg args = { 2331 .bitmask = server->attr_bitmask, 2332 .dir_fh = dirfh, 2333 .name = name, 2334 }; 2335 struct nfs4_lookup_res res = { --- 5 unchanged lines hidden (view full) --- 2341 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LOOKUP], 2342 .rpc_argp = &args, 2343 .rpc_resp = &res, 2344 }; 2345 2346 nfs_fattr_init(fattr); 2347 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); 2345 return status; 2346} 2347 2348static int nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh, 2349 struct qstr *name, struct nfs_fh *fhandle, 2350 struct nfs_fattr *fattr) 2351{ 2352 struct nfs4_exception exception = { }; 2353 int err; 2354 do { | 2350 dprintk("NFS reply lookupfh: %d\n", status); 2351 return status; 2352} 2353 2354static int nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh, 2355 struct qstr *name, struct nfs_fh *fhandle, 2356 struct nfs_fattr *fattr) 2357{ 2358 struct nfs4_exception exception = { }; 2359 int err; 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: !!!! */ 2357 if (err == -NFS4ERR_MOVED) { 2358 err = -EREMOTE; 2359 break; 2360 } 2361 err = nfs4_handle_exception(server, err, &exception); 2362 } while (exception.retry); 2363 return err; 2364} 2365 | 2362 /* FIXME: !!!! */ 2363 if (err == -NFS4ERR_MOVED) { 2364 err = -EREMOTE; 2365 break; 2366 } 2367 err = nfs4_handle_exception(server, err, &exception); 2368 } while (exception.retry); 2369 return err; 2370} 2371 |
2366static int _nfs4_proc_lookup(struct inode *dir, const struct qstr *name, 2367 struct nfs_fh *fhandle, struct nfs_fattr *fattr) | 2372static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, 2373 const struct qstr *name, struct nfs_fh *fhandle, 2374 struct nfs_fattr *fattr) |
2368{ 2369 int status; 2370 2371 dprintk("NFS call lookup %s\n", name->name); | 2375{ 2376 int status; 2377 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) 2374 status = nfs4_get_referral(dir, name, fattr, fhandle); 2375 dprintk("NFS reply lookup: %d\n", status); 2376 return status; 2377} 2378 | 2380 if (status == -NFS4ERR_MOVED) 2381 status = nfs4_get_referral(dir, name, fattr, fhandle); 2382 dprintk("NFS reply lookup: %d\n", status); 2383 return status; 2384} 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{ 2381 struct nfs4_exception exception = { }; 2382 int err; 2383 do { 2384 err = nfs4_handle_exception(NFS_SERVER(dir), | 2388{ 2389 struct nfs4_exception exception = { }; 2390 int err; 2391 do { 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); 2387 } while (exception.retry); 2388 return err; 2389} 2390 2391static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) 2392{ 2393 struct nfs_server *server = NFS_SERVER(inode); --- 29 unchanged lines hidden (view full) --- 2423 if (mode & MAY_EXEC) 2424 args.access |= NFS4_ACCESS_EXECUTE; 2425 } 2426 2427 res.fattr = nfs_alloc_fattr(); 2428 if (res.fattr == NULL) 2429 return -ENOMEM; 2430 | 2394 &exception); 2395 } while (exception.retry); 2396 return err; 2397} 2398 2399static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) 2400{ 2401 struct nfs_server *server = NFS_SERVER(inode); --- 29 unchanged lines hidden (view full) --- 2431 if (mode & MAY_EXEC) 2432 args.access |= NFS4_ACCESS_EXECUTE; 2433 } 2434 2435 res.fattr = nfs_alloc_fattr(); 2436 if (res.fattr == NULL) 2437 return -ENOMEM; 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) { 2433 entry->mask = 0; 2434 if (res.access & NFS4_ACCESS_READ) 2435 entry->mask |= MAY_READ; 2436 if (res.access & (NFS4_ACCESS_MODIFY | NFS4_ACCESS_EXTEND | NFS4_ACCESS_DELETE)) 2437 entry->mask |= MAY_WRITE; 2438 if (res.access & (NFS4_ACCESS_LOOKUP|NFS4_ACCESS_EXECUTE)) 2439 entry->mask |= MAY_EXEC; --- 50 unchanged lines hidden (view full) --- 2490 }; 2491 struct nfs4_readlink_res res; 2492 struct rpc_message msg = { 2493 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READLINK], 2494 .rpc_argp = &args, 2495 .rpc_resp = &res, 2496 }; 2497 | 2440 if (!status) { 2441 entry->mask = 0; 2442 if (res.access & NFS4_ACCESS_READ) 2443 entry->mask |= MAY_READ; 2444 if (res.access & (NFS4_ACCESS_MODIFY | NFS4_ACCESS_EXTEND | NFS4_ACCESS_DELETE)) 2445 entry->mask |= MAY_WRITE; 2446 if (res.access & (NFS4_ACCESS_LOOKUP|NFS4_ACCESS_EXECUTE)) 2447 entry->mask |= MAY_EXEC; --- 50 unchanged lines hidden (view full) --- 2498 }; 2499 struct nfs4_readlink_res res; 2500 struct rpc_message msg = { 2501 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READLINK], 2502 .rpc_argp = &args, 2503 .rpc_resp = &res, 2504 }; 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} 2500 2501static int nfs4_proc_readlink(struct inode *inode, struct page *page, 2502 unsigned int pgbase, unsigned int pglen) 2503{ 2504 struct nfs4_exception exception = { }; 2505 int err; 2506 do { --- 72 unchanged lines hidden (view full) --- 2579 .rpc_resp = &res, 2580 }; 2581 int status = -ENOMEM; 2582 2583 res.dir_attr = nfs_alloc_fattr(); 2584 if (res.dir_attr == NULL) 2585 goto out; 2586 | 2507} 2508 2509static int nfs4_proc_readlink(struct inode *inode, struct page *page, 2510 unsigned int pgbase, unsigned int pglen) 2511{ 2512 struct nfs4_exception exception = { }; 2513 int err; 2514 do { --- 72 unchanged lines hidden (view full) --- 2587 .rpc_resp = &res, 2588 }; 2589 int status = -ENOMEM; 2590 2591 res.dir_attr = nfs_alloc_fattr(); 2592 if (res.dir_attr == NULL) 2593 goto out; 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) { 2589 update_changeattr(dir, &res.cinfo); 2590 nfs_post_op_update_inode(dir, res.dir_attr); 2591 } 2592 nfs_free_fattr(res.dir_attr); 2593out: 2594 return status; 2595} --- 84 unchanged lines hidden (view full) --- 2680 }; 2681 int status = -ENOMEM; 2682 2683 res.old_fattr = nfs_alloc_fattr(); 2684 res.new_fattr = nfs_alloc_fattr(); 2685 if (res.old_fattr == NULL || res.new_fattr == NULL) 2686 goto out; 2687 | 2596 if (status == 0) { 2597 update_changeattr(dir, &res.cinfo); 2598 nfs_post_op_update_inode(dir, res.dir_attr); 2599 } 2600 nfs_free_fattr(res.dir_attr); 2601out: 2602 return status; 2603} --- 84 unchanged lines hidden (view full) --- 2688 }; 2689 int status = -ENOMEM; 2690 2691 res.old_fattr = nfs_alloc_fattr(); 2692 res.new_fattr = nfs_alloc_fattr(); 2693 if (res.old_fattr == NULL || res.new_fattr == NULL) 2694 goto out; 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) { 2690 update_changeattr(old_dir, &res.old_cinfo); 2691 nfs_post_op_update_inode(old_dir, res.old_fattr); 2692 update_changeattr(new_dir, &res.new_cinfo); 2693 nfs_post_op_update_inode(new_dir, res.new_fattr); 2694 } 2695out: 2696 nfs_free_fattr(res.new_fattr); --- 34 unchanged lines hidden (view full) --- 2731 }; 2732 int status = -ENOMEM; 2733 2734 res.fattr = nfs_alloc_fattr(); 2735 res.dir_attr = nfs_alloc_fattr(); 2736 if (res.fattr == NULL || res.dir_attr == NULL) 2737 goto out; 2738 | 2697 if (!status) { 2698 update_changeattr(old_dir, &res.old_cinfo); 2699 nfs_post_op_update_inode(old_dir, res.old_fattr); 2700 update_changeattr(new_dir, &res.new_cinfo); 2701 nfs_post_op_update_inode(new_dir, res.new_fattr); 2702 } 2703out: 2704 nfs_free_fattr(res.new_fattr); --- 34 unchanged lines hidden (view full) --- 2739 }; 2740 int status = -ENOMEM; 2741 2742 res.fattr = nfs_alloc_fattr(); 2743 res.dir_attr = nfs_alloc_fattr(); 2744 if (res.fattr == NULL || res.dir_attr == NULL) 2745 goto out; 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) { 2741 update_changeattr(dir, &res.cinfo); 2742 nfs_post_op_update_inode(dir, res.dir_attr); 2743 nfs_post_op_update_inode(inode, res.fattr); 2744 } 2745out: 2746 nfs_free_fattr(res.dir_attr); 2747 nfs_free_fattr(res.fattr); --- 46 unchanged lines hidden (view full) --- 2794 nfs_fattr_init(data->res.fattr); 2795 nfs_fattr_init(data->res.dir_fattr); 2796 } 2797 return data; 2798} 2799 2800static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_createdata *data) 2801{ | 2748 if (!status) { 2749 update_changeattr(dir, &res.cinfo); 2750 nfs_post_op_update_inode(dir, res.dir_attr); 2751 nfs_post_op_update_inode(inode, res.fattr); 2752 } 2753out: 2754 nfs_free_fattr(res.dir_attr); 2755 nfs_free_fattr(res.fattr); --- 46 unchanged lines hidden (view full) --- 2802 nfs_fattr_init(data->res.fattr); 2803 nfs_fattr_init(data->res.dir_fattr); 2804 } 2805 return data; 2806} 2807 2808static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_createdata *data) 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); 2804 if (status == 0) { 2805 update_changeattr(dir, &data->res.dir_cinfo); 2806 nfs_post_op_update_inode(dir, data->res.dir_fattr); 2807 status = nfs_instantiate(dentry, data->res.fh, data->res.fattr); 2808 } 2809 return status; 2810} --- 96 unchanged lines hidden (view full) --- 2907 int status; 2908 2909 dprintk("%s: dentry = %s/%s, cookie = %Lu\n", __func__, 2910 dentry->d_parent->d_name.name, 2911 dentry->d_name.name, 2912 (unsigned long long)cookie); 2913 nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args); 2914 res.pgbase = args.pgbase; | 2811 &data->arg.seq_args, &data->res.seq_res, 1); 2812 if (status == 0) { 2813 update_changeattr(dir, &data->res.dir_cinfo); 2814 nfs_post_op_update_inode(dir, data->res.dir_fattr); 2815 status = nfs_instantiate(dentry, data->res.fh, data->res.fattr); 2816 } 2817 return status; 2818} --- 96 unchanged lines hidden (view full) --- 2915 int status; 2916 2917 dprintk("%s: dentry = %s/%s, cookie = %Lu\n", __func__, 2918 dentry->d_parent->d_name.name, 2919 dentry->d_name.name, 2920 (unsigned long long)cookie); 2921 nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args); 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) { 2917 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE); 2918 status += args.pgbase; 2919 } 2920 2921 nfs_invalidate_atime(dir); 2922 2923 dprintk("%s: returns %d\n", __func__, status); --- 75 unchanged lines hidden (view full) --- 2999 }; 3000 struct rpc_message msg = { 3001 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_STATFS], 3002 .rpc_argp = &args, 3003 .rpc_resp = &res, 3004 }; 3005 3006 nfs_fattr_init(fsstat->fattr); | 2924 if (status >= 0) { 2925 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE); 2926 status += args.pgbase; 2927 } 2928 2929 nfs_invalidate_atime(dir); 2930 2931 dprintk("%s: returns %d\n", __func__, status); --- 75 unchanged lines hidden (view full) --- 3007 }; 3008 struct rpc_message msg = { 3009 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_STATFS], 3010 .rpc_argp = &args, 3011 .rpc_resp = &res, 3012 }; 3013 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} 3009 3010static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat) 3011{ 3012 struct nfs4_exception exception = { }; 3013 int err; 3014 do { 3015 err = nfs4_handle_exception(server, --- 14 unchanged lines hidden (view full) --- 3030 .fsinfo = fsinfo, 3031 }; 3032 struct rpc_message msg = { 3033 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_FSINFO], 3034 .rpc_argp = &args, 3035 .rpc_resp = &res, 3036 }; 3037 | 3016} 3017 3018static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat) 3019{ 3020 struct nfs4_exception exception = { }; 3021 int err; 3022 do { 3023 err = nfs4_handle_exception(server, --- 14 unchanged lines hidden (view full) --- 3038 .fsinfo = fsinfo, 3039 }; 3040 struct rpc_message msg = { 3041 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_FSINFO], 3042 .rpc_argp = &args, 3043 .rpc_resp = &res, 3044 }; 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} 3040 3041static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) 3042{ 3043 struct nfs4_exception exception = { }; 3044 int err; 3045 3046 do { --- 28 unchanged lines hidden (view full) --- 3075 3076 /* None of the pathconf attributes are mandatory to implement */ 3077 if ((args.bitmask[0] & nfs4_pathconf_bitmap[0]) == 0) { 3078 memset(pathconf, 0, sizeof(*pathconf)); 3079 return 0; 3080 } 3081 3082 nfs_fattr_init(pathconf->fattr); | 3047} 3048 3049static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) 3050{ 3051 struct nfs4_exception exception = { }; 3052 int err; 3053 3054 do { --- 28 unchanged lines hidden (view full) --- 3083 3084 /* None of the pathconf attributes are mandatory to implement */ 3085 if ((args.bitmask[0] & nfs4_pathconf_bitmap[0]) == 0) { 3086 memset(pathconf, 0, sizeof(*pathconf)); 3087 return 0; 3088 } 3089 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} 3085 3086static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, 3087 struct nfs_pathconf *pathconf) 3088{ 3089 struct nfs4_exception exception = { }; 3090 int err; 3091 --- 362 unchanged lines hidden (view full) --- 3454 return -ENOMEM; 3455 args.acl_pages[0] = localpage; 3456 args.acl_pgbase = 0; 3457 args.acl_len = PAGE_SIZE; 3458 } else { 3459 resp_buf = buf; 3460 buf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase); 3461 } | 3092} 3093 3094static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, 3095 struct nfs_pathconf *pathconf) 3096{ 3097 struct nfs4_exception exception = { }; 3098 int err; 3099 --- 362 unchanged lines hidden (view full) --- 3462 return -ENOMEM; 3463 args.acl_pages[0] = localpage; 3464 args.acl_pgbase = 0; 3465 args.acl_len = PAGE_SIZE; 3466 } else { 3467 resp_buf = buf; 3468 buf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase); 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) 3464 goto out_free; 3465 if (res.acl_len > args.acl_len) 3466 nfs4_write_cached_acl(inode, NULL, res.acl_len); 3467 else 3468 nfs4_write_cached_acl(inode, resp_buf, res.acl_len); 3469 if (buf) { 3470 ret = -ERANGE; --- 58 unchanged lines hidden (view full) --- 3529 int ret, i; 3530 3531 if (!nfs4_server_supports_acls(server)) 3532 return -EOPNOTSUPP; 3533 i = buf_to_pages_noslab(buf, buflen, arg.acl_pages, &arg.acl_pgbase); 3534 if (i < 0) 3535 return i; 3536 nfs_inode_return_delegation(inode); | 3471 if (ret) 3472 goto out_free; 3473 if (res.acl_len > args.acl_len) 3474 nfs4_write_cached_acl(inode, NULL, res.acl_len); 3475 else 3476 nfs4_write_cached_acl(inode, resp_buf, res.acl_len); 3477 if (buf) { 3478 ret = -ERANGE; --- 58 unchanged lines hidden (view full) --- 3537 int ret, i; 3538 3539 if (!nfs4_server_supports_acls(server)) 3540 return -EOPNOTSUPP; 3541 i = buf_to_pages_noslab(buf, buflen, arg.acl_pages, &arg.acl_pgbase); 3542 if (i < 0) 3543 return i; 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 3539 /* 3540 * Free each page after tx, so the only ref left is 3541 * held by the network stack 3542 */ 3543 for (; i > 0; i--) 3544 put_page(pages[i-1]); 3545 --- 346 unchanged lines hidden (view full) --- 3892 3893 arg.lock_owner.clientid = clp->cl_clientid; 3894 status = nfs4_set_lock_state(state, request); 3895 if (status != 0) 3896 goto out; 3897 lsp = request->fl_u.nfs4_fl.owner; 3898 arg.lock_owner.id = lsp->ls_id.id; 3899 arg.lock_owner.s_dev = server->s_dev; | 3546 3547 /* 3548 * Free each page after tx, so the only ref left is 3549 * held by the network stack 3550 */ 3551 for (; i > 0; i--) 3552 put_page(pages[i-1]); 3553 --- 346 unchanged lines hidden (view full) --- 3900 3901 arg.lock_owner.clientid = clp->cl_clientid; 3902 status = nfs4_set_lock_state(state, request); 3903 if (status != 0) 3904 goto out; 3905 lsp = request->fl_u.nfs4_fl.owner; 3906 arg.lock_owner.id = lsp->ls_id.id; 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) { 3902 case 0: 3903 request->fl_type = F_UNLCK; 3904 break; 3905 case -NFS4ERR_DENIED: 3906 status = 0; 3907 } 3908 request->fl_ops->fl_release_private(request); --- 711 unchanged lines hidden (view full) --- 4620 .rpc_resp = &res, 4621 }; 4622 int status; 4623 4624 dprintk("%s: start\n", __func__); 4625 nfs_fattr_init(&fs_locations->fattr); 4626 fs_locations->server = server; 4627 fs_locations->nlocations = 0; | 3909 switch (status) { 3910 case 0: 3911 request->fl_type = F_UNLCK; 3912 break; 3913 case -NFS4ERR_DENIED: 3914 status = 0; 3915 } 3916 request->fl_ops->fl_release_private(request); --- 711 unchanged lines hidden (view full) --- 4628 .rpc_resp = &res, 4629 }; 4630 int status; 4631 4632 dprintk("%s: start\n", __func__); 4633 nfs_fattr_init(&fs_locations->fattr); 4634 fs_locations->server = server; 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); 4630 dprintk("%s: returned status = %d\n", __func__, status); 4631 return status; 4632} 4633 4634#ifdef CONFIG_NFS_V4_1 4635/* 4636 * Check the exchange flags returned by the server for invalid flags, having --- 951 unchanged lines hidden (view full) --- 5588 struct rpc_message msg = { 5589 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETDEVICEINFO], 5590 .rpc_argp = &args, 5591 .rpc_resp = &res, 5592 }; 5593 int status; 5594 5595 dprintk("--> %s\n", __func__); | 4637 nfs_fixup_referral_attributes(&fs_locations->fattr); 4638 dprintk("%s: returned status = %d\n", __func__, status); 4639 return status; 4640} 4641 4642#ifdef CONFIG_NFS_V4_1 4643/* 4644 * Check the exchange flags returned by the server for invalid flags, having --- 951 unchanged lines hidden (view full) --- 5596 struct rpc_message msg = { 5597 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETDEVICEINFO], 5598 .rpc_argp = &args, 5599 .rpc_resp = &res, 5600 }; 5601 int status; 5602 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); 5598 5599 return status; 5600} 5601 5602int nfs4_proc_getdeviceinfo(struct nfs_server *server, struct pnfs_device *pdev) 5603{ 5604 struct nfs4_exception exception = { }; --- 165 unchanged lines hidden --- | 5605 dprintk("<-- %s status=%d\n", __func__, status); 5606 5607 return status; 5608} 5609 5610int nfs4_proc_getdeviceinfo(struct nfs_server *server, struct pnfs_device *pdev) 5611{ 5612 struct nfs4_exception exception = { }; --- 165 unchanged lines hidden --- |