Lines Matching refs:flock
6756 static int smb2_set_flock_flags(struct file_lock *flock, int flags) in smb2_set_flock_flags() argument
6765 flock->fl_type = F_RDLCK; in smb2_set_flock_flags()
6766 flock->fl_flags |= FL_SLEEP; in smb2_set_flock_flags()
6771 flock->fl_type = F_WRLCK; in smb2_set_flock_flags()
6772 flock->fl_flags |= FL_SLEEP; in smb2_set_flock_flags()
6778 flock->fl_type = F_RDLCK; in smb2_set_flock_flags()
6784 flock->fl_type = F_WRLCK; in smb2_set_flock_flags()
6788 flock->fl_type = F_UNLCK; in smb2_set_flock_flags()
6796 static struct ksmbd_lock *smb2_lock_init(struct file_lock *flock, in smb2_lock_init() argument
6807 lock->fl = flock; in smb2_lock_init()
6808 lock->start = flock->fl_start; in smb2_lock_init()
6809 lock->end = flock->fl_end; in smb2_lock_init()
6823 struct file_lock *flock = (struct file_lock *)argv[0]; in smb2_remove_blocked_lock() local
6825 ksmbd_vfs_posix_lock_unblock(flock); in smb2_remove_blocked_lock()
6826 wake_up(&flock->fl_wait); in smb2_remove_blocked_lock()
6847 struct file_lock *flock = NULL; in smb2_lock() local
6884 flock = smb_flock_init(filp); in smb2_lock()
6885 if (!flock) in smb2_lock()
6888 cmd = smb2_set_flock_flags(flock, flags); in smb2_lock()
6895 locks_free_lock(flock); in smb2_lock()
6900 flock->fl_start = OFFSET_MAX; in smb2_lock()
6902 flock->fl_start = lock_start; in smb2_lock()
6905 if (lock_length > OFFSET_MAX - flock->fl_start) in smb2_lock()
6906 lock_length = OFFSET_MAX - flock->fl_start; in smb2_lock()
6908 flock->fl_end = flock->fl_start + lock_length; in smb2_lock()
6910 if (flock->fl_end < flock->fl_start) { in smb2_lock()
6913 flock->fl_end, flock->fl_start); in smb2_lock()
6915 locks_free_lock(flock); in smb2_lock()
6921 if (cmp_lock->fl->fl_start <= flock->fl_start && in smb2_lock()
6922 cmp_lock->fl->fl_end >= flock->fl_end) { in smb2_lock()
6924 flock->fl_type != F_UNLCK) { in smb2_lock()
6927 locks_free_lock(flock); in smb2_lock()
6933 smb_lock = smb2_lock_init(flock, cmd, flags, &lock_list); in smb2_lock()
6936 locks_free_lock(flock); in smb2_lock()
7048 flock = smb_lock->fl; in smb2_lock()
7051 rc = vfs_lock_file(filp, smb_lock->cmd, flock, NULL); in smb2_lock()
7060 locks_free_lock(flock); in smb2_lock()
7075 argv[0] = flock; in smb2_lock()
7090 ksmbd_vfs_posix_lock_wait(flock); in smb2_lock()
7098 locks_free_lock(flock); in smb2_lock()