Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy...
[sfrench/cifs-2.6.git] / fs / locks.c
index 671a034dc999fffdf88856401694fda0cef87147..431a8b871fcef03ea098f8d8ac8f8602a2d33f66 100644 (file)
@@ -203,9 +203,6 @@ static void init_once(void *foo, struct kmem_cache *cache, unsigned long flags)
 {
        struct file_lock *lock = (struct file_lock *) foo;
 
-       if (!(flags & SLAB_CTOR_CONSTRUCTOR))
-               return;
-
        locks_init_lock(lock);
 }
 
@@ -669,7 +666,6 @@ posix_test_lock(struct file *filp, struct file_lock *fl)
 {
        struct file_lock *cfl;
 
-       fl->fl_type = F_UNLCK;
        lock_kernel();
        for (cfl = filp->f_path.dentry->d_inode->i_flock; cfl; cfl = cfl->fl_next) {
                if (!IS_POSIX(cfl))
@@ -681,7 +677,8 @@ posix_test_lock(struct file *filp, struct file_lock *fl)
                __locks_copy_lock(fl, cfl);
                unlock_kernel();
                return 1;
-       }
+       } else
+               fl->fl_type = F_UNLCK;
        unlock_kernel();
        return 0;
 }
@@ -1632,6 +1629,7 @@ static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl)
        flock->l_len = fl->fl_end == OFFSET_MAX ? 0 :
                fl->fl_end - fl->fl_start + 1;
        flock->l_whence = 0;
+       flock->l_type = fl->fl_type;
        return 0;
 }