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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Sep 2014 23:28:37 +0000 (16:28 -0700)
commit569ae35a436502bf1aaaa7391b94e1d04b61ffca
tree5ba35828567a8633530146b93156725a0135c08d
parentb6f70b7027f157fbba45091518f34faf40ad81b8
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/nfs4proc.c