aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2005-10-27 22:12:38 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-10-27 22:12:38 -0400
commit0e574af1be5f569a5d7f2800333b0bfb358a5e34 (patch)
treebb5b62dece21b8906222dfee022020ed6f81e34c /fs
parent4c2cb58c552a34744979a99ccf01762d5eb7e288 (diff)
NFS: Cleanup initialisation of struct nfs_fattr
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/dir.c1
-rw-r--r--fs/nfs/nfs3proc.c58
-rw-r--r--fs/nfs/nfs4proc.c43
-rw-r--r--fs/nfs/proc.c26
-rw-r--r--fs/nfs/read.c1
-rw-r--r--fs/nfs/write.c2
6 files changed, 66 insertions, 65 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index eb50c19fc253..b8a73045e9a0 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -532,6 +532,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
532 my_entry.eof = 0; 532 my_entry.eof = 0;
533 my_entry.fh = &fh; 533 my_entry.fh = &fh;
534 my_entry.fattr = &fattr; 534 my_entry.fattr = &fattr;
535 nfs_fattr_init(&fattr);
535 desc->entry = &my_entry; 536 desc->entry = &my_entry;
536 537
537 while(!desc->entry->eof) { 538 while(!desc->entry->eof) {
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index e4a1cd48195e..4b1b48b139f6 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,7 +263,7 @@ 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_refresh_inode(inode, fattr);
@@ -285,7 +285,7 @@ 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_refresh_inode(inode, fattr);
@@ -329,8 +329,8 @@ 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_refresh_inode(dir, &dir_attr);
336 336
@@ -401,7 +401,7 @@ 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_refresh_inode(dir, &dir_attr);
407 dprintk("NFS reply remove: %d\n", status); 407 dprintk("NFS reply remove: %d\n", status);
@@ -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;
@@ -465,8 +465,8 @@ 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_refresh_inode(old_dir, &old_dir_attr);
472 nfs_refresh_inode(new_dir, &new_dir_attr); 472 nfs_refresh_inode(new_dir, &new_dir_attr);
@@ -491,8 +491,8 @@ 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_refresh_inode(dir, &dir_attr);
498 nfs_refresh_inode(inode, &fattr); 498 nfs_refresh_inode(inode, &fattr);
@@ -524,8 +524,8 @@ 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_refresh_inode(dir, &dir_attr);
531 dprintk("NFS reply symlink: %d\n", status); 531 dprintk("NFS reply symlink: %d\n", status);
@@ -552,11 +552,11 @@ 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_refresh_inode(dir, &dir_attr);
562 if (status != 0) 562 if (status != 0)
@@ -582,7 +582,7 @@ 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_refresh_inode(dir, &dir_attr);
588 dprintk("NFS reply rmdir: %d\n", status); 588 dprintk("NFS reply rmdir: %d\n", status);
@@ -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,8 +676,8 @@ 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_refresh_inode(dir, &dir_attr);
683 if (status != 0) 683 if (status != 0)
@@ -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;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 9c1da34036aa..2a759e8e387c 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -494,9 +494,7 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st
494 struct inode *inode = state->inode; 494 struct inode *inode = state->inode;
495 struct nfs_server *server = NFS_SERVER(dir); 495 struct nfs_server *server = NFS_SERVER(dir);
496 struct nfs_delegation *delegation = NFS_I(inode)->delegation; 496 struct nfs_delegation *delegation = NFS_I(inode)->delegation;
497 struct nfs_fattr f_attr = { 497 struct nfs_fattr f_attr;
498 .valid = 0,
499 };
500 struct nfs_openargs o_arg = { 498 struct nfs_openargs o_arg = {
501 .fh = NFS_FH(dir), 499 .fh = NFS_FH(dir),
502 .open_flags = state->state, 500 .open_flags = state->state,
@@ -522,6 +520,7 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st
522 status = -ENOMEM; 520 status = -ENOMEM;
523 if (o_arg.seqid == NULL) 521 if (o_arg.seqid == NULL)
524 goto out; 522 goto out;
523 nfs_fattr_init(&f_attr);
525 status = _nfs4_proc_open(dir, sp, &o_arg, &o_res); 524 status = _nfs4_proc_open(dir, sp, &o_arg, &o_res);
526 if (status != 0) 525 if (status != 0)
527 goto out_nodeleg; 526 goto out_nodeleg;
@@ -692,9 +691,7 @@ static int _nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, st
692 struct nfs4_client *clp = server->nfs4_state; 691 struct nfs4_client *clp = server->nfs4_state;
693 struct inode *inode = NULL; 692 struct inode *inode = NULL;
694 int status; 693 int status;
695 struct nfs_fattr f_attr = { 694 struct nfs_fattr f_attr;
696 .valid = 0,
697 };
698 struct nfs_openargs o_arg = { 695 struct nfs_openargs o_arg = {
699 .fh = NFS_FH(dir), 696 .fh = NFS_FH(dir),
700 .open_flags = flags, 697 .open_flags = flags,
@@ -726,6 +723,7 @@ static int _nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, st
726 o_arg.seqid = nfs_alloc_seqid(&sp->so_seqid); 723 o_arg.seqid = nfs_alloc_seqid(&sp->so_seqid);
727 if (o_arg.seqid == NULL) 724 if (o_arg.seqid == NULL)
728 return -ENOMEM; 725 return -ENOMEM;
726 nfs_fattr_init(&f_attr);
729 status = _nfs4_proc_open(dir, sp, &o_arg, &o_res); 727 status = _nfs4_proc_open(dir, sp, &o_arg, &o_res);
730 if (status != 0) 728 if (status != 0)
731 goto out_err; 729 goto out_err;
@@ -824,7 +822,7 @@ static int _nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr,
824 }; 822 };
825 int status; 823 int status;
826 824
827 fattr->valid = 0; 825 nfs_fattr_init(fattr);
828 826
829 if (state != NULL) { 827 if (state != NULL) {
830 msg.rpc_cred = state->owner->so_cred; 828 msg.rpc_cred = state->owner->so_cred;
@@ -1107,13 +1105,12 @@ static int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fh
1107static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, 1105static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
1108 struct nfs_fsinfo *info) 1106 struct nfs_fsinfo *info)
1109{ 1107{
1110 struct nfs_fattr * fattr = info->fattr;
1111 struct nfs4_lookup_root_arg args = { 1108 struct nfs4_lookup_root_arg args = {
1112 .bitmask = nfs4_fattr_bitmap, 1109 .bitmask = nfs4_fattr_bitmap,
1113 }; 1110 };
1114 struct nfs4_lookup_res res = { 1111 struct nfs4_lookup_res res = {
1115 .server = server, 1112 .server = server,
1116 .fattr = fattr, 1113 .fattr = info->fattr,
1117 .fh = fhandle, 1114 .fh = fhandle,
1118 }; 1115 };
1119 struct rpc_message msg = { 1116 struct rpc_message msg = {
@@ -1121,7 +1118,7 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
1121 .rpc_argp = &args, 1118 .rpc_argp = &args,
1122 .rpc_resp = &res, 1119 .rpc_resp = &res,
1123 }; 1120 };
1124 fattr->valid = 0; 1121 nfs_fattr_init(info->fattr);
1125 return rpc_call_sync(server->client, &msg, 0); 1122 return rpc_call_sync(server->client, &msg, 0);
1126} 1123}
1127 1124
@@ -1184,7 +1181,7 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
1184 q.len = p - q.name; 1181 q.len = p - q.name;
1185 1182
1186 do { 1183 do {
1187 fattr->valid = 0; 1184 nfs_fattr_init(fattr);
1188 status = nfs4_handle_exception(server, 1185 status = nfs4_handle_exception(server,
1189 rpc_call_sync(server->client, &msg, 0), 1186 rpc_call_sync(server->client, &msg, 0),
1190 &exception); 1187 &exception);
@@ -1221,7 +1218,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
1221 .rpc_resp = &res, 1218 .rpc_resp = &res,
1222 }; 1219 };
1223 1220
1224 fattr->valid = 0; 1221 nfs_fattr_init(fattr);
1225 return rpc_call_sync(server->client, &msg, 0); 1222 return rpc_call_sync(server->client, &msg, 0);
1226} 1223}
1227 1224
@@ -1263,7 +1260,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
1263 struct nfs4_state *state; 1260 struct nfs4_state *state;
1264 int status; 1261 int status;
1265 1262
1266 fattr->valid = 0; 1263 nfs_fattr_init(fattr);
1267 1264
1268 cred = rpcauth_lookupcred(NFS_SERVER(inode)->client->cl_auth, 0); 1265 cred = rpcauth_lookupcred(NFS_SERVER(inode)->client->cl_auth, 0);
1269 if (IS_ERR(cred)) 1266 if (IS_ERR(cred))
@@ -1309,7 +1306,7 @@ static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name,
1309 .rpc_resp = &res, 1306 .rpc_resp = &res,
1310 }; 1307 };
1311 1308
1312 fattr->valid = 0; 1309 nfs_fattr_init(fattr);
1313 1310
1314 dprintk("NFS call lookup %s\n", name->name); 1311 dprintk("NFS call lookup %s\n", name->name);
1315 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 1312 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
@@ -1458,7 +1455,7 @@ static int _nfs4_proc_read(struct nfs_read_data *rdata)
1458 dprintk("NFS call read %d @ %Ld\n", rdata->args.count, 1455 dprintk("NFS call read %d @ %Ld\n", rdata->args.count,
1459 (long long) rdata->args.offset); 1456 (long long) rdata->args.offset);
1460 1457
1461 fattr->valid = 0; 1458 nfs_fattr_init(fattr);
1462 status = rpc_call_sync(server->client, &msg, flags); 1459 status = rpc_call_sync(server->client, &msg, flags);
1463 if (!status) 1460 if (!status)
1464 renew_lease(server, timestamp); 1461 renew_lease(server, timestamp);
@@ -1495,7 +1492,7 @@ static int _nfs4_proc_write(struct nfs_write_data *wdata)
1495 dprintk("NFS call write %d @ %Ld\n", wdata->args.count, 1492 dprintk("NFS call write %d @ %Ld\n", wdata->args.count,
1496 (long long) wdata->args.offset); 1493 (long long) wdata->args.offset);
1497 1494
1498 fattr->valid = 0; 1495 nfs_fattr_init(fattr);
1499 status = rpc_call_sync(server->client, &msg, rpcflags); 1496 status = rpc_call_sync(server->client, &msg, rpcflags);
1500 dprintk("NFS reply write: %d\n", status); 1497 dprintk("NFS reply write: %d\n", status);
1501 return status; 1498 return status;
@@ -1529,7 +1526,7 @@ static int _nfs4_proc_commit(struct nfs_write_data *cdata)
1529 dprintk("NFS call commit %d @ %Ld\n", cdata->args.count, 1526 dprintk("NFS call commit %d @ %Ld\n", cdata->args.count,
1530 (long long) cdata->args.offset); 1527 (long long) cdata->args.offset);
1531 1528
1532 fattr->valid = 0; 1529 nfs_fattr_init(fattr);
1533 status = rpc_call_sync(server->client, &msg, 0); 1530 status = rpc_call_sync(server->client, &msg, 0);
1534 dprintk("NFS reply commit: %d\n", status); 1531 dprintk("NFS reply commit: %d\n", status);
1535 return status; 1532 return status;
@@ -1769,7 +1766,7 @@ static int _nfs4_proc_symlink(struct inode *dir, struct qstr *name,
1769 if (path->len > NFS4_MAXPATHLEN) 1766 if (path->len > NFS4_MAXPATHLEN)
1770 return -ENAMETOOLONG; 1767 return -ENAMETOOLONG;
1771 arg.u.symlink = path; 1768 arg.u.symlink = path;
1772 fattr->valid = 0; 1769 nfs_fattr_init(fattr);
1773 1770
1774 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 1771 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
1775 if (!status) 1772 if (!status)
@@ -1818,7 +1815,7 @@ static int _nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry,
1818 }; 1815 };
1819 int status; 1816 int status;
1820 1817
1821 fattr.valid = 0; 1818 nfs_fattr_init(&fattr);
1822 1819
1823 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 1820 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
1824 if (!status) { 1821 if (!status) {
@@ -1916,7 +1913,7 @@ static int _nfs4_proc_mknod(struct inode *dir, struct dentry *dentry,
1916 int status; 1913 int status;
1917 int mode = sattr->ia_mode; 1914 int mode = sattr->ia_mode;
1918 1915
1919 fattr.valid = 0; 1916 nfs_fattr_init(&fattr);
1920 1917
1921 BUG_ON(!(sattr->ia_valid & ATTR_MODE)); 1918 BUG_ON(!(sattr->ia_valid & ATTR_MODE));
1922 BUG_ON(!S_ISFIFO(mode) && !S_ISBLK(mode) && !S_ISCHR(mode) && !S_ISSOCK(mode)); 1919 BUG_ON(!S_ISFIFO(mode) && !S_ISBLK(mode) && !S_ISCHR(mode) && !S_ISSOCK(mode));
@@ -1969,7 +1966,7 @@ static int _nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
1969 .rpc_resp = fsstat, 1966 .rpc_resp = fsstat,
1970 }; 1967 };
1971 1968
1972 fsstat->fattr->valid = 0; 1969 nfs_fattr_init(fsstat->fattr);
1973 return rpc_call_sync(server->client, &msg, 0); 1970 return rpc_call_sync(server->client, &msg, 0);
1974} 1971}
1975 1972
@@ -2016,7 +2013,7 @@ static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, str
2016 2013
2017static int nfs4_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) 2014static int nfs4_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo)
2018{ 2015{
2019 fsinfo->fattr->valid = 0; 2016 nfs_fattr_init(fsinfo->fattr);
2020 return nfs4_do_fsinfo(server, fhandle, fsinfo); 2017 return nfs4_do_fsinfo(server, fhandle, fsinfo);
2021} 2018}
2022 2019
@@ -2039,7 +2036,7 @@ static int _nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle
2039 return 0; 2036 return 0;
2040 } 2037 }
2041 2038
2042 pathconf->fattr->valid = 0; 2039 nfs_fattr_init(pathconf->fattr);
2043 return rpc_call_sync(server->client, &msg, 0); 2040 return rpc_call_sync(server->client, &msg, 0);
2044} 2041}
2045 2042
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index 8fef86523d7f..5ef28f08f424 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -61,7 +61,7 @@ nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
61 int status; 61 int status;
62 62
63 dprintk("%s: call getattr\n", __FUNCTION__); 63 dprintk("%s: call getattr\n", __FUNCTION__);
64 fattr->valid = 0; 64 nfs_fattr_init(fattr);
65 status = rpc_call(server->client_sys, NFSPROC_GETATTR, fhandle, fattr, 0); 65 status = rpc_call(server->client_sys, NFSPROC_GETATTR, fhandle, fattr, 0);
66 dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); 66 dprintk("%s: reply getattr: %d\n", __FUNCTION__, status);
67 if (status) 67 if (status)
@@ -93,7 +93,7 @@ nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
93 int status; 93 int status;
94 94
95 dprintk("NFS call getattr\n"); 95 dprintk("NFS call getattr\n");
96 fattr->valid = 0; 96 nfs_fattr_init(fattr);
97 status = rpc_call(server->client, NFSPROC_GETATTR, 97 status = rpc_call(server->client, NFSPROC_GETATTR,
98 fhandle, fattr, 0); 98 fhandle, fattr, 0);
99 dprintk("NFS reply getattr: %d\n", status); 99 dprintk("NFS reply getattr: %d\n", status);
@@ -112,7 +112,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
112 int status; 112 int status;
113 113
114 dprintk("NFS call setattr\n"); 114 dprintk("NFS call setattr\n");
115 fattr->valid = 0; 115 nfs_fattr_init(fattr);
116 status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0); 116 status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0);
117 if (status == 0) 117 if (status == 0)
118 nfs_setattr_update_inode(inode, sattr); 118 nfs_setattr_update_inode(inode, sattr);
@@ -136,7 +136,7 @@ nfs_proc_lookup(struct inode *dir, struct qstr *name,
136 int status; 136 int status;
137 137
138 dprintk("NFS call lookup %s\n", name->name); 138 dprintk("NFS call lookup %s\n", name->name);
139 fattr->valid = 0; 139 nfs_fattr_init(fattr);
140 status = rpc_call(NFS_CLIENT(dir), NFSPROC_LOOKUP, &arg, &res, 0); 140 status = rpc_call(NFS_CLIENT(dir), NFSPROC_LOOKUP, &arg, &res, 0);
141 dprintk("NFS reply lookup: %d\n", status); 141 dprintk("NFS reply lookup: %d\n", status);
142 return status; 142 return status;
@@ -174,7 +174,7 @@ static int nfs_proc_read(struct nfs_read_data *rdata)
174 174
175 dprintk("NFS call read %d @ %Ld\n", rdata->args.count, 175 dprintk("NFS call read %d @ %Ld\n", rdata->args.count,
176 (long long) rdata->args.offset); 176 (long long) rdata->args.offset);
177 fattr->valid = 0; 177 nfs_fattr_init(fattr);
178 status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags); 178 status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
179 if (status >= 0) { 179 if (status >= 0) {
180 nfs_refresh_inode(inode, fattr); 180 nfs_refresh_inode(inode, fattr);
@@ -203,7 +203,7 @@ static int nfs_proc_write(struct nfs_write_data *wdata)
203 203
204 dprintk("NFS call write %d @ %Ld\n", wdata->args.count, 204 dprintk("NFS call write %d @ %Ld\n", wdata->args.count,
205 (long long) wdata->args.offset); 205 (long long) wdata->args.offset);
206 fattr->valid = 0; 206 nfs_fattr_init(fattr);
207 status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags); 207 status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
208 if (status >= 0) { 208 if (status >= 0) {
209 nfs_refresh_inode(inode, fattr); 209 nfs_refresh_inode(inode, fattr);
@@ -232,7 +232,7 @@ nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
232 }; 232 };
233 int status; 233 int status;
234 234
235 fattr.valid = 0; 235 nfs_fattr_init(&fattr);
236 dprintk("NFS call create %s\n", dentry->d_name.name); 236 dprintk("NFS call create %s\n", dentry->d_name.name);
237 status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); 237 status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0);
238 if (status == 0) 238 if (status == 0)
@@ -273,12 +273,12 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
273 sattr->ia_size = new_encode_dev(rdev);/* get out your barf bag */ 273 sattr->ia_size = new_encode_dev(rdev);/* get out your barf bag */
274 } 274 }
275 275
276 fattr.valid = 0; 276 nfs_fattr_init(&fattr);
277 status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); 277 status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0);
278 278
279 if (status == -EINVAL && S_ISFIFO(mode)) { 279 if (status == -EINVAL && S_ISFIFO(mode)) {
280 sattr->ia_mode = mode; 280 sattr->ia_mode = mode;
281 fattr.valid = 0; 281 nfs_fattr_init(&fattr);
282 status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); 282 status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0);
283 } 283 }
284 if (status == 0) 284 if (status == 0)
@@ -391,7 +391,7 @@ nfs_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path,
391 if (path->len > NFS2_MAXPATHLEN) 391 if (path->len > NFS2_MAXPATHLEN)
392 return -ENAMETOOLONG; 392 return -ENAMETOOLONG;
393 dprintk("NFS call symlink %s -> %s\n", name->name, path->name); 393 dprintk("NFS call symlink %s -> %s\n", name->name, path->name);
394 fattr->valid = 0; 394 nfs_fattr_init(fattr);
395 fhandle->size = 0; 395 fhandle->size = 0;
396 status = rpc_call(NFS_CLIENT(dir), NFSPROC_SYMLINK, &arg, NULL, 0); 396 status = rpc_call(NFS_CLIENT(dir), NFSPROC_SYMLINK, &arg, NULL, 0);
397 dprintk("NFS reply symlink: %d\n", status); 397 dprintk("NFS reply symlink: %d\n", status);
@@ -416,7 +416,7 @@ nfs_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr)
416 int status; 416 int status;
417 417
418 dprintk("NFS call mkdir %s\n", dentry->d_name.name); 418 dprintk("NFS call mkdir %s\n", dentry->d_name.name);
419 fattr.valid = 0; 419 nfs_fattr_init(&fattr);
420 status = rpc_call(NFS_CLIENT(dir), NFSPROC_MKDIR, &arg, &res, 0); 420 status = rpc_call(NFS_CLIENT(dir), NFSPROC_MKDIR, &arg, &res, 0);
421 if (status == 0) 421 if (status == 0)
422 status = nfs_instantiate(dentry, &fhandle, &fattr); 422 status = nfs_instantiate(dentry, &fhandle, &fattr);
@@ -484,7 +484,7 @@ nfs_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
484 int status; 484 int status;
485 485
486 dprintk("NFS call statfs\n"); 486 dprintk("NFS call statfs\n");
487 stat->fattr->valid = 0; 487 nfs_fattr_init(stat->fattr);
488 status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0); 488 status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0);
489 dprintk("NFS reply statfs: %d\n", status); 489 dprintk("NFS reply statfs: %d\n", status);
490 if (status) 490 if (status)
@@ -507,7 +507,7 @@ nfs_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
507 int status; 507 int status;
508 508
509 dprintk("NFS call fsinfo\n"); 509 dprintk("NFS call fsinfo\n");
510 info->fattr->valid = 0; 510 nfs_fattr_init(info->fattr);
511 status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0); 511 status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0);
512 dprintk("NFS reply fsinfo: %d\n", status); 512 dprintk("NFS reply fsinfo: %d\n", status);
513 if (status) 513 if (status)
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 9758ebd49905..43b03b19731b 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -215,6 +215,7 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
215 data->res.fattr = &data->fattr; 215 data->res.fattr = &data->fattr;
216 data->res.count = count; 216 data->res.count = count;
217 data->res.eof = 0; 217 data->res.eof = 0;
218 nfs_fattr_init(&data->fattr);
218 219
219 NFS_PROTO(inode)->read_setup(data); 220 NFS_PROTO(inode)->read_setup(data);
220 221
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 5130eda231d7..819a65f5071f 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -870,6 +870,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
870 data->res.fattr = &data->fattr; 870 data->res.fattr = &data->fattr;
871 data->res.count = count; 871 data->res.count = count;
872 data->res.verf = &data->verf; 872 data->res.verf = &data->verf;
873 nfs_fattr_init(&data->fattr);
873 874
874 NFS_PROTO(inode)->write_setup(data, how); 875 NFS_PROTO(inode)->write_setup(data, how);
875 876
@@ -1237,6 +1238,7 @@ static void nfs_commit_rpcsetup(struct list_head *head,
1237 data->res.count = 0; 1238 data->res.count = 0;
1238 data->res.fattr = &data->fattr; 1239 data->res.fattr = &data->fattr;
1239 data->res.verf = &data->verf; 1240 data->res.verf = &data->verf;
1241 nfs_fattr_init(&data->fattr);
1240 1242
1241 NFS_PROTO(inode)->commit_setup(data, how); 1243 NFS_PROTO(inode)->commit_setup(data, how);
1242 1244