Lines Matching defs:flock

1390  * style). If such a lock exists, update the flock structure with its
1391 * properties. Otherwise, set the flock type to F_UNLCK if we can cache brlocks
1397 __u8 type, struct file_lock *flock)
1408 flock->c.flc_flags, &conf_lock,
1411 flock->fl_start = conf_lock->offset;
1412 flock->fl_end = conf_lock->offset + conf_lock->length - 1;
1413 flock->c.flc_pid = conf_lock->pid;
1415 flock->c.flc_type = F_RDLCK;
1417 flock->c.flc_type = F_WRLCK;
1421 flock->c.flc_type = F_UNLCK;
1487 * style). If such a lock exists, update the flock structure with its
1488 * properties. Otherwise, set the flock type to F_UNLCK if we can cache brlocks
1493 cifs_posix_lock_test(struct file *file, struct file_lock *flock)
1497 unsigned char saved_type = flock->c.flc_type;
1499 if ((flock->c.flc_flags & FL_POSIX) == 0)
1503 posix_test_lock(file, flock);
1505 if (lock_is_unlock(flock) && !cinode->can_cache_brlcks) {
1506 flock->c.flc_type = saved_type;
1522 cifs_posix_lock_set(struct file *file, struct file_lock *flock)
1527 if ((flock->c.flc_flags & FL_POSIX) == 0)
1536 rc = posix_lock_file(file, flock, NULL);
1640 struct file_lock *flock;
1677 for_each_file_lock(flock, &flctx->flc_posix) {
1678 unsigned char ftype = flock->c.flc_type;
1688 length = cifs_flock_len(flock);
1694 lck->pid = hash_lockowner(flock->c.flc_owner);
1698 lck->offset = flock->fl_start;
1758 cifs_read_flock(struct file_lock *flock, __u32 *type, int *lock, int *unlock,
1761 if (flock->c.flc_flags & FL_POSIX)
1763 if (flock->c.flc_flags & FL_FLOCK)
1765 if (flock->c.flc_flags & FL_SLEEP) {
1769 if (flock->c.flc_flags & FL_ACCESS)
1771 if (flock->c.flc_flags & FL_LEASE)
1773 if (flock->c.flc_flags &
1777 flock->c.flc_flags);
1780 if (lock_is_write(flock)) {
1784 } else if (lock_is_unlock(flock)) {
1789 } else if (lock_is_read(flock)) {
1793 } else if (flock->c.flc_type == F_EXLCK) {
1797 } else if (flock->c.flc_type == F_SHLCK) {
1806 cifs_getlk(struct file *file, struct file_lock *flock, __u32 type,
1810 __u64 length = cifs_flock_len(flock);
1820 rc = cifs_posix_lock_test(file, flock);
1829 hash_lockowner(flock->c.flc_owner),
1830 flock->fl_start, length, flock,
1836 rc = cifs_lock_test(cfile, flock->fl_start, length, type, flock);
1841 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, type,
1844 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length,
1846 flock->c.flc_type = F_UNLCK;
1854 flock->c.flc_type = F_WRLCK;
1860 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length,
1864 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length,
1866 flock->c.flc_type = F_RDLCK;
1871 flock->c.flc_type = F_WRLCK;
1897 cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
1911 __u64 length = cifs_flock_len(flock);
1939 if (flock->fl_start > li->offset ||
1940 (flock->fl_start + length) <
2011 cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
2016 __u64 length = cifs_flock_len(flock);
2026 rc = cifs_posix_lock_set(file, flock);
2039 hash_lockowner(flock->c.flc_owner),
2040 flock->fl_start, length,
2048 lock = cifs_lock_init(flock->fl_start, length, type,
2049 flock->c.flc_flags);
2076 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length,
2085 rc = server->ops->mand_unlock_range(cfile, flock, xid);
2088 if ((flock->c.flc_flags & FL_POSIX) || (flock->c.flc_flags & FL_FLOCK)) {
2097 if (!(flock->c.flc_flags & FL_CLOSE))
2100 rc = locks_lock_file_wait(file, flock);
2154 int cifs_lock(struct file *file, int cmd, struct file_lock *flock)
2169 flock->c.flc_flags, flock->c.flc_type,
2170 (long long)flock->fl_start,
2171 (long long)flock->fl_end);
2176 cifs_read_flock(flock, &type, &lock, &unlock, &wait_flag,
2190 rc = cifs_getlk(file, flock, type, wait_flag, posix_lck, xid);
2204 rc = cifs_setlk(file, flock, type, wait_flag, posix_lck, lock, unlock,