Commit eb70c0ce authored by Yan, Zheng's avatar Yan, Zheng Committed by Sage Weil

ceph: forbid mandatory file lock

Signed-off-by: default avatarYan, Zheng <zheng.z.yan@intel.com>
parent 0e8e95d6
...@@ -87,6 +87,12 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl) ...@@ -87,6 +87,12 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl)
u8 wait = 0; u8 wait = 0;
u16 op = CEPH_MDS_OP_SETFILELOCK; 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)); fl->fl_nspid = get_pid(task_tgid(current));
dout("ceph_lock, fl_pid:%d", fl->fl_pid); 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) ...@@ -133,6 +139,12 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
int err; int err;
u8 wait = 0; 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)); fl->fl_nspid = get_pid(task_tgid(current));
dout("ceph_flock, fl_pid:%d", fl->fl_pid); dout("ceph_flock, fl_pid:%d", fl->fl_pid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment