diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-10-27 22:12:41 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-10-27 22:12:41 -0400 |
commit | 516a6af641bb50c608329a5bd751acd0d65cc4ab (patch) | |
tree | 93b240cb19460073cac3363517fcc0e253fb48d9 /fs/nfs/nfs4xdr.c | |
parent | 3338c143b4fde2d256016b63043ec8e2c93eba19 (diff) |
NFS: Add optional post-op getattr instruction to the NFSv4 file close.
"Optional" means that the close call will not fail if the getattr
at the end of the compound fails.
If it does succeed, try to refresh inode attributes.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 7f91d613d31..cd9e26cfa86 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -198,17 +198,21 @@ static int nfs_stat_to_errno(int); | |||
198 | #define NFS4_enc_open_downgrade_sz \ | 198 | #define NFS4_enc_open_downgrade_sz \ |
199 | (compound_encode_hdr_maxsz + \ | 199 | (compound_encode_hdr_maxsz + \ |
200 | encode_putfh_maxsz + \ | 200 | encode_putfh_maxsz + \ |
201 | op_encode_hdr_maxsz + 7) | 201 | op_encode_hdr_maxsz + 7 + \ |
202 | encode_getattr_maxsz) | ||
202 | #define NFS4_dec_open_downgrade_sz \ | 203 | #define NFS4_dec_open_downgrade_sz \ |
203 | (compound_decode_hdr_maxsz + \ | 204 | (compound_decode_hdr_maxsz + \ |
204 | decode_putfh_maxsz + \ | 205 | decode_putfh_maxsz + \ |
205 | op_decode_hdr_maxsz + 4) | 206 | op_decode_hdr_maxsz + 4 + \ |
207 | decode_getattr_maxsz) | ||
206 | #define NFS4_enc_close_sz (compound_encode_hdr_maxsz + \ | 208 | #define NFS4_enc_close_sz (compound_encode_hdr_maxsz + \ |
207 | encode_putfh_maxsz + \ | 209 | encode_putfh_maxsz + \ |
208 | op_encode_hdr_maxsz + 5) | 210 | op_encode_hdr_maxsz + 5 + \ |
211 | encode_getattr_maxsz) | ||
209 | #define NFS4_dec_close_sz (compound_decode_hdr_maxsz + \ | 212 | #define NFS4_dec_close_sz (compound_decode_hdr_maxsz + \ |
210 | decode_putfh_maxsz + \ | 213 | decode_putfh_maxsz + \ |
211 | op_decode_hdr_maxsz + 4) | 214 | op_decode_hdr_maxsz + 4 + \ |
215 | decode_getattr_maxsz) | ||
212 | #define NFS4_enc_setattr_sz (compound_encode_hdr_maxsz + \ | 216 | #define NFS4_enc_setattr_sz (compound_encode_hdr_maxsz + \ |
213 | encode_putfh_maxsz + \ | 217 | encode_putfh_maxsz + \ |
214 | op_encode_hdr_maxsz + 4 + \ | 218 | op_encode_hdr_maxsz + 4 + \ |
@@ -1433,7 +1437,7 @@ static int nfs4_xdr_enc_close(struct rpc_rqst *req, uint32_t *p, struct nfs_clos | |||
1433 | { | 1437 | { |
1434 | struct xdr_stream xdr; | 1438 | struct xdr_stream xdr; |
1435 | struct compound_hdr hdr = { | 1439 | struct compound_hdr hdr = { |
1436 | .nops = 2, | 1440 | .nops = 3, |
1437 | }; | 1441 | }; |
1438 | int status; | 1442 | int status; |
1439 | 1443 | ||
@@ -1443,6 +1447,9 @@ static int nfs4_xdr_enc_close(struct rpc_rqst *req, uint32_t *p, struct nfs_clos | |||
1443 | if(status) | 1447 | if(status) |
1444 | goto out; | 1448 | goto out; |
1445 | status = encode_close(&xdr, args); | 1449 | status = encode_close(&xdr, args); |
1450 | if (status != 0) | ||
1451 | goto out; | ||
1452 | status = encode_getfattr(&xdr, args->bitmask); | ||
1446 | out: | 1453 | out: |
1447 | return status; | 1454 | return status; |
1448 | } | 1455 | } |
@@ -1541,7 +1548,7 @@ static int nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, uint32_t *p, struct | |||
1541 | { | 1548 | { |
1542 | struct xdr_stream xdr; | 1549 | struct xdr_stream xdr; |
1543 | struct compound_hdr hdr = { | 1550 | struct compound_hdr hdr = { |
1544 | .nops = 2, | 1551 | .nops = 3, |
1545 | }; | 1552 | }; |
1546 | int status; | 1553 | int status; |
1547 | 1554 | ||
@@ -1551,6 +1558,9 @@ static int nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, uint32_t *p, struct | |||
1551 | if (status) | 1558 | if (status) |
1552 | goto out; | 1559 | goto out; |
1553 | status = encode_open_downgrade(&xdr, args); | 1560 | status = encode_open_downgrade(&xdr, args); |
1561 | if (status != 0) | ||
1562 | goto out; | ||
1563 | status = encode_getfattr(&xdr, args->bitmask); | ||
1554 | out: | 1564 | out: |
1555 | return status; | 1565 | return status; |
1556 | } | 1566 | } |
@@ -3403,6 +3413,9 @@ static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, uint32_t *p, stru | |||
3403 | if (status) | 3413 | if (status) |
3404 | goto out; | 3414 | goto out; |
3405 | status = decode_open_downgrade(&xdr, res); | 3415 | status = decode_open_downgrade(&xdr, res); |
3416 | if (status != 0) | ||
3417 | goto out; | ||
3418 | decode_getfattr(&xdr, res->fattr, res->server); | ||
3406 | out: | 3419 | out: |
3407 | return status; | 3420 | return status; |
3408 | } | 3421 | } |
@@ -3678,6 +3691,15 @@ static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_cl | |||
3678 | if (status) | 3691 | if (status) |
3679 | goto out; | 3692 | goto out; |
3680 | status = decode_close(&xdr, res); | 3693 | status = decode_close(&xdr, res); |
3694 | if (status != 0) | ||
3695 | goto out; | ||
3696 | /* | ||
3697 | * Note: Server may do delete on close for this file | ||
3698 | * in which case the getattr call will fail with | ||
3699 | * an ESTALE error. Shouldn't be a problem, | ||
3700 | * though, since fattr->valid will remain unset. | ||
3701 | */ | ||
3702 | decode_getfattr(&xdr, res->fattr, res->server); | ||
3681 | out: | 3703 | out: |
3682 | return status; | 3704 | return status; |
3683 | } | 3705 | } |