]> git.baikalelectronics.ru Git - kernel.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)
committerSteve French <sfrench@us.ibm.com>
Sun, 1 Apr 2012 18:54:27 +0000 (13:54 -0500)
commit2c26d2f17e603ff9df9e91308fff339ca4a3ab46
tree7a179ddd7e233668dbb108faf847ceb768d2e92c
parent10d7e6981391983476469f664f8c1e3c67056edb
CIFS: Fix VFS lock usage for oplocked files

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.

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