CIFS: Fix a deadlock when a file is reopened
authorPavel Shilovsky <pshilovsky@samba.org>
Thu, 11 Jul 2013 07:17:45 +0000 (11:17 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jul 2013 01:21:21 +0000 (18:21 -0700)
commit059a1671f28c977fe69a0f86eeb0fa2084fdb3dd
treed3f051c00845f9d840bca3b1d6d98a637713e958
parentcfe24e4e36ec19a56bac17691f8721ac44050a6f
CIFS: Fix a deadlock when a file is reopened

commit 689c3db4d57a73bee6c5ad7797fce7b54d32a87c upstream.

If we request reading or writing on a file that needs to be
reopened, it causes the deadlock: we are already holding rw
semaphore for reading and then we try to acquire it for writing
in cifs_relock_file. Fix this by acquiring the semaphore for
reading in cifs_relock_file due to we don't make any changes in
locks and don't need a write access.

Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/file.c