From db8ae0928c492ed13eaef658168a98da0b450af8 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Fri, 23 Jun 2006 02:05:11 -0700 Subject: [PATCH] --- yaml --- r: 29030 b: refs/heads/master c: ff7b86b82083f24b8637dff1528c7101c18c7f39 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/locks.c | 25 +++++-------------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/[refs] b/[refs] index f2243106ab2b..e627935bcc8b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 39005d022ad221b76dc2de0ac62ef475a796433b +refs/heads/master: ff7b86b82083f24b8637dff1528c7101c18c7f39 diff --git a/trunk/fs/locks.c b/trunk/fs/locks.c index 2344f241c687..e588e1c265f7 100644 --- a/trunk/fs/locks.c +++ b/trunk/fs/locks.c @@ -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; @@ -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); }