NFSv4: fix delegated locking
commit5eb54e380090d45afc9e4484abd6a75bd6ae4bc2
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 11 Apr 2010 20:48:44 +0000 (11 16:48 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 26 Apr 2010 14:41:25 +0000 (26 07:41 -0700)
tree1ddc10f9a0dde9f25f9bfb6ec1427762f3e2c130
parent2d71e7c297ba7fdce9ff2084f2873fef66f2fb17
NFSv4: fix delegated locking

commit 0df5dd4aae211edeeeb84f7f84f6d093406d7c22 upstream.

Arnaud Giersch reports that NFSv4 locking is broken when we hold a
delegation since commit 8e469ebd6dc32cbaf620e134d79f740bf0ebab79 (NFSv4:
Don't allow posix locking against servers that don't support it).

According to Arnaud, the lock succeeds the first time he opens the file
(since we cannot do a delegated open) but then fails after we start using
delegated opens.

The following patch fixes it by ensuring that locking behaviour is
governed by a per-filesystem capability flag that is initially set, but
gets cleared if the server ever returns an OPEN without the
NFS4_OPEN_RESULT_LOCKTYPE_POSIX flag being set.

Reported-by: Arnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/nfs/client.c
fs/nfs/nfs4proc.c
include/linux/nfs_fs_sb.h