Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 29028
b: refs/heads/master
c: 0d9a490
h: refs/heads/master
v: v3
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed Jun 23, 2006
1 parent b223fcf commit e5f0470
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 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: 090d2b185d8680fc26a2eaf4245d4171dcf4baf1
refs/heads/master: 0d9a490abe1f69fda220f7866f6f23af41daa128
22 changes: 15 additions & 7 deletions trunk/fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,14 +834,7 @@ static int __posix_lock_file_conf(struct inode *inode, struct file_lock *request
if (request->fl_flags & FL_ACCESS)
goto out;

error = -ENOLCK; /* "no luck" */
if (!(new_fl && new_fl2))
goto out;

/*
* We've allocated the new locks in advance, so there are no
* errors possible (and no blocking operations) from here on.
*
* Find the first old lock with the same owner as the new lock.
*/

Expand Down Expand Up @@ -938,10 +931,25 @@ static int __posix_lock_file_conf(struct inode *inode, struct file_lock *request
before = &fl->fl_next;
}

/*
* The above code only modifies existing locks in case of
* merging or replacing. If new lock(s) need to be inserted
* all modifications are done bellow this, so it's safe yet to
* bail out.
*/
error = -ENOLCK; /* "no luck" */
if (right && left == right && !new_fl2)
goto out;

error = 0;
if (!added) {
if (request->fl_type == F_UNLCK)
goto out;

if (!new_fl) {
error = -ENOLCK;
goto out;
}
locks_copy_lock(new_fl, request);
locks_insert_lock(before, new_fl);
new_fl = NULL;
Expand Down

0 comments on commit e5f0470

Please sign in to comment.