nfsd: Always lock state exclusively.
authorOleg Drokin <green@linuxhacker.ru>
Wed, 15 Jun 2016 03:28:04 +0000 (23:28 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jul 2016 16:47:30 +0000 (09:47 -0700)
commit087f8fe0074874a6072bdabbdf6dad03e0fbba2a
tree1d5ea3159232a521d2d014230b9c8041a52e7da8
parent58e9e70ab997977776ab7b2d6b6ca3d8802d52b4
nfsd: Always lock state exclusively.

commit feb9dad5209280085d5b0c094fa67e7a8d75c81a upstream.

It used to be the case that state had an rwlock that was locked for write
by downgrades, but for read for upgrades (opens). Well, the problem is
if there are two competing opens for the same state, they step on
each other toes potentially leading to leaking file descriptors
from the state structure, since access mode is a bitmap only set once.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/nfs4state.c
fs/nfsd/state.h