Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 29030
b: refs/heads/master
c: ff7b86b
h: refs/heads/master
v: v3
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed Jun 23, 2006
1 parent 5ffa01b commit db8ae09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 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: 39005d022ad221b76dc2de0ac62ef475a796433b
refs/heads/master: ff7b86b82083f24b8637dff1528c7101c18c7f39
25 changes: 5 additions & 20 deletions trunk/fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1896,15 +1896,14 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
*/
void locks_remove_posix(struct file *filp, fl_owner_t owner)
{
struct file_lock lock, **before;
struct file_lock lock;

/*
* If there are no locks held on this file, we don't need to call
* posix_lock_file(). Another process could be setting a lock on this
* file at the same time, but we wouldn't remove that lock anyway.
*/
before = &filp->f_dentry->d_inode->i_flock;
if (*before == NULL)
if (!filp->f_dentry->d_inode->i_flock)
return;

lock.fl_type = F_UNLCK;
Expand All @@ -1917,25 +1916,11 @@ void locks_remove_posix(struct file *filp, fl_owner_t owner)
lock.fl_ops = NULL;
lock.fl_lmops = NULL;

if (filp->f_op && filp->f_op->lock != NULL) {
if (filp->f_op && filp->f_op->lock != NULL)
filp->f_op->lock(filp, F_SETLK, &lock);
goto out;
}
else
posix_lock_file(filp, &lock);

/* Can't use posix_lock_file here; we need to remove it no matter
* which pid we have.
*/
lock_kernel();
while (*before != NULL) {
struct file_lock *fl = *before;
if (IS_POSIX(fl) && posix_same_owner(fl, &lock)) {
locks_delete_lock(before);
continue;
}
before = &fl->fl_next;
}
unlock_kernel();
out:
if (lock.fl_ops && lock.fl_ops->fl_release_private)
lock.fl_ops->fl_release_private(&lock);
}
Expand Down

0 comments on commit db8ae09

Please sign in to comment.