aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/locks.c32
1 files changed, 4 insertions, 28 deletions
diff --git a/fs/locks.c b/fs/locks.c
index c3eecb895acf..faddccb6336a 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -634,33 +634,6 @@ static int flock_locks_conflict(struct file_lock *caller_fl, struct file_lock *s
634 return (locks_conflict(caller_fl, sys_fl)); 634 return (locks_conflict(caller_fl, sys_fl));
635} 635}
636 636
637static int interruptible_sleep_on_locked(wait_queue_head_t *fl_wait, int timeout)
638{
639 int result = 0;
640 DECLARE_WAITQUEUE(wait, current);
641
642 __set_current_state(TASK_INTERRUPTIBLE);
643 add_wait_queue(fl_wait, &wait);
644 if (timeout == 0)
645 schedule();
646 else
647 result = schedule_timeout(timeout);
648 if (signal_pending(current))
649 result = -ERESTARTSYS;
650 remove_wait_queue(fl_wait, &wait);
651 __set_current_state(TASK_RUNNING);
652 return result;
653}
654
655static int locks_block_on_timeout(struct file_lock *blocker, struct file_lock *waiter, int time)
656{
657 int result;
658 locks_insert_block(blocker, waiter);
659 result = interruptible_sleep_on_locked(&waiter->fl_wait, time);
660 __locks_delete_block(waiter);
661 return result;
662}
663
664void 637void
665posix_test_lock(struct file *filp, struct file_lock *fl) 638posix_test_lock(struct file *filp, struct file_lock *fl)
666{ 639{
@@ -1266,7 +1239,10 @@ restart:
1266 if (break_time == 0) 1239 if (break_time == 0)
1267 break_time++; 1240 break_time++;
1268 } 1241 }
1269 error = locks_block_on_timeout(flock, new_fl, break_time); 1242 locks_insert_block(flock, new_fl);
1243 error = wait_event_interruptible_timeout(new_fl->fl_wait,
1244 !new_fl->fl_next, break_time);
1245 __locks_delete_block(new_fl);
1270 if (error >= 0) { 1246 if (error >= 0) {
1271 if (error == 0) 1247 if (error == 0)
1272 time_out_leases(inode); 1248 time_out_leases(inode);