aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2005-10-27 22:12:44 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-10-27 22:12:44 -0400
commit4f9838c7ecd14f31f701f64fa65ded132fc0db8a (patch)
treef3fee5b744efb072f44591208541554976bf41d7 /fs
parent16e429596dec4d28e16812b3a9be27f18412c567 (diff)
NFSv4: Add post-op attributes to NFSv4 write and commit callbacks.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4proc.c13
-rw-r--r--fs/nfs/nfs4xdr.c28
2 files changed, 34 insertions, 7 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index bab47c4cb41c..933e13b383f8 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2169,8 +2169,10 @@ nfs4_write_done(struct rpc_task *task)
2169 rpc_restart_call(task); 2169 rpc_restart_call(task);
2170 return; 2170 return;
2171 } 2171 }
2172 if (task->tk_status >= 0) 2172 if (task->tk_status >= 0) {
2173 renew_lease(NFS_SERVER(inode), data->timestamp); 2173 renew_lease(NFS_SERVER(inode), data->timestamp);
2174 nfs_post_op_update_inode(inode, data->res.fattr);
2175 }
2174 /* Call back common NFS writeback processing */ 2176 /* Call back common NFS writeback processing */
2175 nfs_writeback_done(task); 2177 nfs_writeback_done(task);
2176} 2178}
@@ -2186,6 +2188,7 @@ nfs4_proc_write_setup(struct nfs_write_data *data, int how)
2186 .rpc_cred = data->cred, 2188 .rpc_cred = data->cred,
2187 }; 2189 };
2188 struct inode *inode = data->inode; 2190 struct inode *inode = data->inode;
2191 struct nfs_server *server = NFS_SERVER(inode);
2189 int stable; 2192 int stable;
2190 int flags; 2193 int flags;
2191 2194
@@ -2197,6 +2200,8 @@ nfs4_proc_write_setup(struct nfs_write_data *data, int how)
2197 } else 2200 } else
2198 stable = NFS_UNSTABLE; 2201 stable = NFS_UNSTABLE;
2199 data->args.stable = stable; 2202 data->args.stable = stable;
2203 data->args.bitmask = server->attr_bitmask;
2204 data->res.server = server;
2200 2205
2201 data->timestamp = jiffies; 2206 data->timestamp = jiffies;
2202 2207
@@ -2218,6 +2223,8 @@ nfs4_commit_done(struct rpc_task *task)
2218 rpc_restart_call(task); 2223 rpc_restart_call(task);
2219 return; 2224 return;
2220 } 2225 }
2226 if (task->tk_status >= 0)
2227 nfs_post_op_update_inode(inode, data->res.fattr);
2221 /* Call back common NFS writeback processing */ 2228 /* Call back common NFS writeback processing */
2222 nfs_commit_done(task); 2229 nfs_commit_done(task);
2223} 2230}
@@ -2233,8 +2240,12 @@ nfs4_proc_commit_setup(struct nfs_write_data *data, int how)
2233 .rpc_cred = data->cred, 2240 .rpc_cred = data->cred,
2234 }; 2241 };
2235 struct inode *inode = data->inode; 2242 struct inode *inode = data->inode;
2243 struct nfs_server *server = NFS_SERVER(inode);
2236 int flags; 2244 int flags;
2237 2245
2246 data->args.bitmask = server->attr_bitmask;
2247 data->res.server = server;
2248
2238 /* Set the initial flags for the task. */ 2249 /* Set the initial flags for the task. */
2239 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; 2250 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC;
2240 2251
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 3ee3a1669d28..6f1bf182e0e0 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -159,16 +159,20 @@ static int nfs_stat_to_errno(int);
159 op_decode_hdr_maxsz + 2) 159 op_decode_hdr_maxsz + 2)
160#define NFS4_enc_write_sz (compound_encode_hdr_maxsz + \ 160#define NFS4_enc_write_sz (compound_encode_hdr_maxsz + \
161 encode_putfh_maxsz + \ 161 encode_putfh_maxsz + \
162 op_encode_hdr_maxsz + 8) 162 op_encode_hdr_maxsz + 8 + \
163 encode_getattr_maxsz)
163#define NFS4_dec_write_sz (compound_decode_hdr_maxsz + \ 164#define NFS4_dec_write_sz (compound_decode_hdr_maxsz + \
164 decode_putfh_maxsz + \ 165 decode_putfh_maxsz + \
165 op_decode_hdr_maxsz + 4) 166 op_decode_hdr_maxsz + 4 + \
167 decode_getattr_maxsz)
166#define NFS4_enc_commit_sz (compound_encode_hdr_maxsz + \ 168#define NFS4_enc_commit_sz (compound_encode_hdr_maxsz + \
167 encode_putfh_maxsz + \ 169 encode_putfh_maxsz + \
168 op_encode_hdr_maxsz + 3) 170 op_encode_hdr_maxsz + 3 + \
171 encode_getattr_maxsz)
169#define NFS4_dec_commit_sz (compound_decode_hdr_maxsz + \ 172#define NFS4_dec_commit_sz (compound_decode_hdr_maxsz + \
170 decode_putfh_maxsz + \ 173 decode_putfh_maxsz + \
171 op_decode_hdr_maxsz + 2) 174 op_decode_hdr_maxsz + 2 + \
175 decode_getattr_maxsz)
172#define NFS4_enc_open_sz (compound_encode_hdr_maxsz + \ 176#define NFS4_enc_open_sz (compound_encode_hdr_maxsz + \
173 encode_putfh_maxsz + \ 177 encode_putfh_maxsz + \
174 op_encode_hdr_maxsz + \ 178 op_encode_hdr_maxsz + \
@@ -1799,7 +1803,7 @@ static int nfs4_xdr_enc_write(struct rpc_rqst *req, uint32_t *p, struct nfs_writ
1799{ 1803{
1800 struct xdr_stream xdr; 1804 struct xdr_stream xdr;
1801 struct compound_hdr hdr = { 1805 struct compound_hdr hdr = {
1802 .nops = 2, 1806 .nops = 3,
1803 }; 1807 };
1804 int status; 1808 int status;
1805 1809
@@ -1809,6 +1813,9 @@ static int nfs4_xdr_enc_write(struct rpc_rqst *req, uint32_t *p, struct nfs_writ
1809 if (status) 1813 if (status)
1810 goto out; 1814 goto out;
1811 status = encode_write(&xdr, args); 1815 status = encode_write(&xdr, args);
1816 if (status)
1817 goto out;
1818 status = encode_getfattr(&xdr, args->bitmask);
1812out: 1819out:
1813 return status; 1820 return status;
1814} 1821}
@@ -1820,7 +1827,7 @@ static int nfs4_xdr_enc_commit(struct rpc_rqst *req, uint32_t *p, struct nfs_wri
1820{ 1827{
1821 struct xdr_stream xdr; 1828 struct xdr_stream xdr;
1822 struct compound_hdr hdr = { 1829 struct compound_hdr hdr = {
1823 .nops = 2, 1830 .nops = 3,
1824 }; 1831 };
1825 int status; 1832 int status;
1826 1833
@@ -1830,6 +1837,9 @@ static int nfs4_xdr_enc_commit(struct rpc_rqst *req, uint32_t *p, struct nfs_wri
1830 if (status) 1837 if (status)
1831 goto out; 1838 goto out;
1832 status = encode_commit(&xdr, args); 1839 status = encode_commit(&xdr, args);
1840 if (status)
1841 goto out;
1842 status = encode_getfattr(&xdr, args->bitmask);
1833out: 1843out:
1834 return status; 1844 return status;
1835} 1845}
@@ -4001,6 +4011,9 @@ static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_wr
4001 if (status) 4011 if (status)
4002 goto out; 4012 goto out;
4003 status = decode_write(&xdr, res); 4013 status = decode_write(&xdr, res);
4014 if (status)
4015 goto out;
4016 decode_getfattr(&xdr, res->fattr, res->server);
4004 if (!status) 4017 if (!status)
4005 status = res->count; 4018 status = res->count;
4006out: 4019out:
@@ -4024,6 +4037,9 @@ static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_w
4024 if (status) 4037 if (status)
4025 goto out; 4038 goto out;
4026 status = decode_commit(&xdr, res); 4039 status = decode_commit(&xdr, res);
4040 if (status)
4041 goto out;
4042 decode_getfattr(&xdr, res->fattr, res->server);
4027out: 4043out:
4028 return status; 4044 return status;
4029} 4045}