Lines Matching refs:flock
1035 __u8 type, struct file_lock *flock) in cifs_lock_test() argument
1046 flock->fl_flags, &conf_lock, in cifs_lock_test()
1049 flock->fl_start = conf_lock->offset; in cifs_lock_test()
1050 flock->fl_end = conf_lock->offset + conf_lock->length - 1; in cifs_lock_test()
1051 flock->fl_pid = conf_lock->pid; in cifs_lock_test()
1053 flock->fl_type = F_RDLCK; in cifs_lock_test()
1055 flock->fl_type = F_WRLCK; in cifs_lock_test()
1059 flock->fl_type = F_UNLCK; in cifs_lock_test()
1130 cifs_posix_lock_test(struct file *file, struct file_lock *flock) in cifs_posix_lock_test() argument
1134 unsigned char saved_type = flock->fl_type; in cifs_posix_lock_test()
1136 if ((flock->fl_flags & FL_POSIX) == 0) in cifs_posix_lock_test()
1140 posix_test_lock(file, flock); in cifs_posix_lock_test()
1142 if (flock->fl_type == F_UNLCK && !cinode->can_cache_brlcks) { in cifs_posix_lock_test()
1143 flock->fl_type = saved_type; in cifs_posix_lock_test()
1159 cifs_posix_lock_set(struct file *file, struct file_lock *flock) in cifs_posix_lock_set() argument
1164 if ((flock->fl_flags & FL_POSIX) == 0) in cifs_posix_lock_set()
1173 rc = posix_lock_file(file, flock, NULL); in cifs_posix_lock_set()
1275 struct file_lock *flock; in cifs_push_posix_locks() local
1312 list_for_each_entry(flock, &flctx->flc_posix, fl_list) { in cifs_push_posix_locks()
1321 length = 1 + flock->fl_end - flock->fl_start; in cifs_push_posix_locks()
1322 if (flock->fl_type == F_RDLCK || flock->fl_type == F_SHLCK) in cifs_push_posix_locks()
1327 lck->pid = hash_lockowner(flock->fl_owner); in cifs_push_posix_locks()
1331 lck->offset = flock->fl_start; in cifs_push_posix_locks()
1386 cifs_read_flock(struct file_lock *flock, __u32 *type, int *lock, int *unlock, in cifs_read_flock() argument
1389 if (flock->fl_flags & FL_POSIX) in cifs_read_flock()
1391 if (flock->fl_flags & FL_FLOCK) in cifs_read_flock()
1393 if (flock->fl_flags & FL_SLEEP) { in cifs_read_flock()
1397 if (flock->fl_flags & FL_ACCESS) in cifs_read_flock()
1399 if (flock->fl_flags & FL_LEASE) in cifs_read_flock()
1401 if (flock->fl_flags & in cifs_read_flock()
1404 cifs_dbg(FYI, "Unknown lock flags 0x%x\n", flock->fl_flags); in cifs_read_flock()
1407 if (flock->fl_type == F_WRLCK) { in cifs_read_flock()
1411 } else if (flock->fl_type == F_UNLCK) { in cifs_read_flock()
1416 } else if (flock->fl_type == F_RDLCK) { in cifs_read_flock()
1420 } else if (flock->fl_type == F_EXLCK) { in cifs_read_flock()
1424 } else if (flock->fl_type == F_SHLCK) { in cifs_read_flock()
1433 cifs_getlk(struct file *file, struct file_lock *flock, __u32 type, in cifs_getlk() argument
1437 __u64 length = 1 + flock->fl_end - flock->fl_start; in cifs_getlk()
1446 rc = cifs_posix_lock_test(file, flock); in cifs_getlk()
1455 hash_lockowner(flock->fl_owner), in cifs_getlk()
1456 flock->fl_start, length, flock, in cifs_getlk()
1461 rc = cifs_lock_test(cfile, flock->fl_start, length, type, flock); in cifs_getlk()
1466 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, type, in cifs_getlk()
1469 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1471 flock->fl_type = F_UNLCK; in cifs_getlk()
1479 flock->fl_type = F_WRLCK; in cifs_getlk()
1485 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1489 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1491 flock->fl_type = F_RDLCK; in cifs_getlk()
1496 flock->fl_type = F_WRLCK; in cifs_getlk()
1521 cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, in cifs_unlock_range() argument
1535 __u64 length = 1 + flock->fl_end - flock->fl_start; in cifs_unlock_range()
1563 if (flock->fl_start > li->offset || in cifs_unlock_range()
1564 (flock->fl_start + length) < in cifs_unlock_range()
1634 cifs_setlk(struct file *file, struct file_lock *flock, __u32 type, in cifs_setlk() argument
1639 __u64 length = 1 + flock->fl_end - flock->fl_start; in cifs_setlk()
1648 rc = cifs_posix_lock_set(file, flock); in cifs_setlk()
1661 hash_lockowner(flock->fl_owner), in cifs_setlk()
1662 flock->fl_start, length, in cifs_setlk()
1670 lock = cifs_lock_init(flock->fl_start, length, type, in cifs_setlk()
1671 flock->fl_flags); in cifs_setlk()
1698 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_setlk()
1707 rc = server->ops->mand_unlock_range(cfile, flock, xid); in cifs_setlk()
1710 if ((flock->fl_flags & FL_POSIX) || (flock->fl_flags & FL_FLOCK)) { in cifs_setlk()
1719 if (!(flock->fl_flags & FL_CLOSE)) in cifs_setlk()
1722 rc = locks_lock_file_wait(file, flock); in cifs_setlk()
1776 int cifs_lock(struct file *file, int cmd, struct file_lock *flock) in cifs_lock() argument
1791 cmd, flock->fl_flags, flock->fl_type, in cifs_lock()
1792 flock->fl_start, flock->fl_end); in cifs_lock()
1797 cifs_read_flock(flock, &type, &lock, &unlock, &wait_flag, in cifs_lock()
1810 rc = cifs_getlk(file, flock, type, wait_flag, posix_lck, xid); in cifs_lock()
1824 rc = cifs_setlk(file, flock, type, wait_flag, posix_lck, lock, unlock, in cifs_lock()