Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 82728
b: refs/heads/master
c: 4321e01
h: refs/heads/master
v: v3
  • Loading branch information
Matthew Wilcox authored and J. Bruce Fields committed Feb 3, 2008
1 parent 55da3b0 commit 2d2ac1a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b533184fc353d4a2d07929b4ac424a6f1bf5a3b9
refs/heads/master: 4321e01e7dce8042758349ffa2929c723b0d4107
32 changes: 4 additions & 28 deletions trunk/fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,33 +634,6 @@ static int flock_locks_conflict(struct file_lock *caller_fl, struct file_lock *s
return (locks_conflict(caller_fl, sys_fl));
}

static int interruptible_sleep_on_locked(wait_queue_head_t *fl_wait, int timeout)
{
int result = 0;
DECLARE_WAITQUEUE(wait, current);

__set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(fl_wait, &wait);
if (timeout == 0)
schedule();
else
result = schedule_timeout(timeout);
if (signal_pending(current))
result = -ERESTARTSYS;
remove_wait_queue(fl_wait, &wait);
__set_current_state(TASK_RUNNING);
return result;
}

static int locks_block_on_timeout(struct file_lock *blocker, struct file_lock *waiter, int time)
{
int result;
locks_insert_block(blocker, waiter);
result = interruptible_sleep_on_locked(&waiter->fl_wait, time);
__locks_delete_block(waiter);
return result;
}

void
posix_test_lock(struct file *filp, struct file_lock *fl)
{
Expand Down Expand Up @@ -1266,7 +1239,10 @@ int __break_lease(struct inode *inode, unsigned int mode)
if (break_time == 0)
break_time++;
}
error = locks_block_on_timeout(flock, new_fl, break_time);
locks_insert_block(flock, new_fl);
error = wait_event_interruptible_timeout(new_fl->fl_wait,
!new_fl->fl_next, break_time);
__locks_delete_block(new_fl);
if (error >= 0) {
if (error == 0)
time_out_leases(inode);
Expand Down

0 comments on commit 2d2ac1a

Please sign in to comment.