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)
committerZefan Li <lizefan@huawei.com>
Thu, 25 Sep 2014 03:49:15 +0000 (11:49 +0800)
commit0bfb000447ffec4e7245c9c761fd0770acba504d
tree2bb3296fa8b61bd47b85387aea3f20cb097e8db2
parent818ee415d57c89ab36cbd2b9a57cc3c257afc1b9
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>
[lizf: Backport to 3.4: adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
fs/nfs/nfs4proc.c