Commit 0e574af1 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Cleanup initialisation of struct nfs_fattr

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 4c2cb58c
...@@ -532,6 +532,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) ...@@ -532,6 +532,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
my_entry.eof = 0; my_entry.eof = 0;
my_entry.fh = &fh; my_entry.fh = &fh;
my_entry.fattr = &fattr; my_entry.fattr = &fattr;
nfs_fattr_init(&fattr);
desc->entry = &my_entry; desc->entry = &my_entry;
while(!desc->entry->eof) { while(!desc->entry->eof) {
......
...@@ -78,7 +78,7 @@ nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -78,7 +78,7 @@ nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
int status; int status;
dprintk("%s: call fsinfo\n", __FUNCTION__); dprintk("%s: call fsinfo\n", __FUNCTION__);
info->fattr->valid = 0; nfs_fattr_init(info->fattr);
status = rpc_call(server->client_sys, NFS3PROC_FSINFO, fhandle, info, 0); status = rpc_call(server->client_sys, NFS3PROC_FSINFO, fhandle, info, 0);
dprintk("%s: reply fsinfo: %d\n", __FUNCTION__, status); dprintk("%s: reply fsinfo: %d\n", __FUNCTION__, status);
if (!(info->fattr->valid & NFS_ATTR_FATTR)) { if (!(info->fattr->valid & NFS_ATTR_FATTR)) {
...@@ -98,7 +98,7 @@ nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -98,7 +98,7 @@ nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
int status; int status;
dprintk("NFS call getattr\n"); dprintk("NFS call getattr\n");
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call(server->client, NFS3PROC_GETATTR, status = rpc_call(server->client, NFS3PROC_GETATTR,
fhandle, fattr, 0); fhandle, fattr, 0);
dprintk("NFS reply getattr: %d\n", status); dprintk("NFS reply getattr: %d\n", status);
...@@ -117,7 +117,7 @@ nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, ...@@ -117,7 +117,7 @@ nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
int status; int status;
dprintk("NFS call setattr\n"); dprintk("NFS call setattr\n");
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call(NFS_CLIENT(inode), NFS3PROC_SETATTR, &arg, fattr, 0); status = rpc_call(NFS_CLIENT(inode), NFS3PROC_SETATTR, &arg, fattr, 0);
if (status == 0) if (status == 0)
nfs_setattr_update_inode(inode, sattr); nfs_setattr_update_inode(inode, sattr);
...@@ -143,8 +143,8 @@ nfs3_proc_lookup(struct inode *dir, struct qstr *name, ...@@ -143,8 +143,8 @@ nfs3_proc_lookup(struct inode *dir, struct qstr *name,
int status; int status;
dprintk("NFS call lookup %s\n", name->name); dprintk("NFS call lookup %s\n", name->name);
dir_attr.valid = 0; nfs_fattr_init(&dir_attr);
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call(NFS_CLIENT(dir), NFS3PROC_LOOKUP, &arg, &res, 0); status = rpc_call(NFS_CLIENT(dir), NFS3PROC_LOOKUP, &arg, &res, 0);
if (status >= 0 && !(fattr->valid & NFS_ATTR_FATTR)) if (status >= 0 && !(fattr->valid & NFS_ATTR_FATTR))
status = rpc_call(NFS_CLIENT(dir), NFS3PROC_GETATTR, 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,7 +174,6 @@ static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry)
int status; int status;
dprintk("NFS call access\n"); dprintk("NFS call access\n");
fattr.valid = 0;
if (mode & MAY_READ) if (mode & MAY_READ)
arg.access |= NFS3_ACCESS_READ; arg.access |= NFS3_ACCESS_READ;
...@@ -189,6 +188,7 @@ static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry) ...@@ -189,6 +188,7 @@ static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry)
if (mode & MAY_EXEC) if (mode & MAY_EXEC)
arg.access |= NFS3_ACCESS_EXECUTE; arg.access |= NFS3_ACCESS_EXECUTE;
} }
nfs_fattr_init(&fattr);
status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
nfs_refresh_inode(inode, &fattr); nfs_refresh_inode(inode, &fattr);
if (status == 0) { if (status == 0) {
...@@ -217,7 +217,7 @@ static int nfs3_proc_readlink(struct inode *inode, struct page *page, ...@@ -217,7 +217,7 @@ static int nfs3_proc_readlink(struct inode *inode, struct page *page,
int status; int status;
dprintk("NFS call readlink\n"); dprintk("NFS call readlink\n");
fattr.valid = 0; nfs_fattr_init(&fattr);
status = rpc_call(NFS_CLIENT(inode), NFS3PROC_READLINK, status = rpc_call(NFS_CLIENT(inode), NFS3PROC_READLINK,
&args, &fattr, 0); &args, &fattr, 0);
nfs_refresh_inode(inode, &fattr); nfs_refresh_inode(inode, &fattr);
...@@ -240,7 +240,7 @@ static int nfs3_proc_read(struct nfs_read_data *rdata) ...@@ -240,7 +240,7 @@ static int nfs3_proc_read(struct nfs_read_data *rdata)
dprintk("NFS call read %d @ %Ld\n", rdata->args.count, dprintk("NFS call read %d @ %Ld\n", rdata->args.count,
(long long) rdata->args.offset); (long long) rdata->args.offset);
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags); status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
if (status >= 0) if (status >= 0)
nfs_refresh_inode(inode, fattr); nfs_refresh_inode(inode, fattr);
...@@ -263,7 +263,7 @@ static int nfs3_proc_write(struct nfs_write_data *wdata) ...@@ -263,7 +263,7 @@ static int nfs3_proc_write(struct nfs_write_data *wdata)
dprintk("NFS call write %d @ %Ld\n", wdata->args.count, dprintk("NFS call write %d @ %Ld\n", wdata->args.count,
(long long) wdata->args.offset); (long long) wdata->args.offset);
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call_sync(NFS_CLIENT(inode), &msg, rpcflags); status = rpc_call_sync(NFS_CLIENT(inode), &msg, rpcflags);
if (status >= 0) if (status >= 0)
nfs_refresh_inode(inode, fattr); nfs_refresh_inode(inode, fattr);
...@@ -285,7 +285,7 @@ static int nfs3_proc_commit(struct nfs_write_data *cdata) ...@@ -285,7 +285,7 @@ static int nfs3_proc_commit(struct nfs_write_data *cdata)
dprintk("NFS call commit %d @ %Ld\n", cdata->args.count, dprintk("NFS call commit %d @ %Ld\n", cdata->args.count,
(long long) cdata->args.offset); (long long) cdata->args.offset);
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
if (status >= 0) if (status >= 0)
nfs_refresh_inode(inode, fattr); nfs_refresh_inode(inode, fattr);
...@@ -329,8 +329,8 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, ...@@ -329,8 +329,8 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
sattr->ia_mode &= ~current->fs->umask; sattr->ia_mode &= ~current->fs->umask;
again: again:
dir_attr.valid = 0; nfs_fattr_init(&dir_attr);
fattr.valid = 0; nfs_fattr_init(&fattr);
status = rpc_call(NFS_CLIENT(dir), NFS3PROC_CREATE, &arg, &res, 0); status = rpc_call(NFS_CLIENT(dir), NFS3PROC_CREATE, &arg, &res, 0);
nfs_refresh_inode(dir, &dir_attr); nfs_refresh_inode(dir, &dir_attr);
...@@ -401,7 +401,7 @@ nfs3_proc_remove(struct inode *dir, struct qstr *name) ...@@ -401,7 +401,7 @@ nfs3_proc_remove(struct inode *dir, struct qstr *name)
int status; int status;
dprintk("NFS call remove %s\n", name->name); dprintk("NFS call remove %s\n", name->name);
dir_attr.valid = 0; nfs_fattr_init(&dir_attr);
status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
nfs_refresh_inode(dir, &dir_attr); nfs_refresh_inode(dir, &dir_attr);
dprintk("NFS reply remove: %d\n", status); 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,7 +422,7 @@ nfs3_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr
ptr->arg.fh = NFS_FH(dir->d_inode); ptr->arg.fh = NFS_FH(dir->d_inode);
ptr->arg.name = name->name; ptr->arg.name = name->name;
ptr->arg.len = name->len; ptr->arg.len = name->len;
ptr->res.valid = 0; nfs_fattr_init(&ptr->res);
msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE]; msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE];
msg->rpc_argp = &ptr->arg; msg->rpc_argp = &ptr->arg;
msg->rpc_resp = &ptr->res; msg->rpc_resp = &ptr->res;
...@@ -465,8 +465,8 @@ nfs3_proc_rename(struct inode *old_dir, struct qstr *old_name, ...@@ -465,8 +465,8 @@ nfs3_proc_rename(struct inode *old_dir, struct qstr *old_name,
int status; int status;
dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name); dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name);
old_dir_attr.valid = 0; nfs_fattr_init(&old_dir_attr);
new_dir_attr.valid = 0; nfs_fattr_init(&new_dir_attr);
status = rpc_call(NFS_CLIENT(old_dir), NFS3PROC_RENAME, &arg, &res, 0); status = rpc_call(NFS_CLIENT(old_dir), NFS3PROC_RENAME, &arg, &res, 0);
nfs_refresh_inode(old_dir, &old_dir_attr); nfs_refresh_inode(old_dir, &old_dir_attr);
nfs_refresh_inode(new_dir, &new_dir_attr); 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,8 +491,8 @@ nfs3_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
int status; int status;
dprintk("NFS call link %s\n", name->name); dprintk("NFS call link %s\n", name->name);
dir_attr.valid = 0; nfs_fattr_init(&dir_attr);
fattr.valid = 0; nfs_fattr_init(&fattr);
status = rpc_call(NFS_CLIENT(inode), NFS3PROC_LINK, &arg, &res, 0); status = rpc_call(NFS_CLIENT(inode), NFS3PROC_LINK, &arg, &res, 0);
nfs_refresh_inode(dir, &dir_attr); nfs_refresh_inode(dir, &dir_attr);
nfs_refresh_inode(inode, &fattr); nfs_refresh_inode(inode, &fattr);
...@@ -524,8 +524,8 @@ nfs3_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path, ...@@ -524,8 +524,8 @@ nfs3_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path,
if (path->len > NFS3_MAXPATHLEN) if (path->len > NFS3_MAXPATHLEN)
return -ENAMETOOLONG; return -ENAMETOOLONG;
dprintk("NFS call symlink %s -> %s\n", name->name, path->name); dprintk("NFS call symlink %s -> %s\n", name->name, path->name);
dir_attr.valid = 0; nfs_fattr_init(&dir_attr);
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call(NFS_CLIENT(dir), NFS3PROC_SYMLINK, &arg, &res, 0); status = rpc_call(NFS_CLIENT(dir), NFS3PROC_SYMLINK, &arg, &res, 0);
nfs_refresh_inode(dir, &dir_attr); nfs_refresh_inode(dir, &dir_attr);
dprintk("NFS reply symlink: %d\n", status); dprintk("NFS reply symlink: %d\n", status);
...@@ -552,11 +552,11 @@ nfs3_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr) ...@@ -552,11 +552,11 @@ nfs3_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr)
int status; int status;
dprintk("NFS call mkdir %s\n", dentry->d_name.name); dprintk("NFS call mkdir %s\n", dentry->d_name.name);
dir_attr.valid = 0;
fattr.valid = 0;
sattr->ia_mode &= ~current->fs->umask; sattr->ia_mode &= ~current->fs->umask;
nfs_fattr_init(&dir_attr);
nfs_fattr_init(&fattr);
status = rpc_call(NFS_CLIENT(dir), NFS3PROC_MKDIR, &arg, &res, 0); status = rpc_call(NFS_CLIENT(dir), NFS3PROC_MKDIR, &arg, &res, 0);
nfs_refresh_inode(dir, &dir_attr); nfs_refresh_inode(dir, &dir_attr);
if (status != 0) if (status != 0)
...@@ -582,7 +582,7 @@ nfs3_proc_rmdir(struct inode *dir, struct qstr *name) ...@@ -582,7 +582,7 @@ nfs3_proc_rmdir(struct inode *dir, struct qstr *name)
int status; int status;
dprintk("NFS call rmdir %s\n", name->name); dprintk("NFS call rmdir %s\n", name->name);
dir_attr.valid = 0; nfs_fattr_init(&dir_attr);
status = rpc_call(NFS_CLIENT(dir), NFS3PROC_RMDIR, &arg, &dir_attr, 0); status = rpc_call(NFS_CLIENT(dir), NFS3PROC_RMDIR, &arg, &dir_attr, 0);
nfs_refresh_inode(dir, &dir_attr); nfs_refresh_inode(dir, &dir_attr);
dprintk("NFS reply rmdir: %d\n", status); dprintk("NFS reply rmdir: %d\n", status);
...@@ -634,7 +634,7 @@ nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, ...@@ -634,7 +634,7 @@ nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
dprintk("NFS call readdir%s %d\n", dprintk("NFS call readdir%s %d\n",
plus? "plus" : "", (unsigned int) cookie); plus? "plus" : "", (unsigned int) cookie);
dir_attr.valid = 0; nfs_fattr_init(&dir_attr);
status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
nfs_refresh_inode(dir, &dir_attr); nfs_refresh_inode(dir, &dir_attr);
dprintk("NFS reply readdir: %d\n", status); dprintk("NFS reply readdir: %d\n", status);
...@@ -676,8 +676,8 @@ nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, ...@@ -676,8 +676,8 @@ nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
sattr->ia_mode &= ~current->fs->umask; sattr->ia_mode &= ~current->fs->umask;
dir_attr.valid = 0; nfs_fattr_init(&dir_attr);
fattr.valid = 0; nfs_fattr_init(&fattr);
status = rpc_call(NFS_CLIENT(dir), NFS3PROC_MKNOD, &arg, &res, 0); status = rpc_call(NFS_CLIENT(dir), NFS3PROC_MKNOD, &arg, &res, 0);
nfs_refresh_inode(dir, &dir_attr); nfs_refresh_inode(dir, &dir_attr);
if (status != 0) if (status != 0)
...@@ -698,7 +698,7 @@ nfs3_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -698,7 +698,7 @@ nfs3_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
int status; int status;
dprintk("NFS call fsstat\n"); dprintk("NFS call fsstat\n");
stat->fattr->valid = 0; nfs_fattr_init(stat->fattr);
status = rpc_call(server->client, NFS3PROC_FSSTAT, fhandle, stat, 0); status = rpc_call(server->client, NFS3PROC_FSSTAT, fhandle, stat, 0);
dprintk("NFS reply statfs: %d\n", status); dprintk("NFS reply statfs: %d\n", status);
return status; return status;
...@@ -711,7 +711,7 @@ nfs3_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -711,7 +711,7 @@ nfs3_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
int status; int status;
dprintk("NFS call fsinfo\n"); dprintk("NFS call fsinfo\n");
info->fattr->valid = 0; nfs_fattr_init(info->fattr);
status = rpc_call(server->client_sys, NFS3PROC_FSINFO, fhandle, info, 0); status = rpc_call(server->client_sys, NFS3PROC_FSINFO, fhandle, info, 0);
dprintk("NFS reply fsinfo: %d\n", status); dprintk("NFS reply fsinfo: %d\n", status);
return status; return status;
...@@ -724,7 +724,7 @@ nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -724,7 +724,7 @@ nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
int status; int status;
dprintk("NFS call pathconf\n"); dprintk("NFS call pathconf\n");
info->fattr->valid = 0; nfs_fattr_init(info->fattr);
status = rpc_call(server->client, NFS3PROC_PATHCONF, fhandle, info, 0); status = rpc_call(server->client, NFS3PROC_PATHCONF, fhandle, info, 0);
dprintk("NFS reply pathconf: %d\n", status); dprintk("NFS reply pathconf: %d\n", status);
return status; return status;
......
...@@ -494,9 +494,7 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st ...@@ -494,9 +494,7 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st
struct inode *inode = state->inode; struct inode *inode = state->inode;
struct nfs_server *server = NFS_SERVER(dir); struct nfs_server *server = NFS_SERVER(dir);
struct nfs_delegation *delegation = NFS_I(inode)->delegation; struct nfs_delegation *delegation = NFS_I(inode)->delegation;
struct nfs_fattr f_attr = { struct nfs_fattr f_attr;
.valid = 0,
};
struct nfs_openargs o_arg = { struct nfs_openargs o_arg = {
.fh = NFS_FH(dir), .fh = NFS_FH(dir),
.open_flags = state->state, .open_flags = state->state,
...@@ -522,6 +520,7 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st ...@@ -522,6 +520,7 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st
status = -ENOMEM; status = -ENOMEM;
if (o_arg.seqid == NULL) if (o_arg.seqid == NULL)
goto out; goto out;
nfs_fattr_init(&f_attr);
status = _nfs4_proc_open(dir, sp, &o_arg, &o_res); status = _nfs4_proc_open(dir, sp, &o_arg, &o_res);
if (status != 0) if (status != 0)
goto out_nodeleg; goto out_nodeleg;
...@@ -692,9 +691,7 @@ static int _nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, st ...@@ -692,9 +691,7 @@ static int _nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, st
struct nfs4_client *clp = server->nfs4_state; struct nfs4_client *clp = server->nfs4_state;
struct inode *inode = NULL; struct inode *inode = NULL;
int status; int status;
struct nfs_fattr f_attr = { struct nfs_fattr f_attr;
.valid = 0,
};
struct nfs_openargs o_arg = { struct nfs_openargs o_arg = {
.fh = NFS_FH(dir), .fh = NFS_FH(dir),
.open_flags = flags, .open_flags = flags,
...@@ -726,6 +723,7 @@ static int _nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, st ...@@ -726,6 +723,7 @@ static int _nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, st
o_arg.seqid = nfs_alloc_seqid(&sp->so_seqid); o_arg.seqid = nfs_alloc_seqid(&sp->so_seqid);
if (o_arg.seqid == NULL) if (o_arg.seqid == NULL)
return -ENOMEM; return -ENOMEM;
nfs_fattr_init(&f_attr);
status = _nfs4_proc_open(dir, sp, &o_arg, &o_res); status = _nfs4_proc_open(dir, sp, &o_arg, &o_res);
if (status != 0) if (status != 0)
goto out_err; goto out_err;
...@@ -824,7 +822,7 @@ static int _nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr, ...@@ -824,7 +822,7 @@ static int _nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr,
}; };
int status; int status;
fattr->valid = 0; nfs_fattr_init(fattr);
if (state != NULL) { if (state != NULL) {
msg.rpc_cred = state->owner->so_cred; msg.rpc_cred = state->owner->so_cred;
...@@ -1107,13 +1105,12 @@ static int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fh ...@@ -1107,13 +1105,12 @@ static int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fh
static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
struct nfs_fsinfo *info) struct nfs_fsinfo *info)
{ {
struct nfs_fattr * fattr = info->fattr;
struct nfs4_lookup_root_arg args = { struct nfs4_lookup_root_arg args = {
.bitmask = nfs4_fattr_bitmap, .bitmask = nfs4_fattr_bitmap,
}; };
struct nfs4_lookup_res res = { struct nfs4_lookup_res res = {
.server = server, .server = server,
.fattr = fattr, .fattr = info->fattr,
.fh = fhandle, .fh = fhandle,
}; };
struct rpc_message msg = { struct rpc_message msg = {
...@@ -1121,7 +1118,7 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -1121,7 +1118,7 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
.rpc_argp = &args, .rpc_argp = &args,
.rpc_resp = &res, .rpc_resp = &res,
}; };
fattr->valid = 0; nfs_fattr_init(info->fattr);
return rpc_call_sync(server->client, &msg, 0); return rpc_call_sync(server->client, &msg, 0);
} }
...@@ -1184,7 +1181,7 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -1184,7 +1181,7 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
q.len = p - q.name; q.len = p - q.name;
do { do {
fattr->valid = 0; nfs_fattr_init(fattr);
status = nfs4_handle_exception(server, status = nfs4_handle_exception(server,
rpc_call_sync(server->client, &msg, 0), rpc_call_sync(server->client, &msg, 0),
&exception); &exception);
...@@ -1221,7 +1218,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -1221,7 +1218,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
.rpc_resp = &res, .rpc_resp = &res,
}; };
fattr->valid = 0; nfs_fattr_init(fattr);
return rpc_call_sync(server->client, &msg, 0); return rpc_call_sync(server->client, &msg, 0);
} }
...@@ -1263,7 +1260,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, ...@@ -1263,7 +1260,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
struct nfs4_state *state; struct nfs4_state *state;
int status; int status;
fattr->valid = 0; nfs_fattr_init(fattr);
cred = rpcauth_lookupcred(NFS_SERVER(inode)->client->cl_auth, 0); cred = rpcauth_lookupcred(NFS_SERVER(inode)->client->cl_auth, 0);
if (IS_ERR(cred)) if (IS_ERR(cred))
...@@ -1309,7 +1306,7 @@ static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name, ...@@ -1309,7 +1306,7 @@ static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name,
.rpc_resp = &res, .rpc_resp = &res,
}; };
fattr->valid = 0; nfs_fattr_init(fattr);
dprintk("NFS call lookup %s\n", name->name); dprintk("NFS call lookup %s\n", name->name);
status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
...@@ -1458,7 +1455,7 @@ static int _nfs4_proc_read(struct nfs_read_data *rdata) ...@@ -1458,7 +1455,7 @@ static int _nfs4_proc_read(struct nfs_read_data *rdata)
dprintk("NFS call read %d @ %Ld\n", rdata->args.count, dprintk("NFS call read %d @ %Ld\n", rdata->args.count,
(long long) rdata->args.offset); (long long) rdata->args.offset);
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call_sync(server->client, &msg, flags); status = rpc_call_sync(server->client, &msg, flags);
if (!status) if (!status)
renew_lease(server, timestamp); renew_lease(server, timestamp);
...@@ -1495,7 +1492,7 @@ static int _nfs4_proc_write(struct nfs_write_data *wdata) ...@@ -1495,7 +1492,7 @@ static int _nfs4_proc_write(struct nfs_write_data *wdata)
dprintk("NFS call write %d @ %Ld\n", wdata->args.count, dprintk("NFS call write %d @ %Ld\n", wdata->args.count,
(long long) wdata->args.offset); (long long) wdata->args.offset);
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call_sync(server->client, &msg, rpcflags); status = rpc_call_sync(server->client, &msg, rpcflags);
dprintk("NFS reply write: %d\n", status); dprintk("NFS reply write: %d\n", status);
return status; return status;
...@@ -1529,7 +1526,7 @@ static int _nfs4_proc_commit(struct nfs_write_data *cdata) ...@@ -1529,7 +1526,7 @@ static int _nfs4_proc_commit(struct nfs_write_data *cdata)
dprintk("NFS call commit %d @ %Ld\n", cdata->args.count, dprintk("NFS call commit %d @ %Ld\n", cdata->args.count,
(long long) cdata->args.offset); (long long) cdata->args.offset);
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call_sync(server->client, &msg, 0); status = rpc_call_sync(server->client, &msg, 0);
dprintk("NFS reply commit: %d\n", status); dprintk("NFS reply commit: %d\n", status);
return status; return status;
...@@ -1769,7 +1766,7 @@ static int _nfs4_proc_symlink(struct inode *dir, struct qstr *name, ...@@ -1769,7 +1766,7 @@ static int _nfs4_proc_symlink(struct inode *dir, struct qstr *name,
if (path->len > NFS4_MAXPATHLEN) if (path->len > NFS4_MAXPATHLEN)
return -ENAMETOOLONG; return -ENAMETOOLONG;
arg.u.symlink = path; arg.u.symlink = path;
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
if (!status) if (!status)
...@@ -1818,7 +1815,7 @@ static int _nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, ...@@ -1818,7 +1815,7 @@ static int _nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry,
}; };
int status; int status;
fattr.valid = 0; nfs_fattr_init(&fattr);
status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
if (!status) { if (!status) {
...@@ -1916,7 +1913,7 @@ static int _nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, ...@@ -1916,7 +1913,7 @@ static int _nfs4_proc_mknod(struct inode *dir, struct dentry *dentry,
int status; int status;
int mode = sattr->ia_mode; int mode = sattr->ia_mode;
fattr.valid = 0; nfs_fattr_init(&fattr);
BUG_ON(!(sattr->ia_valid & ATTR_MODE)); BUG_ON(!(sattr->ia_valid & ATTR_MODE));
BUG_ON(!S_ISFIFO(mode) && !S_ISBLK(mode) && !S_ISCHR(mode) && !S_ISSOCK(mode)); 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,7 +1966,7 @@ static int _nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
.rpc_resp = fsstat, .rpc_resp = fsstat,
}; };
fsstat->fattr->valid = 0; nfs_fattr_init(fsstat->fattr);
return rpc_call_sync(server->client, &msg, 0); return rpc_call_sync(server->client, &msg, 0);
} }
...@@ -2016,7 +2013,7 @@ static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, str ...@@ -2016,7 +2013,7 @@ static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, str
static int nfs4_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) static int nfs4_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo)
{ {
fsinfo->fattr->valid = 0; nfs_fattr_init(fsinfo->fattr);
return nfs4_do_fsinfo(server, fhandle, fsinfo); return nfs4_do_fsinfo(server, fhandle, fsinfo);
} }
...@@ -2039,7 +2036,7 @@ static int _nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle ...@@ -2039,7 +2036,7 @@ static int _nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle
return 0; return 0;
} }
pathconf->fattr->valid = 0; nfs_fattr_init(pathconf->fattr);
return rpc_call_sync(server->client, &msg, 0); return rpc_call_sync(server->client, &msg, 0);
} }
......
...@@ -61,7 +61,7 @@ nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -61,7 +61,7 @@ nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
int status; int status;
dprintk("%s: call getattr\n", __FUNCTION__); dprintk("%s: call getattr\n", __FUNCTION__);
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call(server->client_sys, NFSPROC_GETATTR, fhandle, fattr, 0); status = rpc_call(server->client_sys, NFSPROC_GETATTR, fhandle, fattr, 0);
dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); dprintk("%s: reply getattr: %d\n", __FUNCTION__, status);
if (status) if (status)
...@@ -93,7 +93,7 @@ nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -93,7 +93,7 @@ nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
int status; int status;
dprintk("NFS call getattr\n"); dprintk("NFS call getattr\n");
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call(server->client, NFSPROC_GETATTR, status = rpc_call(server->client, NFSPROC_GETATTR,
fhandle, fattr, 0); fhandle, fattr, 0);
dprintk("NFS reply getattr: %d\n", status); dprintk("NFS reply getattr: %d\n", status);
...@@ -112,7 +112,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, ...@@ -112,7 +112,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
int status; int status;
dprintk("NFS call setattr\n"); dprintk("NFS call setattr\n");
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0); status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0);
if (status == 0) if (status == 0)
nfs_setattr_update_inode(inode, sattr); nfs_setattr_update_inode(inode, sattr);
...@@ -136,7 +136,7 @@ nfs_proc_lookup(struct inode *dir, struct qstr *name, ...@@ -136,7 +136,7 @@ nfs_proc_lookup(struct inode *dir, struct qstr *name,
int status; int status;
dprintk("NFS call lookup %s\n", name->name); dprintk("NFS call lookup %s\n", name->name);
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call(NFS_CLIENT(dir), NFSPROC_LOOKUP, &arg, &res, 0); status = rpc_call(NFS_CLIENT(dir), NFSPROC_LOOKUP, &arg, &res, 0);
dprintk("NFS reply lookup: %d\n", status); dprintk("NFS reply lookup: %d\n", status);
return status; return status;
...@@ -174,7 +174,7 @@ static int nfs_proc_read(struct nfs_read_data *rdata) ...@@ -174,7 +174,7 @@ static int nfs_proc_read(struct nfs_read_data *rdata)
dprintk("NFS call read %d @ %Ld\n", rdata->args.count, dprintk("NFS call read %d @ %Ld\n", rdata->args.count,
(long long) rdata->args.offset); (long long) rdata->args.offset);
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags); status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
if (status >= 0) { if (status >= 0) {
nfs_refresh_inode(inode, fattr); nfs_refresh_inode(inode, fattr);
...@@ -203,7 +203,7 @@ static int nfs_proc_write(struct nfs_write_data *wdata) ...@@ -203,7 +203,7 @@ static int nfs_proc_write(struct nfs_write_data *wdata)
dprintk("NFS call write %d @ %Ld\n", wdata->args.count, dprintk("NFS call write %d @ %Ld\n", wdata->args.count,
(long long) wdata->args.offset); (long long) wdata->args.offset);
fattr->valid = 0; nfs_fattr_init(fattr);
status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags); status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
if (status >= 0) { if (status >= 0) {
nfs_refresh_inode(inode, fattr); nfs_refresh_inode(inode, fattr);
...@@ -232,7 +232,7 @@ nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, ...@@ -232,7 +232,7 @@ nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
}; };
int status; int status;
fattr.valid = 0; nfs_fattr_init(&fattr);
dprintk("NFS call create %s\n", dentry->d_name.name); dprintk("NFS call create %s\n", dentry->d_name.name);
status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0);
if (status == 0) if (status == 0)
...@@ -273,12 +273,12 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, ...@@ -273,12 +273,12 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
sattr->ia_size = new_encode_dev(rdev);/* get out your barf bag */ sattr->ia_size = new_encode_dev(rdev);/* get out your barf bag */
} }
fattr.valid = 0; nfs_fattr_init(&fattr);
status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0);
if (status == -EINVAL && S_ISFIFO(mode)) { if (status == -EINVAL && S_ISFIFO(mode)) {
sattr->ia_mode = mode; sattr->ia_mode = mode;
fattr.valid = 0; nfs_fattr_init(&fattr);
status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0);
} }
if (status == 0) if (status == 0)
...@@ -391,7 +391,7 @@ nfs_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path, ...@@ -391,7 +391,7 @@ nfs_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path,
if (path->len > NFS2_MAXPATHLEN) if (path->len > NFS2_MAXPATHLEN)
return -ENAMETOOLONG; return -ENAMETOOLONG;
dprintk("NFS call symlink %s -> %s\n", name->name, path->name); dprintk("NFS call symlink %s -> %s\n", name->name, path->name);
fattr->valid = 0; nfs_fattr_init(fattr);
fhandle->size = 0; fhandle->size = 0;
status = rpc_call(NFS_CLIENT(dir), NFSPROC_SYMLINK, &arg, NULL, 0); status = rpc_call(NFS_CLIENT(dir), NFSPROC_SYMLINK, &arg, NULL, 0);
dprintk("NFS reply symlink: %d\n", status); dprintk("NFS reply symlink: %d\n", status);
...@@ -416,7 +416,7 @@ nfs_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr) ...@@ -416,7 +416,7 @@ nfs_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr)
int status; int status;
dprintk("NFS call mkdir %s\n", dentry->d_name.name); dprintk("NFS call mkdir %s\n", dentry->d_name.name);
fattr.valid = 0; nfs_fattr_init(&fattr);
status = rpc_call(NFS_CLIENT(dir), NFSPROC_MKDIR, &arg, &res, 0); status = rpc_call(NFS_CLIENT(dir), NFSPROC_MKDIR, &arg, &res, 0);
if (status == 0) if (status == 0)
status = nfs_instantiate(dentry, &fhandle, &fattr); status = nfs_instantiate(dentry, &fhandle, &fattr);
...@@ -484,7 +484,7 @@ nfs_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -484,7 +484,7 @@ nfs_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
int status; int status;
dprintk("NFS call statfs\n"); dprintk("NFS call statfs\n");
stat->fattr->valid = 0; nfs_fattr_init(stat->fattr);
status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0); status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0);
dprintk("NFS reply statfs: %d\n", status); dprintk("NFS reply statfs: %d\n", status);
if (status) if (status)
...@@ -507,7 +507,7 @@ nfs_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -507,7 +507,7 @@ nfs_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
int status; int status;
dprintk("NFS call fsinfo\n"); dprintk("NFS call fsinfo\n");
info->fattr->valid = 0; nfs_fattr_init(info->fattr);
status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0); status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0);
dprintk("NFS reply fsinfo: %d\n", status); dprintk("NFS reply fsinfo: %d\n", status);
if (status) if (status)
......
...@@ -215,6 +215,7 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data, ...@@ -215,6 +215,7 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
data->res.fattr = &data->fattr; data->res.fattr = &data->fattr;
data->res.count = count; data->res.count = count;
data->res.eof = 0; data->res.eof = 0;
nfs_fattr_init(&data->fattr);
NFS_PROTO(inode)->read_setup(data); NFS_PROTO(inode)->read_setup(data);
......
...@@ -870,6 +870,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req, ...@@ -870,6 +870,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
data->res.fattr = &data->fattr; data->res.fattr = &data->fattr;
data->res.count = count; data->res.count = count;
data->res.verf = &data->verf; data->res.verf = &data->verf;
nfs_fattr_init(&data->fattr);
NFS_PROTO(inode)->write_setup(data, how); NFS_PROTO(inode)->write_setup(data, how);
...@@ -1237,6 +1238,7 @@ static void nfs_commit_rpcsetup(struct list_head *head, ...@@ -1237,6 +1238,7 @@ static void nfs_commit_rpcsetup(struct list_head *head,
data->res.count = 0; data->res.count = 0;
data->res.fattr = &data->fattr; data->res.fattr = &data->fattr;
data->res.verf = &data->verf; data->res.verf = &data->verf;
nfs_fattr_init(&data->fattr);
NFS_PROTO(inode)->commit_setup(data, how); NFS_PROTO(inode)->commit_setup(data, how);
......
...@@ -316,6 +316,11 @@ extern void nfs_file_clear_open_context(struct file *filp); ...@@ -316,6 +316,11 @@ extern void nfs_file_clear_open_context(struct file *filp);
/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
extern u32 root_nfs_parse_addr(char *name); /*__init*/ extern u32 root_nfs_parse_addr(char *name); /*__init*/
static inline void nfs_fattr_init(struct nfs_fattr *fattr)
{
fattr->valid = 0;
}
/* /*
* linux/fs/nfs/file.c * linux/fs/nfs/file.c
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment