ceph: fix mandatory flock check
authorYan, Zheng <zyan@redhat.com>
Tue, 13 Sep 2016 02:15:36 +0000 (10:15 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 3 Oct 2016 14:13:49 +0000 (16:13 +0200)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
fs/ceph/locks.c

index a2cb0c2..6806dbe 100644 (file)
@@ -210,8 +210,8 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
        if (!(fl->fl_flags & FL_FLOCK))
                return -ENOLCK;
        /* No mandatory locks */
-       if (__mandatory_lock(file->f_mapping->host) && fl->fl_type != F_UNLCK)
-               return -ENOLCK;
+       if (fl->fl_type & LOCK_MAND)
+               return -EOPNOTSUPP;
 
        dout("ceph_flock, fl_file: %p", fl->fl_file);