From 12b6b162e5afb27c5a4a2ad44887209bae69f507 Mon Sep 17 00:00:00 2001 From: Pavel Shilovsky Date: Wed, 28 Mar 2012 21:56:19 +0400 Subject: [PATCH] --- yaml --- r: 298640 b: refs/heads/master c: 66189be74ff5f9f3fd6444315b85be210d07cef2 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/cifs/file.c | 10 +++++++++- trunk/fs/locks.c | 3 ++- trunk/include/linux/fs.h | 5 +++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index ba6153e4972d..a40ac3c4b1fc 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9ebb389d0a03b4415fe9014f6922a2412cb1109c +refs/heads/master: 66189be74ff5f9f3fd6444315b85be210d07cef2 diff --git a/trunk/fs/cifs/file.c b/trunk/fs/cifs/file.c index 460d87b7cda0..fae765dac934 100644 --- a/trunk/fs/cifs/file.c +++ b/trunk/fs/cifs/file.c @@ -835,13 +835,21 @@ cifs_posix_lock_set(struct file *file, struct file_lock *flock) if ((flock->fl_flags & FL_POSIX) == 0) return rc; +try_again: mutex_lock(&cinode->lock_mutex); if (!cinode->can_cache_brlcks) { mutex_unlock(&cinode->lock_mutex); return rc; } - rc = posix_lock_file_wait(file, flock); + + rc = posix_lock_file(file, flock, NULL); mutex_unlock(&cinode->lock_mutex); + if (rc == FILE_LOCK_DEFERRED) { + rc = wait_event_interruptible(flock->fl_wait, !flock->fl_next); + if (!rc) + goto try_again; + locks_delete_block(flock); + } return rc; } diff --git a/trunk/fs/locks.c b/trunk/fs/locks.c index 637694bf3a03..0d68f1f81799 100644 --- a/trunk/fs/locks.c +++ b/trunk/fs/locks.c @@ -510,12 +510,13 @@ static void __locks_delete_block(struct file_lock *waiter) /* */ -static void locks_delete_block(struct file_lock *waiter) +void locks_delete_block(struct file_lock *waiter) { lock_flocks(); __locks_delete_block(waiter); unlock_flocks(); } +EXPORT_SYMBOL(locks_delete_block); /* Insert waiter into blocker's block list. * We use a circular list so that processes can be easily woken up in diff --git a/trunk/include/linux/fs.h b/trunk/include/linux/fs.h index 135693e79f2b..528611843ba0 100644 --- a/trunk/include/linux/fs.h +++ b/trunk/include/linux/fs.h @@ -1215,6 +1215,7 @@ extern int vfs_setlease(struct file *, long, struct file_lock **); extern int lease_modify(struct file_lock **, int); extern int lock_may_read(struct inode *, loff_t start, unsigned long count); extern int lock_may_write(struct inode *, loff_t start, unsigned long count); +extern void locks_delete_block(struct file_lock *waiter); extern void lock_flocks(void); extern void unlock_flocks(void); #else /* !CONFIG_FILE_LOCKING */ @@ -1359,6 +1360,10 @@ static inline int lock_may_write(struct inode *inode, loff_t start, return 1; } +static inline void locks_delete_block(struct file_lock *waiter) +{ +} + static inline void lock_flocks(void) { }