summaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-12-19 12:14:44 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-12-19 17:30:00 -0500
commitd8d849835eb2082ea17655538a83fa467633927f (patch)
tree0a242eade50ae70e62a6dc3a5bc223e255cc4450 /fs/nfs/nfs4xdr.c
parent9413a1a1bf5d58db610e3d9ba500f4150afa55ad (diff)
NFSv4: Place the GETATTR operation before the CLOSE
In order to benefit from the DENY share lock protection, we should put the GETATTR operation before the CLOSE. Otherwise, we might race with a Windows machine that thinks it is now safe to modify the file. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 8ccb34cf0c19..6f2365b99fb4 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2279,9 +2279,9 @@ static void nfs4_xdr_enc_close(struct rpc_rqst *req, struct xdr_stream *xdr,
2279 encode_putfh(xdr, args->fh, &hdr); 2279 encode_putfh(xdr, args->fh, &hdr);
2280 if (args->lr_args) 2280 if (args->lr_args)
2281 encode_layoutreturn(xdr, args->lr_args, &hdr); 2281 encode_layoutreturn(xdr, args->lr_args, &hdr);
2282 encode_close(xdr, args, &hdr);
2283 if (args->bitmask != NULL) 2282 if (args->bitmask != NULL)
2284 encode_getfattr(xdr, args->bitmask, &hdr); 2283 encode_getfattr(xdr, args->bitmask, &hdr);
2284 encode_close(xdr, args, &hdr);
2285 encode_nops(&hdr); 2285 encode_nops(&hdr);
2286} 2286}
2287 2287
@@ -6494,16 +6494,12 @@ static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6494 if (status) 6494 if (status)
6495 goto out; 6495 goto out;
6496 } 6496 }
6497 if (res->fattr != NULL) {
6498 status = decode_getfattr(xdr, res->fattr, res->server);
6499 if (status != 0)
6500 goto out;
6501 }
6497 status = decode_close(xdr, res); 6502 status = decode_close(xdr, res);
6498 if (status != 0)
6499 goto out;
6500 /*
6501 * Note: Server may do delete on close for this file
6502 * in which case the getattr call will fail with
6503 * an ESTALE error. Shouldn't be a problem,
6504 * though, since fattr->valid will remain unset.
6505 */
6506 decode_getfattr(xdr, res->fattr, res->server);
6507out: 6503out:
6508 return status; 6504 return status;
6509} 6505}