NFSv4: Fix problems with close in the presence of a delegation
authorTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 26 Aug 2014 02:33:12 +0000 (22:33 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 13 Sep 2014 22:41:47 +0000 (23:41 +0100)
commit74efedade8e97ae72326c42c4456a21b5c07e19b
tree963dff5e7bd45ba566c4c502331c86e3dc9220c2
parentec5afb05f1a3313a5a4c63be884a26d8b92dadbe
NFSv4: Fix problems with close in the presence of a delegation

commit aee7af356e151494d5014f57b33460b162f181b5 upstream.

In the presence of delegations, we can no longer assume that the
state->n_rdwr, state->n_rdonly, state->n_wronly reflect the open
stateid share mode, and so we need to calculate the initial value
for calldata->arg.fmode using the state->flags.

Reported-by: James Drews <drews@engr.wisc.edu>
Fixes: 88069f77e1ac5 (NFSv41: Fix a potential state leakage when...)
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/nfs/nfs4proc.c