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>
Sun, 21 Jul 2013 00:16:06 +0000 (17:16 -0700)
commit900b565e72018dfa7f4c95dacdb3a3b5a0e4174e
tree377e88b20a5da1c8a6f85ff8b5e7f51b2dc21a05
parent44d244a13a27f0eb7b33bb152aa173c0e875df76
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