From: Yan, Zheng Date: Tue, 4 Mar 2014 07:50:06 +0000 (+0800) Subject: ceph: forbid mandatory file lock X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=eb70c0ce4e877c6854c682c0fc009d7875994942;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ceph: forbid mandatory file lock Signed-off-by: Yan, Zheng --- diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c index 133e0063da64..f91a569a20fb 100644 --- a/fs/ceph/locks.c +++ b/fs/ceph/locks.c @@ -87,6 +87,12 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl) u8 wait = 0; u16 op = CEPH_MDS_OP_SETFILELOCK; + if (!(fl->fl_flags & FL_POSIX)) + return -ENOLCK; + /* No mandatory locks */ + if (__mandatory_lock(file->f_mapping->host) && fl->fl_type != F_UNLCK) + return -ENOLCK; + fl->fl_nspid = get_pid(task_tgid(current)); dout("ceph_lock, fl_pid:%d", fl->fl_pid); @@ -133,6 +139,12 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl) int err; u8 wait = 0; + 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; + fl->fl_nspid = get_pid(task_tgid(current)); dout("ceph_flock, fl_pid:%d", fl->fl_pid);