diff options
author | Pavel Shilovsky <piastry@etersoft.ru> | 2012-03-28 13:56:19 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2012-04-01 14:54:27 -0400 |
commit | 66189be74ff5f9f3fd6444315b85be210d07cef2 (patch) | |
tree | 7a179ddd7e233668dbb108faf847ceb768d2e92c /include | |
parent | 9ebb389d0a03b4415fe9014f6922a2412cb1109c (diff) |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/fs.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 135693e79f2b..528611843ba0 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1215,6 +1215,7 @@ extern int vfs_setlease(struct file *, long, struct file_lock **); | |||
1215 | extern int lease_modify(struct file_lock **, int); | 1215 | extern int lease_modify(struct file_lock **, int); |
1216 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1216 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
1217 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1217 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
1218 | extern void locks_delete_block(struct file_lock *waiter); | ||
1218 | extern void lock_flocks(void); | 1219 | extern void lock_flocks(void); |
1219 | extern void unlock_flocks(void); | 1220 | extern void unlock_flocks(void); |
1220 | #else /* !CONFIG_FILE_LOCKING */ | 1221 | #else /* !CONFIG_FILE_LOCKING */ |
@@ -1359,6 +1360,10 @@ static inline int lock_may_write(struct inode *inode, loff_t start, | |||
1359 | return 1; | 1360 | return 1; |
1360 | } | 1361 | } |
1361 | 1362 | ||
1363 | static inline void locks_delete_block(struct file_lock *waiter) | ||
1364 | { | ||
1365 | } | ||
1366 | |||
1362 | static inline void lock_flocks(void) | 1367 | static inline void lock_flocks(void) |
1363 | { | 1368 | { |
1364 | } | 1369 | } |