Skip to content

Commit eb70c0c

Browse files
Yan, ZhengSage Weil
authored andcommitted
ceph: forbid mandatory file lock
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
1 parent 0e8e95d commit eb70c0c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎fs/ceph/locks.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl)
8787
u8 wait = 0;
8888
u16 op = CEPH_MDS_OP_SETFILELOCK;
8989

90+
if (!(fl->fl_flags & FL_POSIX))
91+
return -ENOLCK;
92+
/* No mandatory locks */
93+
if (__mandatory_lock(file->f_mapping->host) && fl->fl_type != F_UNLCK)
94+
return -ENOLCK;
95+
9096
fl->fl_nspid = get_pid(task_tgid(current));
9197
dout("ceph_lock, fl_pid:%d", fl->fl_pid);
9298

@@ -133,6 +139,12 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
133139
int err;
134140
u8 wait = 0;
135141

142+
if (!(fl->fl_flags & FL_FLOCK))
143+
return -ENOLCK;
144+
/* No mandatory locks */
145+
if (__mandatory_lock(file->f_mapping->host) && fl->fl_type != F_UNLCK)
146+
return -ENOLCK;
147+
136148
fl->fl_nspid = get_pid(task_tgid(current));
137149
dout("ceph_flock, fl_pid:%d", fl->fl_pid);
138150

0 commit comments

Comments
 (0)