diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-03 03:55:38 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-06 14:58:51 -0500 |
commit | fa178f29c0f8a0dce748181a5351f4a92fd4f455 (patch) | |
tree | 07de5ced8d16d832ebed98c58a2c0498affa12db /fs/nfs/nfs4xdr.c | |
parent | beb2a5ec386e5ce6891ebd1c06b913da04354b40 (diff) |
NFSv4: Ensure DELEGRETURN returns attributes
Upon return of a write delegation, the server will almost always bump the
change attribute. Ensure that we pick up that change so that we don't
invalidate our data cache unnecessarily.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 5d6bda43dfaa..12be1d682164 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -392,9 +392,11 @@ static int nfs_stat_to_errno(int); | |||
392 | decode_getattr_maxsz) | 392 | decode_getattr_maxsz) |
393 | #define NFS4_enc_delegreturn_sz (compound_encode_hdr_maxsz + \ | 393 | #define NFS4_enc_delegreturn_sz (compound_encode_hdr_maxsz + \ |
394 | encode_putfh_maxsz + \ | 394 | encode_putfh_maxsz + \ |
395 | encode_delegreturn_maxsz) | 395 | encode_delegreturn_maxsz + \ |
396 | encode_getattr_maxsz) | ||
396 | #define NFS4_dec_delegreturn_sz (compound_decode_hdr_maxsz + \ | 397 | #define NFS4_dec_delegreturn_sz (compound_decode_hdr_maxsz + \ |
397 | decode_delegreturn_maxsz) | 398 | decode_delegreturn_maxsz + \ |
399 | decode_getattr_maxsz) | ||
398 | #define NFS4_enc_getacl_sz (compound_encode_hdr_maxsz + \ | 400 | #define NFS4_enc_getacl_sz (compound_encode_hdr_maxsz + \ |
399 | encode_putfh_maxsz + \ | 401 | encode_putfh_maxsz + \ |
400 | encode_getattr_maxsz) | 402 | encode_getattr_maxsz) |
@@ -1983,14 +1985,20 @@ static int nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, uint32_t *p, const str | |||
1983 | { | 1985 | { |
1984 | struct xdr_stream xdr; | 1986 | struct xdr_stream xdr; |
1985 | struct compound_hdr hdr = { | 1987 | struct compound_hdr hdr = { |
1986 | .nops = 2, | 1988 | .nops = 3, |
1987 | }; | 1989 | }; |
1988 | int status; | 1990 | int status; |
1989 | 1991 | ||
1990 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1992 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1991 | encode_compound_hdr(&xdr, &hdr); | 1993 | encode_compound_hdr(&xdr, &hdr); |
1992 | if ((status = encode_putfh(&xdr, args->fhandle)) == 0) | 1994 | status = encode_putfh(&xdr, args->fhandle); |
1993 | status = encode_delegreturn(&xdr, args->stateid); | 1995 | if (status != 0) |
1996 | goto out; | ||
1997 | status = encode_delegreturn(&xdr, args->stateid); | ||
1998 | if (status != 0) | ||
1999 | goto out; | ||
2000 | status = encode_getfattr(&xdr, args->bitmask); | ||
2001 | out: | ||
1994 | return status; | 2002 | return status; |
1995 | } | 2003 | } |
1996 | 2004 | ||
@@ -4184,7 +4192,7 @@ static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, uint32_t *p, s | |||
4184 | /* | 4192 | /* |
4185 | * DELEGRETURN request | 4193 | * DELEGRETURN request |
4186 | */ | 4194 | */ |
4187 | static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, uint32_t *p, void *dummy) | 4195 | static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_delegreturnres *res) |
4188 | { | 4196 | { |
4189 | struct xdr_stream xdr; | 4197 | struct xdr_stream xdr; |
4190 | struct compound_hdr hdr; | 4198 | struct compound_hdr hdr; |
@@ -4192,11 +4200,14 @@ static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, uint32_t *p, void *d | |||
4192 | 4200 | ||
4193 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 4201 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
4194 | status = decode_compound_hdr(&xdr, &hdr); | 4202 | status = decode_compound_hdr(&xdr, &hdr); |
4195 | if (status == 0) { | 4203 | if (status != 0) |
4196 | status = decode_putfh(&xdr); | 4204 | goto out; |
4197 | if (status == 0) | 4205 | status = decode_putfh(&xdr); |
4198 | status = decode_delegreturn(&xdr); | 4206 | if (status != 0) |
4199 | } | 4207 | goto out; |
4208 | status = decode_delegreturn(&xdr); | ||
4209 | decode_getfattr(&xdr, res->fattr, res->server); | ||
4210 | out: | ||
4200 | return status; | 4211 | return status; |
4201 | } | 4212 | } |
4202 | 4213 | ||