]> git.karo-electronics.de Git - karo-tx-linux.git/commit
CIFS: Fix VFS lock usage for oplocked files
authorPavel Shilovsky <piastry@etersoft.ru>
Wed, 28 Mar 2012 17:56:19 +0000 (21:56 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2012 16:13:54 +0000 (09:13 -0700)
commit49c8ca7ade694f65de205adc08c23a710244b6b0
tree7567a9aea2a5b2cf1d9cf8b34cfb52f1b0f8e21f
parentc9f568f1a99794aa7b749828c41fb7cdf55fe435
CIFS: Fix VFS lock usage for oplocked files

commit 66189be74ff5f9f3fd6444315b85be210d07cef2 upstream.

We can deadlock if we have a write oplock and two processes
use the same file handle. In this case the first process can't
unlock its lock if the second process blocked on the lock in the
same time.

Fix it by using posix_lock_file rather than posix_lock_file_wait
under cinode->lock_mutex. If we request a blocking lock and
posix_lock_file indicates that there is another lock that prevents
us, wait untill that lock is released and restart our call.

Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/file.c
fs/locks.c
include/linux/fs.h