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.c92
1 files changed, 46 insertions, 46 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index edc95514046d..92c870d19ccd 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -78,7 +78,7 @@ nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
78 int status; 78 int status;
79 79
80 dprintk("%s: call fsinfo\n", __FUNCTION__); 80 dprintk("%s: call fsinfo\n", __FUNCTION__);
81 info->fattr->valid = 0; 81 nfs_fattr_init(info->fattr);
82 status = rpc_call(server->client_sys, NFS3PROC_FSINFO, fhandle, info, 0); 82 status = rpc_call(server->client_sys, NFS3PROC_FSINFO, fhandle, info, 0);
83 dprintk("%s: reply fsinfo: %d\n", __FUNCTION__, status); 83 dprintk("%s: reply fsinfo: %d\n", __FUNCTION__, status);
84 if (!(info->fattr->valid & NFS_ATTR_FATTR)) { 84 if (!(info->fattr->valid & NFS_ATTR_FATTR)) {
@@ -98,7 +98,7 @@ nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
98 int status; 98 int status;
99 99
100 dprintk("NFS call getattr\n"); 100 dprintk("NFS call getattr\n");
101 fattr->valid = 0; 101 nfs_fattr_init(fattr);
102 status = rpc_call(server->client, NFS3PROC_GETATTR, 102 status = rpc_call(server->client, NFS3PROC_GETATTR,
103 fhandle, fattr, 0); 103 fhandle, fattr, 0);
104 dprintk("NFS reply getattr: %d\n", status); 104 dprintk("NFS reply getattr: %d\n", status);
@@ -117,7 +117,7 @@ nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
117 int status; 117 int status;
118 118
119 dprintk("NFS call setattr\n"); 119 dprintk("NFS call setattr\n");
120 fattr->valid = 0; 120 nfs_fattr_init(fattr);
121 status = rpc_call(NFS_CLIENT(inode), NFS3PROC_SETATTR, &arg, fattr, 0); 121 status = rpc_call(NFS_CLIENT(inode), NFS3PROC_SETATTR, &arg, fattr, 0);
122 if (status == 0) 122 if (status == 0)
123 nfs_setattr_update_inode(inode, sattr); 123 nfs_setattr_update_inode(inode, sattr);
@@ -143,8 +143,8 @@ nfs3_proc_lookup(struct inode *dir, struct qstr *name,
143 int status; 143 int status;
144 144
145 dprintk("NFS call lookup %s\n", name->name); 145 dprintk("NFS call lookup %s\n", name->name);
146 dir_attr.valid = 0; 146 nfs_fattr_init(&dir_attr);
147 fattr->valid = 0; 147 nfs_fattr_init(fattr);
148 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_LOOKUP, &arg, &res, 0); 148 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_LOOKUP, &arg, &res, 0);
149 if (status >= 0 && !(fattr->valid & NFS_ATTR_FATTR)) 149 if (status >= 0 && !(fattr->valid & NFS_ATTR_FATTR))
150 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_GETATTR, 150 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_GETATTR,
@@ -174,7 +174,6 @@ static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry)
174 int status; 174 int status;
175 175
176 dprintk("NFS call access\n"); 176 dprintk("NFS call access\n");
177 fattr.valid = 0;
178 177
179 if (mode & MAY_READ) 178 if (mode & MAY_READ)
180 arg.access |= NFS3_ACCESS_READ; 179 arg.access |= NFS3_ACCESS_READ;
@@ -189,6 +188,7 @@ static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry)
189 if (mode & MAY_EXEC) 188 if (mode & MAY_EXEC)
190 arg.access |= NFS3_ACCESS_EXECUTE; 189 arg.access |= NFS3_ACCESS_EXECUTE;
191 } 190 }
191 nfs_fattr_init(&fattr);
192 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); 192 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
193 nfs_refresh_inode(inode, &fattr); 193 nfs_refresh_inode(inode, &fattr);
194 if (status == 0) { 194 if (status == 0) {
@@ -217,7 +217,7 @@ static int nfs3_proc_readlink(struct inode *inode, struct page *page,
217 int status; 217 int status;
218 218
219 dprintk("NFS call readlink\n"); 219 dprintk("NFS call readlink\n");
220 fattr.valid = 0; 220 nfs_fattr_init(&fattr);
221 status = rpc_call(NFS_CLIENT(inode), NFS3PROC_READLINK, 221 status = rpc_call(NFS_CLIENT(inode), NFS3PROC_READLINK,
222 &args, &fattr, 0); 222 &args, &fattr, 0);
223 nfs_refresh_inode(inode, &fattr); 223 nfs_refresh_inode(inode, &fattr);
@@ -240,7 +240,7 @@ static int nfs3_proc_read(struct nfs_read_data *rdata)
240 240
241 dprintk("NFS call read %d @ %Ld\n", rdata->args.count, 241 dprintk("NFS call read %d @ %Ld\n", rdata->args.count,
242 (long long) rdata->args.offset); 242 (long long) rdata->args.offset);
243 fattr->valid = 0; 243 nfs_fattr_init(fattr);
244 status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags); 244 status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
245 if (status >= 0) 245 if (status >= 0)
246 nfs_refresh_inode(inode, fattr); 246 nfs_refresh_inode(inode, fattr);
@@ -263,10 +263,10 @@ static int nfs3_proc_write(struct nfs_write_data *wdata)
263 263
264 dprintk("NFS call write %d @ %Ld\n", wdata->args.count, 264 dprintk("NFS call write %d @ %Ld\n", wdata->args.count,
265 (long long) wdata->args.offset); 265 (long long) wdata->args.offset);
266 fattr->valid = 0; 266 nfs_fattr_init(fattr);
267 status = rpc_call_sync(NFS_CLIENT(inode), &msg, rpcflags); 267 status = rpc_call_sync(NFS_CLIENT(inode), &msg, rpcflags);
268 if (status >= 0) 268 if (status >= 0)
269 nfs_refresh_inode(inode, fattr); 269 nfs_post_op_update_inode(inode, fattr);
270 dprintk("NFS reply write: %d\n", status); 270 dprintk("NFS reply write: %d\n", status);
271 return status < 0? status : wdata->res.count; 271 return status < 0? status : wdata->res.count;
272} 272}
@@ -285,10 +285,10 @@ static int nfs3_proc_commit(struct nfs_write_data *cdata)
285 285
286 dprintk("NFS call commit %d @ %Ld\n", cdata->args.count, 286 dprintk("NFS call commit %d @ %Ld\n", cdata->args.count,
287 (long long) cdata->args.offset); 287 (long long) cdata->args.offset);
288 fattr->valid = 0; 288 nfs_fattr_init(fattr);
289 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); 289 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
290 if (status >= 0) 290 if (status >= 0)
291 nfs_refresh_inode(inode, fattr); 291 nfs_post_op_update_inode(inode, fattr);
292 dprintk("NFS reply commit: %d\n", status); 292 dprintk("NFS reply commit: %d\n", status);
293 return status; 293 return status;
294} 294}
@@ -299,7 +299,7 @@ static int nfs3_proc_commit(struct nfs_write_data *cdata)
299 */ 299 */
300static int 300static int
301nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, 301nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
302 int flags) 302 int flags, struct nameidata *nd)
303{ 303{
304 struct nfs_fh fhandle; 304 struct nfs_fh fhandle;
305 struct nfs_fattr fattr; 305 struct nfs_fattr fattr;
@@ -329,10 +329,10 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
329 sattr->ia_mode &= ~current->fs->umask; 329 sattr->ia_mode &= ~current->fs->umask;
330 330
331again: 331again:
332 dir_attr.valid = 0; 332 nfs_fattr_init(&dir_attr);
333 fattr.valid = 0; 333 nfs_fattr_init(&fattr);
334 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_CREATE, &arg, &res, 0); 334 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_CREATE, &arg, &res, 0);
335 nfs_refresh_inode(dir, &dir_attr); 335 nfs_post_op_update_inode(dir, &dir_attr);
336 336
337 /* If the server doesn't support the exclusive creation semantics, 337 /* If the server doesn't support the exclusive creation semantics,
338 * try again with simple 'guarded' mode. */ 338 * try again with simple 'guarded' mode. */
@@ -401,9 +401,9 @@ nfs3_proc_remove(struct inode *dir, struct qstr *name)
401 int status; 401 int status;
402 402
403 dprintk("NFS call remove %s\n", name->name); 403 dprintk("NFS call remove %s\n", name->name);
404 dir_attr.valid = 0; 404 nfs_fattr_init(&dir_attr);
405 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 405 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
406 nfs_refresh_inode(dir, &dir_attr); 406 nfs_post_op_update_inode(dir, &dir_attr);
407 dprintk("NFS reply remove: %d\n", status); 407 dprintk("NFS reply remove: %d\n", status);
408 return status; 408 return status;
409} 409}
@@ -422,7 +422,7 @@ nfs3_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr
422 ptr->arg.fh = NFS_FH(dir->d_inode); 422 ptr->arg.fh = NFS_FH(dir->d_inode);
423 ptr->arg.name = name->name; 423 ptr->arg.name = name->name;
424 ptr->arg.len = name->len; 424 ptr->arg.len = name->len;
425 ptr->res.valid = 0; 425 nfs_fattr_init(&ptr->res);
426 msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE]; 426 msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE];
427 msg->rpc_argp = &ptr->arg; 427 msg->rpc_argp = &ptr->arg;
428 msg->rpc_resp = &ptr->res; 428 msg->rpc_resp = &ptr->res;
@@ -439,7 +439,7 @@ nfs3_proc_unlink_done(struct dentry *dir, struct rpc_task *task)
439 return 1; 439 return 1;
440 if (msg->rpc_argp) { 440 if (msg->rpc_argp) {
441 dir_attr = (struct nfs_fattr*)msg->rpc_resp; 441 dir_attr = (struct nfs_fattr*)msg->rpc_resp;
442 nfs_refresh_inode(dir->d_inode, dir_attr); 442 nfs_post_op_update_inode(dir->d_inode, dir_attr);
443 kfree(msg->rpc_argp); 443 kfree(msg->rpc_argp);
444 } 444 }
445 return 0; 445 return 0;
@@ -465,11 +465,11 @@ nfs3_proc_rename(struct inode *old_dir, struct qstr *old_name,
465 int status; 465 int status;
466 466
467 dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name); 467 dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name);
468 old_dir_attr.valid = 0; 468 nfs_fattr_init(&old_dir_attr);
469 new_dir_attr.valid = 0; 469 nfs_fattr_init(&new_dir_attr);
470 status = rpc_call(NFS_CLIENT(old_dir), NFS3PROC_RENAME, &arg, &res, 0); 470 status = rpc_call(NFS_CLIENT(old_dir), NFS3PROC_RENAME, &arg, &res, 0);
471 nfs_refresh_inode(old_dir, &old_dir_attr); 471 nfs_post_op_update_inode(old_dir, &old_dir_attr);
472 nfs_refresh_inode(new_dir, &new_dir_attr); 472 nfs_post_op_update_inode(new_dir, &new_dir_attr);
473 dprintk("NFS reply rename: %d\n", status); 473 dprintk("NFS reply rename: %d\n", status);
474 return status; 474 return status;
475} 475}
@@ -491,11 +491,11 @@ nfs3_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
491 int status; 491 int status;
492 492
493 dprintk("NFS call link %s\n", name->name); 493 dprintk("NFS call link %s\n", name->name);
494 dir_attr.valid = 0; 494 nfs_fattr_init(&dir_attr);
495 fattr.valid = 0; 495 nfs_fattr_init(&fattr);
496 status = rpc_call(NFS_CLIENT(inode), NFS3PROC_LINK, &arg, &res, 0); 496 status = rpc_call(NFS_CLIENT(inode), NFS3PROC_LINK, &arg, &res, 0);
497 nfs_refresh_inode(dir, &dir_attr); 497 nfs_post_op_update_inode(dir, &dir_attr);
498 nfs_refresh_inode(inode, &fattr); 498 nfs_post_op_update_inode(inode, &fattr);
499 dprintk("NFS reply link: %d\n", status); 499 dprintk("NFS reply link: %d\n", status);
500 return status; 500 return status;
501} 501}
@@ -524,10 +524,10 @@ nfs3_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path,
524 if (path->len > NFS3_MAXPATHLEN) 524 if (path->len > NFS3_MAXPATHLEN)
525 return -ENAMETOOLONG; 525 return -ENAMETOOLONG;
526 dprintk("NFS call symlink %s -> %s\n", name->name, path->name); 526 dprintk("NFS call symlink %s -> %s\n", name->name, path->name);
527 dir_attr.valid = 0; 527 nfs_fattr_init(&dir_attr);
528 fattr->valid = 0; 528 nfs_fattr_init(fattr);
529 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_SYMLINK, &arg, &res, 0); 529 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_SYMLINK, &arg, &res, 0);
530 nfs_refresh_inode(dir, &dir_attr); 530 nfs_post_op_update_inode(dir, &dir_attr);
531 dprintk("NFS reply symlink: %d\n", status); 531 dprintk("NFS reply symlink: %d\n", status);
532 return status; 532 return status;
533} 533}
@@ -552,13 +552,13 @@ nfs3_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr)
552 int status; 552 int status;
553 553
554 dprintk("NFS call mkdir %s\n", dentry->d_name.name); 554 dprintk("NFS call mkdir %s\n", dentry->d_name.name);
555 dir_attr.valid = 0;
556 fattr.valid = 0;
557 555
558 sattr->ia_mode &= ~current->fs->umask; 556 sattr->ia_mode &= ~current->fs->umask;
559 557
558 nfs_fattr_init(&dir_attr);
559 nfs_fattr_init(&fattr);
560 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_MKDIR, &arg, &res, 0); 560 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_MKDIR, &arg, &res, 0);
561 nfs_refresh_inode(dir, &dir_attr); 561 nfs_post_op_update_inode(dir, &dir_attr);
562 if (status != 0) 562 if (status != 0)
563 goto out; 563 goto out;
564 status = nfs_instantiate(dentry, &fhandle, &fattr); 564 status = nfs_instantiate(dentry, &fhandle, &fattr);
@@ -582,9 +582,9 @@ nfs3_proc_rmdir(struct inode *dir, struct qstr *name)
582 int status; 582 int status;
583 583
584 dprintk("NFS call rmdir %s\n", name->name); 584 dprintk("NFS call rmdir %s\n", name->name);
585 dir_attr.valid = 0; 585 nfs_fattr_init(&dir_attr);
586 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_RMDIR, &arg, &dir_attr, 0); 586 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_RMDIR, &arg, &dir_attr, 0);
587 nfs_refresh_inode(dir, &dir_attr); 587 nfs_post_op_update_inode(dir, &dir_attr);
588 dprintk("NFS reply rmdir: %d\n", status); 588 dprintk("NFS reply rmdir: %d\n", status);
589 return status; 589 return status;
590} 590}
@@ -634,7 +634,7 @@ nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
634 dprintk("NFS call readdir%s %d\n", 634 dprintk("NFS call readdir%s %d\n",
635 plus? "plus" : "", (unsigned int) cookie); 635 plus? "plus" : "", (unsigned int) cookie);
636 636
637 dir_attr.valid = 0; 637 nfs_fattr_init(&dir_attr);
638 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 638 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
639 nfs_refresh_inode(dir, &dir_attr); 639 nfs_refresh_inode(dir, &dir_attr);
640 dprintk("NFS reply readdir: %d\n", status); 640 dprintk("NFS reply readdir: %d\n", status);
@@ -676,10 +676,10 @@ nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
676 676
677 sattr->ia_mode &= ~current->fs->umask; 677 sattr->ia_mode &= ~current->fs->umask;
678 678
679 dir_attr.valid = 0; 679 nfs_fattr_init(&dir_attr);
680 fattr.valid = 0; 680 nfs_fattr_init(&fattr);
681 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_MKNOD, &arg, &res, 0); 681 status = rpc_call(NFS_CLIENT(dir), NFS3PROC_MKNOD, &arg, &res, 0);
682 nfs_refresh_inode(dir, &dir_attr); 682 nfs_post_op_update_inode(dir, &dir_attr);
683 if (status != 0) 683 if (status != 0)
684 goto out; 684 goto out;
685 status = nfs_instantiate(dentry, &fh, &fattr); 685 status = nfs_instantiate(dentry, &fh, &fattr);
@@ -698,7 +698,7 @@ nfs3_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
698 int status; 698 int status;
699 699
700 dprintk("NFS call fsstat\n"); 700 dprintk("NFS call fsstat\n");
701 stat->fattr->valid = 0; 701 nfs_fattr_init(stat->fattr);
702 status = rpc_call(server->client, NFS3PROC_FSSTAT, fhandle, stat, 0); 702 status = rpc_call(server->client, NFS3PROC_FSSTAT, fhandle, stat, 0);
703 dprintk("NFS reply statfs: %d\n", status); 703 dprintk("NFS reply statfs: %d\n", status);
704 return status; 704 return status;
@@ -711,7 +711,7 @@ nfs3_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
711 int status; 711 int status;
712 712
713 dprintk("NFS call fsinfo\n"); 713 dprintk("NFS call fsinfo\n");
714 info->fattr->valid = 0; 714 nfs_fattr_init(info->fattr);
715 status = rpc_call(server->client_sys, NFS3PROC_FSINFO, fhandle, info, 0); 715 status = rpc_call(server->client_sys, NFS3PROC_FSINFO, fhandle, info, 0);
716 dprintk("NFS reply fsinfo: %d\n", status); 716 dprintk("NFS reply fsinfo: %d\n", status);
717 return status; 717 return status;
@@ -724,7 +724,7 @@ nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
724 int status; 724 int status;
725 725
726 dprintk("NFS call pathconf\n"); 726 dprintk("NFS call pathconf\n");
727 info->fattr->valid = 0; 727 nfs_fattr_init(info->fattr);
728 status = rpc_call(server->client, NFS3PROC_PATHCONF, fhandle, info, 0); 728 status = rpc_call(server->client, NFS3PROC_PATHCONF, fhandle, info, 0);
729 dprintk("NFS reply pathconf: %d\n", status); 729 dprintk("NFS reply pathconf: %d\n", status);
730 return status; 730 return status;
@@ -735,7 +735,7 @@ extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int);
735static void 735static void
736nfs3_read_done(struct rpc_task *task) 736nfs3_read_done(struct rpc_task *task)
737{ 737{
738 struct nfs_write_data *data = (struct nfs_write_data *) task->tk_calldata; 738 struct nfs_read_data *data = (struct nfs_read_data *) task->tk_calldata;
739 739
740 if (nfs3_async_handle_jukebox(task)) 740 if (nfs3_async_handle_jukebox(task))
741 return; 741 return;
@@ -775,7 +775,7 @@ nfs3_write_done(struct rpc_task *task)
775 return; 775 return;
776 data = (struct nfs_write_data *)task->tk_calldata; 776 data = (struct nfs_write_data *)task->tk_calldata;
777 if (task->tk_status >= 0) 777 if (task->tk_status >= 0)
778 nfs_refresh_inode(data->inode, data->res.fattr); 778 nfs_post_op_update_inode(data->inode, data->res.fattr);
779 nfs_writeback_done(task); 779 nfs_writeback_done(task);
780} 780}
781 781
@@ -819,7 +819,7 @@ nfs3_commit_done(struct rpc_task *task)
819 return; 819 return;
820 data = (struct nfs_write_data *)task->tk_calldata; 820 data = (struct nfs_write_data *)task->tk_calldata;
821 if (task->tk_status >= 0) 821 if (task->tk_status >= 0)
822 nfs_refresh_inode(data->inode, data->res.fattr); 822 nfs_post_op_update_inode(data->inode, data->res.fattr);
823 nfs_commit_done(task); 823 nfs_commit_done(task);
824} 824}
825 825