Lines Matching refs:flock

897 	       __u8 type, struct file_lock *flock)  in cifs_lock_test()  argument
910 flock->fl_start = conf_lock->offset; in cifs_lock_test()
911 flock->fl_end = conf_lock->offset + conf_lock->length - 1; in cifs_lock_test()
912 flock->fl_pid = conf_lock->pid; in cifs_lock_test()
914 flock->fl_type = F_RDLCK; in cifs_lock_test()
916 flock->fl_type = F_WRLCK; in cifs_lock_test()
920 flock->fl_type = F_UNLCK; in cifs_lock_test()
990 cifs_posix_lock_test(struct file *file, struct file_lock *flock) in cifs_posix_lock_test() argument
994 unsigned char saved_type = flock->fl_type; in cifs_posix_lock_test()
996 if ((flock->fl_flags & FL_POSIX) == 0) in cifs_posix_lock_test()
1000 posix_test_lock(file, flock); in cifs_posix_lock_test()
1002 if (flock->fl_type == F_UNLCK && !cinode->can_cache_brlcks) { in cifs_posix_lock_test()
1003 flock->fl_type = saved_type; in cifs_posix_lock_test()
1018 cifs_posix_lock_set(struct file *file, struct file_lock *flock) in cifs_posix_lock_set() argument
1023 if ((flock->fl_flags & FL_POSIX) == 0) in cifs_posix_lock_set()
1033 rc = posix_lock_file(file, flock, NULL); in cifs_posix_lock_set()
1036 rc = wait_event_interruptible(flock->fl_wait, !flock->fl_next); in cifs_posix_lock_set()
1039 posix_unblock_lock(flock); in cifs_posix_lock_set()
1129 struct file_lock *flock; in cifs_push_posix_locks() local
1166 list_for_each_entry(flock, &flctx->flc_posix, fl_list) { in cifs_push_posix_locks()
1175 length = 1 + flock->fl_end - flock->fl_start; in cifs_push_posix_locks()
1176 if (flock->fl_type == F_RDLCK || flock->fl_type == F_SHLCK) in cifs_push_posix_locks()
1181 lck->pid = flock->fl_pid; in cifs_push_posix_locks()
1185 lck->offset = flock->fl_start; in cifs_push_posix_locks()
1240 cifs_read_flock(struct file_lock *flock, __u32 *type, int *lock, int *unlock, in cifs_read_flock() argument
1243 if (flock->fl_flags & FL_POSIX) in cifs_read_flock()
1245 if (flock->fl_flags & FL_FLOCK) in cifs_read_flock()
1247 if (flock->fl_flags & FL_SLEEP) { in cifs_read_flock()
1251 if (flock->fl_flags & FL_ACCESS) in cifs_read_flock()
1253 if (flock->fl_flags & FL_LEASE) in cifs_read_flock()
1255 if (flock->fl_flags & in cifs_read_flock()
1258 cifs_dbg(FYI, "Unknown lock flags 0x%x\n", flock->fl_flags); in cifs_read_flock()
1261 if (flock->fl_type == F_WRLCK) { in cifs_read_flock()
1265 } else if (flock->fl_type == F_UNLCK) { in cifs_read_flock()
1270 } else if (flock->fl_type == F_RDLCK) { in cifs_read_flock()
1274 } else if (flock->fl_type == F_EXLCK) { in cifs_read_flock()
1278 } else if (flock->fl_type == F_SHLCK) { in cifs_read_flock()
1287 cifs_getlk(struct file *file, struct file_lock *flock, __u32 type, in cifs_getlk() argument
1291 __u64 length = 1 + flock->fl_end - flock->fl_start; in cifs_getlk()
1300 rc = cifs_posix_lock_test(file, flock); in cifs_getlk()
1309 flock->fl_start, length, flock, in cifs_getlk()
1314 rc = cifs_lock_test(cfile, flock->fl_start, length, type, flock); in cifs_getlk()
1319 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, type, in cifs_getlk()
1322 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1324 flock->fl_type = F_UNLCK; in cifs_getlk()
1332 flock->fl_type = F_WRLCK; in cifs_getlk()
1338 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1342 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1344 flock->fl_type = F_RDLCK; in cifs_getlk()
1349 flock->fl_type = F_WRLCK; in cifs_getlk()
1374 cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, in cifs_unlock_range() argument
1386 __u64 length = 1 + flock->fl_end - flock->fl_start; in cifs_unlock_range()
1410 if (flock->fl_start > li->offset || in cifs_unlock_range()
1411 (flock->fl_start + length) < in cifs_unlock_range()
1481 cifs_setlk(struct file *file, struct file_lock *flock, __u32 type, in cifs_setlk() argument
1486 __u64 length = 1 + flock->fl_end - flock->fl_start; in cifs_setlk()
1495 rc = cifs_posix_lock_set(file, flock); in cifs_setlk()
1508 current->tgid, flock->fl_start, length, in cifs_setlk()
1516 lock = cifs_lock_init(flock->fl_start, length, type); in cifs_setlk()
1543 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_setlk()
1552 rc = server->ops->mand_unlock_range(cfile, flock, xid); in cifs_setlk()
1555 if (flock->fl_flags & FL_POSIX && !rc) in cifs_setlk()
1556 rc = locks_lock_file_wait(file, flock); in cifs_setlk()
1560 int cifs_lock(struct file *file, int cmd, struct file_lock *flock) in cifs_lock() argument
1577 cmd, flock->fl_flags, flock->fl_type, in cifs_lock()
1578 flock->fl_start, flock->fl_end); in cifs_lock()
1583 cifs_read_flock(flock, &type, &lock, &unlock, &wait_flag, in cifs_lock()
1599 rc = cifs_getlk(file, flock, type, wait_flag, posix_lck, xid); in cifs_lock()
1613 rc = cifs_setlk(file, flock, type, wait_flag, posix_lck, lock, unlock, in cifs_lock()