Lines Matching refs:flock
1034 __u8 type, struct file_lock *flock) in cifs_lock_test() argument
1045 flock->fl_flags, &conf_lock, in cifs_lock_test()
1048 flock->fl_start = conf_lock->offset; in cifs_lock_test()
1049 flock->fl_end = conf_lock->offset + conf_lock->length - 1; in cifs_lock_test()
1050 flock->fl_pid = conf_lock->pid; in cifs_lock_test()
1052 flock->fl_type = F_RDLCK; in cifs_lock_test()
1054 flock->fl_type = F_WRLCK; in cifs_lock_test()
1058 flock->fl_type = F_UNLCK; in cifs_lock_test()
1129 cifs_posix_lock_test(struct file *file, struct file_lock *flock) in cifs_posix_lock_test() argument
1133 unsigned char saved_type = flock->fl_type; in cifs_posix_lock_test()
1135 if ((flock->fl_flags & FL_POSIX) == 0) in cifs_posix_lock_test()
1139 posix_test_lock(file, flock); in cifs_posix_lock_test()
1141 if (flock->fl_type == F_UNLCK && !cinode->can_cache_brlcks) { in cifs_posix_lock_test()
1142 flock->fl_type = saved_type; in cifs_posix_lock_test()
1158 cifs_posix_lock_set(struct file *file, struct file_lock *flock) in cifs_posix_lock_set() argument
1163 if ((flock->fl_flags & FL_POSIX) == 0) in cifs_posix_lock_set()
1172 rc = posix_lock_file(file, flock, NULL); in cifs_posix_lock_set()
1274 struct file_lock *flock; in cifs_push_posix_locks() local
1311 list_for_each_entry(flock, &flctx->flc_posix, fl_list) { in cifs_push_posix_locks()
1320 length = 1 + flock->fl_end - flock->fl_start; in cifs_push_posix_locks()
1321 if (flock->fl_type == F_RDLCK || flock->fl_type == F_SHLCK) in cifs_push_posix_locks()
1326 lck->pid = hash_lockowner(flock->fl_owner); in cifs_push_posix_locks()
1330 lck->offset = flock->fl_start; in cifs_push_posix_locks()
1385 cifs_read_flock(struct file_lock *flock, __u32 *type, int *lock, int *unlock, in cifs_read_flock() argument
1388 if (flock->fl_flags & FL_POSIX) in cifs_read_flock()
1390 if (flock->fl_flags & FL_FLOCK) in cifs_read_flock()
1392 if (flock->fl_flags & FL_SLEEP) { in cifs_read_flock()
1396 if (flock->fl_flags & FL_ACCESS) in cifs_read_flock()
1398 if (flock->fl_flags & FL_LEASE) in cifs_read_flock()
1400 if (flock->fl_flags & in cifs_read_flock()
1403 cifs_dbg(FYI, "Unknown lock flags 0x%x\n", flock->fl_flags); in cifs_read_flock()
1406 if (flock->fl_type == F_WRLCK) { in cifs_read_flock()
1410 } else if (flock->fl_type == F_UNLCK) { in cifs_read_flock()
1415 } else if (flock->fl_type == F_RDLCK) { in cifs_read_flock()
1419 } else if (flock->fl_type == F_EXLCK) { in cifs_read_flock()
1423 } else if (flock->fl_type == F_SHLCK) { in cifs_read_flock()
1432 cifs_getlk(struct file *file, struct file_lock *flock, __u32 type, in cifs_getlk() argument
1436 __u64 length = 1 + flock->fl_end - flock->fl_start; in cifs_getlk()
1445 rc = cifs_posix_lock_test(file, flock); in cifs_getlk()
1454 hash_lockowner(flock->fl_owner), in cifs_getlk()
1455 flock->fl_start, length, flock, in cifs_getlk()
1460 rc = cifs_lock_test(cfile, flock->fl_start, length, type, flock); in cifs_getlk()
1465 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, type, in cifs_getlk()
1468 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1470 flock->fl_type = F_UNLCK; in cifs_getlk()
1478 flock->fl_type = F_WRLCK; in cifs_getlk()
1484 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1488 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1490 flock->fl_type = F_RDLCK; in cifs_getlk()
1495 flock->fl_type = F_WRLCK; in cifs_getlk()
1520 cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, in cifs_unlock_range() argument
1534 __u64 length = 1 + flock->fl_end - flock->fl_start; in cifs_unlock_range()
1562 if (flock->fl_start > li->offset || in cifs_unlock_range()
1563 (flock->fl_start + length) < in cifs_unlock_range()
1633 cifs_setlk(struct file *file, struct file_lock *flock, __u32 type, in cifs_setlk() argument
1638 __u64 length = 1 + flock->fl_end - flock->fl_start; in cifs_setlk()
1647 rc = cifs_posix_lock_set(file, flock); in cifs_setlk()
1660 hash_lockowner(flock->fl_owner), in cifs_setlk()
1661 flock->fl_start, length, in cifs_setlk()
1669 lock = cifs_lock_init(flock->fl_start, length, type, in cifs_setlk()
1670 flock->fl_flags); in cifs_setlk()
1697 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_setlk()
1706 rc = server->ops->mand_unlock_range(cfile, flock, xid); in cifs_setlk()
1709 if ((flock->fl_flags & FL_POSIX) || (flock->fl_flags & FL_FLOCK)) { in cifs_setlk()
1718 if (!(flock->fl_flags & FL_CLOSE)) in cifs_setlk()
1721 rc = locks_lock_file_wait(file, flock); in cifs_setlk()
1772 int cifs_lock(struct file *file, int cmd, struct file_lock *flock) in cifs_lock() argument
1787 cmd, flock->fl_flags, flock->fl_type, in cifs_lock()
1788 flock->fl_start, flock->fl_end); in cifs_lock()
1793 cifs_read_flock(flock, &type, &lock, &unlock, &wait_flag, in cifs_lock()
1806 rc = cifs_getlk(file, flock, type, wait_flag, posix_lck, xid); in cifs_lock()
1820 rc = cifs_setlk(file, flock, type, wait_flag, posix_lck, lock, unlock, in cifs_lock()