Lines Matching refs:fl
39 static void ceph_fl_release_lock(struct file_lock *fl)
41 struct inode *inode = file_inode(fl->fl_file);
60 int cmd, u8 wait, struct file_lock *fl)
75 fl->fl_ops = &ceph_fl_lock_ops;
76 fl->fl_ops->fl_copy_lock(fl, NULL);
90 if (LLONG_MAX == fl->fl_end)
93 length = fl->fl_end - fl->fl_start + 1;
95 owner = secure_addr(fl->fl_owner);
99 (int)operation, owner, (u64)fl->fl_pid, fl->fl_start, length,
100 wait, fl->fl_type);
105 req->r_args.filelock_change.pid = cpu_to_le64((u64)fl->fl_pid);
106 req->r_args.filelock_change.start = cpu_to_le64(fl->fl_start);
115 fl->fl_pid = -le64_to_cpu(req->r_reply_info.filelock_reply->pid);
117 fl->fl_type = F_RDLCK;
119 fl->fl_type = F_WRLCK;
121 fl->fl_type = F_UNLCK;
123 fl->fl_start = le64_to_cpu(req->r_reply_info.filelock_reply->start);
127 fl->fl_end = length -1;
129 fl->fl_end = 0;
135 (int)operation, (u64)fl->fl_pid, fl->fl_start,
136 length, wait, fl->fl_type, err);
209 static int try_unlock_file(struct file *file, struct file_lock *fl)
212 unsigned int orig_flags = fl->fl_flags;
213 fl->fl_flags |= FL_EXISTS;
214 err = locks_lock_file_wait(file, fl);
215 fl->fl_flags = orig_flags;
228 int ceph_lock(struct file *file, int cmd, struct file_lock *fl)
237 if (!(fl->fl_flags & FL_POSIX))
240 if (__mandatory_lock(file->f_mapping->host) && fl->fl_type != F_UNLCK)
243 dout("ceph_lock, fl_owner: %p\n", fl->fl_owner);
257 if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK == fl->fl_type)
258 posix_lock_file(file, fl, NULL);
262 if (F_RDLCK == fl->fl_type)
264 else if (F_WRLCK == fl->fl_type)
269 if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK == fl->fl_type) {
270 err = try_unlock_file(file, fl);
275 err = ceph_lock_message(CEPH_LOCK_FCNTL, op, inode, lock_cmd, wait, fl);
277 if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK != fl->fl_type) {
279 err = posix_lock_file(file, fl, NULL);
285 CEPH_LOCK_UNLOCK, 0, fl);
294 int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
302 if (!(fl->fl_flags & FL_FLOCK))
305 if (fl->fl_type & LOCK_MAND)
308 dout("ceph_flock, fl_file: %p\n", fl->fl_file);
316 if (F_UNLCK == fl->fl_type)
317 locks_lock_file_wait(file, fl);
324 if (F_RDLCK == fl->fl_type)
326 else if (F_WRLCK == fl->fl_type)
331 if (F_UNLCK == fl->fl_type) {
332 err = try_unlock_file(file, fl);
338 inode, lock_cmd, wait, fl);
339 if (!err && F_UNLCK != fl->fl_type) {
340 err = locks_lock_file_wait(file, fl);
344 inode, CEPH_LOCK_UNLOCK, 0, fl);