]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/locks.c
nfs: disintegrate UAPI for nfs
[karo-tx-linux.git] / fs / locks.c
index 82c353304f9eeccab27b01b86379441df323deeb..a94e331a52a2febbf46a4df702156c1a013b2990 100644 (file)
@@ -200,11 +200,7 @@ void locks_release_private(struct file_lock *fl)
                        fl->fl_ops->fl_release_private(fl);
                fl->fl_ops = NULL;
        }
-       if (fl->fl_lmops) {
-               if (fl->fl_lmops->lm_release_private)
-                       fl->fl_lmops->lm_release_private(fl);
-               fl->fl_lmops = NULL;
-       }
+       fl->fl_lmops = NULL;
 
 }
 EXPORT_SYMBOL_GPL(locks_release_private);
@@ -427,18 +423,8 @@ static void lease_break_callback(struct file_lock *fl)
        kill_fasync(&fl->fl_fasync, SIGIO, POLL_MSG);
 }
 
-static void lease_release_private_callback(struct file_lock *fl)
-{
-       if (!fl->fl_file)
-               return;
-
-       f_delown(fl->fl_file);
-       fl->fl_file->f_owner.signum = 0;
-}
-
 static const struct lock_manager_operations lease_manager_ops = {
        .lm_break = lease_break_callback,
-       .lm_release_private = lease_release_private_callback,
        .lm_change = lease_modify,
 };
 
@@ -580,12 +566,6 @@ static void locks_delete_lock(struct file_lock **thisfl_p)
        fl->fl_next = NULL;
        list_del_init(&fl->fl_link);
 
-       fasync_helper(0, fl->fl_file, 0, &fl->fl_fasync);
-       if (fl->fl_fasync != NULL) {
-               printk(KERN_ERR "locks_delete_lock: fasync == %p\n", fl->fl_fasync);
-               fl->fl_fasync = NULL;
-       }
-
        if (fl->fl_nspid) {
                put_pid(fl->fl_nspid);
                fl->fl_nspid = NULL;
@@ -1155,8 +1135,18 @@ int lease_modify(struct file_lock **before, int arg)
                return error;
        lease_clear_pending(fl, arg);
        locks_wake_up_blocks(fl);
-       if (arg == F_UNLCK)
+       if (arg == F_UNLCK) {
+               struct file *filp = fl->fl_file;
+
+               f_delown(filp);
+               filp->f_owner.signum = 0;
+               fasync_helper(0, fl->fl_file, 0, &fl->fl_fasync);
+               if (fl->fl_fasync != NULL) {
+                       printk(KERN_ERR "locks_delete_lock: fasync == %p\n", fl->fl_fasync);
+                       fl->fl_fasync = NULL;
+               }
                locks_delete_lock(before);
+       }
        return 0;
 }
 
@@ -1299,7 +1289,7 @@ EXPORT_SYMBOL(__break_lease);
 void lease_get_mtime(struct inode *inode, struct timespec *time)
 {
        struct file_lock *flock = inode->i_flock;
-       if (flock && IS_LEASE(flock) && (flock->fl_type & F_WRLCK))
+       if (flock && IS_LEASE(flock) && (flock->fl_type == F_WRLCK))
                *time = current_fs_time(inode->i_sb);
        else
                *time = inode->i_mtime;
@@ -1635,15 +1625,13 @@ EXPORT_SYMBOL(flock_lock_file_wait);
  */
 SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
 {
-       struct file *filp;
-       int fput_needed;
+       struct fd f = fdget(fd);
        struct file_lock *lock;
        int can_sleep, unlock;
        int error;
 
        error = -EBADF;
-       filp = fget_light(fd, &fput_needed);
-       if (!filp)
+       if (!f.file)
                goto out;
 
        can_sleep = !(cmd & LOCK_NB);
@@ -1651,31 +1639,31 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
        unlock = (cmd == LOCK_UN);
 
        if (!unlock && !(cmd & LOCK_MAND) &&
-           !(filp->f_mode & (FMODE_READ|FMODE_WRITE)))
+           !(f.file->f_mode & (FMODE_READ|FMODE_WRITE)))
                goto out_putf;
 
-       error = flock_make_lock(filp, &lock, cmd);
+       error = flock_make_lock(f.file, &lock, cmd);
        if (error)
                goto out_putf;
        if (can_sleep)
                lock->fl_flags |= FL_SLEEP;
 
-       error = security_file_lock(filp, lock->fl_type);
+       error = security_file_lock(f.file, lock->fl_type);
        if (error)
                goto out_free;
 
-       if (filp->f_op && filp->f_op->flock)
-               error = filp->f_op->flock(filp,
+       if (f.file->f_op && f.file->f_op->flock)
+               error = f.file->f_op->flock(f.file,
                                          (can_sleep) ? F_SETLKW : F_SETLK,
                                          lock);
        else
-               error = flock_lock_file_wait(filp, lock);
+               error = flock_lock_file_wait(f.file, lock);
 
  out_free:
        locks_free_lock(lock);
 
  out_putf:
-       fput_light(filp, fput_needed);
+       fdput(f);
  out:
        return error;
 }
@@ -2197,8 +2185,8 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
        } else {
                seq_printf(f, "%s ",
                               (lease_breaking(fl))
-                              ? (fl->fl_type & F_UNLCK) ? "UNLCK" : "READ "
-                              : (fl->fl_type & F_WRLCK) ? "WRITE" : "READ ");
+                              ? (fl->fl_type == F_UNLCK) ? "UNLCK" : "READ "
+                              : (fl->fl_type == F_WRLCK) ? "WRITE" : "READ ");
        }
        if (inode) {
 #ifdef WE_CAN_BREAK_LSLK_NOW