Lines Matching refs:flock
1106 __u8 type, struct file_lock *flock) in cifs_lock_test() argument
1117 flock->fl_flags, &conf_lock, in cifs_lock_test()
1120 flock->fl_start = conf_lock->offset; in cifs_lock_test()
1121 flock->fl_end = conf_lock->offset + conf_lock->length - 1; in cifs_lock_test()
1122 flock->fl_pid = conf_lock->pid; in cifs_lock_test()
1124 flock->fl_type = F_RDLCK; in cifs_lock_test()
1126 flock->fl_type = F_WRLCK; in cifs_lock_test()
1130 flock->fl_type = F_UNLCK; in cifs_lock_test()
1201 cifs_posix_lock_test(struct file *file, struct file_lock *flock) in cifs_posix_lock_test() argument
1205 unsigned char saved_type = flock->fl_type; in cifs_posix_lock_test()
1207 if ((flock->fl_flags & FL_POSIX) == 0) in cifs_posix_lock_test()
1211 posix_test_lock(file, flock); in cifs_posix_lock_test()
1213 if (flock->fl_type == F_UNLCK && !cinode->can_cache_brlcks) { in cifs_posix_lock_test()
1214 flock->fl_type = saved_type; in cifs_posix_lock_test()
1230 cifs_posix_lock_set(struct file *file, struct file_lock *flock) in cifs_posix_lock_set() argument
1235 if ((flock->fl_flags & FL_POSIX) == 0) in cifs_posix_lock_set()
1244 rc = posix_lock_file(file, flock, NULL); in cifs_posix_lock_set()
1346 struct file_lock *flock; in cifs_push_posix_locks() local
1383 list_for_each_entry(flock, &flctx->flc_posix, fl_list) { in cifs_push_posix_locks()
1392 length = 1 + flock->fl_end - flock->fl_start; in cifs_push_posix_locks()
1393 if (flock->fl_type == F_RDLCK || flock->fl_type == F_SHLCK) in cifs_push_posix_locks()
1398 lck->pid = hash_lockowner(flock->fl_owner); in cifs_push_posix_locks()
1402 lck->offset = flock->fl_start; in cifs_push_posix_locks()
1457 cifs_read_flock(struct file_lock *flock, __u32 *type, int *lock, int *unlock, in cifs_read_flock() argument
1460 if (flock->fl_flags & FL_POSIX) in cifs_read_flock()
1462 if (flock->fl_flags & FL_FLOCK) in cifs_read_flock()
1464 if (flock->fl_flags & FL_SLEEP) { in cifs_read_flock()
1468 if (flock->fl_flags & FL_ACCESS) in cifs_read_flock()
1470 if (flock->fl_flags & FL_LEASE) in cifs_read_flock()
1472 if (flock->fl_flags & in cifs_read_flock()
1475 cifs_dbg(FYI, "Unknown lock flags 0x%x\n", flock->fl_flags); in cifs_read_flock()
1478 if (flock->fl_type == F_WRLCK) { in cifs_read_flock()
1482 } else if (flock->fl_type == F_UNLCK) { in cifs_read_flock()
1487 } else if (flock->fl_type == F_RDLCK) { in cifs_read_flock()
1491 } else if (flock->fl_type == F_EXLCK) { in cifs_read_flock()
1495 } else if (flock->fl_type == F_SHLCK) { in cifs_read_flock()
1504 cifs_getlk(struct file *file, struct file_lock *flock, __u32 type, in cifs_getlk() argument
1508 __u64 length = 1 + flock->fl_end - flock->fl_start; in cifs_getlk()
1517 rc = cifs_posix_lock_test(file, flock); in cifs_getlk()
1526 hash_lockowner(flock->fl_owner), in cifs_getlk()
1527 flock->fl_start, length, flock, in cifs_getlk()
1532 rc = cifs_lock_test(cfile, flock->fl_start, length, type, flock); in cifs_getlk()
1537 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, type, in cifs_getlk()
1540 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1542 flock->fl_type = F_UNLCK; in cifs_getlk()
1550 flock->fl_type = F_WRLCK; in cifs_getlk()
1556 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1560 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1562 flock->fl_type = F_RDLCK; in cifs_getlk()
1567 flock->fl_type = F_WRLCK; in cifs_getlk()
1592 cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, in cifs_unlock_range() argument
1606 __u64 length = 1 + flock->fl_end - flock->fl_start; in cifs_unlock_range()
1634 if (flock->fl_start > li->offset || in cifs_unlock_range()
1635 (flock->fl_start + length) < in cifs_unlock_range()
1705 cifs_setlk(struct file *file, struct file_lock *flock, __u32 type, in cifs_setlk() argument
1710 __u64 length = 1 + flock->fl_end - flock->fl_start; in cifs_setlk()
1719 rc = cifs_posix_lock_set(file, flock); in cifs_setlk()
1732 hash_lockowner(flock->fl_owner), in cifs_setlk()
1733 flock->fl_start, length, in cifs_setlk()
1741 lock = cifs_lock_init(flock->fl_start, length, type, in cifs_setlk()
1742 flock->fl_flags); in cifs_setlk()
1769 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_setlk()
1778 rc = server->ops->mand_unlock_range(cfile, flock, xid); in cifs_setlk()
1781 if ((flock->fl_flags & FL_POSIX) || (flock->fl_flags & FL_FLOCK)) { in cifs_setlk()
1790 if (!(flock->fl_flags & FL_CLOSE)) in cifs_setlk()
1793 rc = locks_lock_file_wait(file, flock); in cifs_setlk()
1844 int cifs_lock(struct file *file, int cmd, struct file_lock *flock) in cifs_lock() argument
1859 cmd, flock->fl_flags, flock->fl_type, in cifs_lock()
1860 flock->fl_start, flock->fl_end); in cifs_lock()
1865 cifs_read_flock(flock, &type, &lock, &unlock, &wait_flag, in cifs_lock()
1879 rc = cifs_getlk(file, flock, type, wait_flag, posix_lck, xid); in cifs_lock()
1893 rc = cifs_setlk(file, flock, type, wait_flag, posix_lck, lock, unlock, in cifs_lock()