diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-10-27 22:12:38 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-10-27 22:12:38 -0400 |
commit | 0e574af1be5f569a5d7f2800333b0bfb358a5e34 (patch) | |
tree | bb5b62dece21b8906222dfee022020ed6f81e34c /fs/nfs/nfs4proc.c | |
parent | 4c2cb58c552a34744979a99ccf01762d5eb7e288 (diff) |
NFS: Cleanup initialisation of struct nfs_fattr
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 43 |
1 files changed, 20 insertions, 23 deletions
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 | |||
1107 | static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, | 1105 | static 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 | ||
2017 | static int nfs4_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) | 2014 | static 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 | ||