aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2012-04-01 14:52:54 -0400
committerSteve French <sfrench@us.ibm.com>2012-04-01 14:52:54 -0400
commit9ebb389d0a03b4415fe9014f6922a2412cb1109c (patch)
tree4a411bbb4225e610656dff673028b83a3100ce3d /fs
parent2545e0720a5a4bf8ebccc6f793f97a246cf3f18d (diff)
Revert "CIFS: Fix VFS lock usage for oplocked files"
Revert previous version of patch to incorporate feedback so that we can merge version 3 of the patch instead.w This reverts commit b5efb978469d152c2c7c0a09746fb0bfc6171868.
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/file.c56
1 files changed, 4 insertions, 52 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 0a11dbbbb131..460d87b7cda0 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -671,21 +671,6 @@ cifs_del_lock_waiters(struct cifsLockInfo *lock)
671 } 671 }
672} 672}
673 673
674/*
675 * Copied from fs/locks.c with small changes.
676 * Remove waiter from blocker's block list.
677 * When blocker ends up pointing to itself then the list is empty.
678 */
679static void
680cifs_locks_delete_block(struct file_lock *waiter)
681{
682 lock_flocks();
683 list_del_init(&waiter->fl_block);
684 list_del_init(&waiter->fl_link);
685 waiter->fl_next = NULL;
686 unlock_flocks();
687}
688
689static bool 674static bool
690__cifs_find_lock_conflict(struct cifsInodeInfo *cinode, __u64 offset, 675__cifs_find_lock_conflict(struct cifsInodeInfo *cinode, __u64 offset,
691 __u64 length, __u8 type, __u16 netfid, 676 __u64 length, __u8 type, __u16 netfid,
@@ -835,39 +820,6 @@ cifs_posix_lock_test(struct file *file, struct file_lock *flock)
835 return rc; 820 return rc;
836} 821}
837 822
838/* Called with locked lock_mutex, return with unlocked. */
839static int
840cifs_posix_lock_file_wait_locked(struct file *file, struct file_lock *flock)
841{
842 struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode);
843 int rc;
844
845 while (true) {
846 rc = posix_lock_file(file, flock, NULL);
847 mutex_unlock(&cinode->lock_mutex);
848 if (rc != FILE_LOCK_DEFERRED)
849 break;
850 rc = wait_event_interruptible(flock->fl_wait, !flock->fl_next);
851 if (!rc) {
852 mutex_lock(&cinode->lock_mutex);
853 continue;
854 }
855 cifs_locks_delete_block(flock);
856 break;
857 }
858 return rc;
859}
860
861static int
862cifs_posix_lock_file_wait(struct file *file, struct file_lock *flock)
863{
864 struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode);
865
866 mutex_lock(&cinode->lock_mutex);
867 /* lock_mutex will be released by the function below */
868 return cifs_posix_lock_file_wait_locked(file, flock);
869}
870
871/* 823/*
872 * Set the byte-range lock (posix style). Returns: 824 * Set the byte-range lock (posix style). Returns:
873 * 1) 0, if we set the lock and don't need to request to the server; 825 * 1) 0, if we set the lock and don't need to request to the server;
@@ -888,9 +840,9 @@ cifs_posix_lock_set(struct file *file, struct file_lock *flock)
888 mutex_unlock(&cinode->lock_mutex); 840 mutex_unlock(&cinode->lock_mutex);
889 return rc; 841 return rc;
890 } 842 }
891 843 rc = posix_lock_file_wait(file, flock);
892 /* lock_mutex will be released by the function below */ 844 mutex_unlock(&cinode->lock_mutex);
893 return cifs_posix_lock_file_wait_locked(file, flock); 845 return rc;
894} 846}
895 847
896static int 848static int
@@ -1386,7 +1338,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u8 type,
1386 1338
1387out: 1339out:
1388 if (flock->fl_flags & FL_POSIX) 1340 if (flock->fl_flags & FL_POSIX)
1389 cifs_posix_lock_file_wait(file, flock); 1341 posix_lock_file_wait(file, flock);
1390 return rc; 1342 return rc;
1391} 1343}
1392 1344