Lines Matching refs:fl

30 static void	nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *host);
124 static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl) in nlmclnt_setlockargs() argument
131 memcpy(&lock->fh, NFS_FH(locks_inode(fl->fl_file)), sizeof(struct nfs_fh)); in nlmclnt_setlockargs()
135 (unsigned int)fl->fl_u.nfs_fl.owner->pid, in nlmclnt_setlockargs()
137 lock->svid = fl->fl_u.nfs_fl.owner->pid; in nlmclnt_setlockargs()
138 lock->fl.fl_start = fl->fl_start; in nlmclnt_setlockargs()
139 lock->fl.fl_end = fl->fl_end; in nlmclnt_setlockargs()
140 lock->fl.fl_type = fl->fl_type; in nlmclnt_setlockargs()
145 WARN_ON_ONCE(req->a_args.lock.fl.fl_ops != NULL); in nlmclnt_release_lockargs()
156 int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data) in nlmclnt_proc() argument
169 nlmclnt_locks_init_private(fl, host); in nlmclnt_proc()
170 if (!fl->fl_u.nfs_fl.owner) { in nlmclnt_proc()
176 nlmclnt_setlockargs(call, fl); in nlmclnt_proc()
180 if (fl->fl_type != F_UNLCK) { in nlmclnt_proc()
182 status = nlmclnt_lock(call, fl); in nlmclnt_proc()
184 status = nlmclnt_unlock(call, fl); in nlmclnt_proc()
186 status = nlmclnt_test(call, fl); in nlmclnt_proc()
189 fl->fl_ops->fl_release_private(fl); in nlmclnt_proc()
190 fl->fl_ops = NULL; in nlmclnt_proc()
208 locks_init_lock(&call->a_args.lock.fl); in nlm_alloc_call()
209 locks_init_lock(&call->a_res.lock.fl); in nlm_alloc_call()
426 nlmclnt_test(struct nlm_rqst *req, struct file_lock *fl) in nlmclnt_test() argument
430 status = nlmclnt_call(nfs_file_cred(fl->fl_file), req, NLMPROC_TEST); in nlmclnt_test()
436 fl->fl_type = F_UNLCK; in nlmclnt_test()
442 fl->fl_start = req->a_res.lock.fl.fl_start; in nlmclnt_test()
443 fl->fl_end = req->a_res.lock.fl.fl_end; in nlmclnt_test()
444 fl->fl_type = req->a_res.lock.fl.fl_type; in nlmclnt_test()
445 fl->fl_pid = 0; in nlmclnt_test()
455 static void nlmclnt_locks_copy_lock(struct file_lock *new, struct file_lock *fl) in nlmclnt_locks_copy_lock() argument
457 spin_lock(&fl->fl_u.nfs_fl.owner->host->h_lock); in nlmclnt_locks_copy_lock()
458 new->fl_u.nfs_fl.state = fl->fl_u.nfs_fl.state; in nlmclnt_locks_copy_lock()
459 new->fl_u.nfs_fl.owner = nlm_get_lockowner(fl->fl_u.nfs_fl.owner); in nlmclnt_locks_copy_lock()
460 list_add_tail(&new->fl_u.nfs_fl.list, &fl->fl_u.nfs_fl.owner->host->h_granted); in nlmclnt_locks_copy_lock()
461 spin_unlock(&fl->fl_u.nfs_fl.owner->host->h_lock); in nlmclnt_locks_copy_lock()
464 static void nlmclnt_locks_release_private(struct file_lock *fl) in nlmclnt_locks_release_private() argument
466 spin_lock(&fl->fl_u.nfs_fl.owner->host->h_lock); in nlmclnt_locks_release_private()
467 list_del(&fl->fl_u.nfs_fl.list); in nlmclnt_locks_release_private()
468 spin_unlock(&fl->fl_u.nfs_fl.owner->host->h_lock); in nlmclnt_locks_release_private()
469 nlm_put_lockowner(fl->fl_u.nfs_fl.owner); in nlmclnt_locks_release_private()
477 static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *host) in nlmclnt_locks_init_private() argument
479 fl->fl_u.nfs_fl.state = 0; in nlmclnt_locks_init_private()
480 fl->fl_u.nfs_fl.owner = nlm_find_lockowner(host, fl->fl_owner); in nlmclnt_locks_init_private()
481 INIT_LIST_HEAD(&fl->fl_u.nfs_fl.list); in nlmclnt_locks_init_private()
482 fl->fl_ops = &nlmclnt_lock_ops; in nlmclnt_locks_init_private()
485 static int do_vfs_lock(struct file_lock *fl) in do_vfs_lock() argument
487 return locks_lock_file_wait(fl->fl_file, fl); in do_vfs_lock()
511 nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl) in nlmclnt_lock() argument
513 struct rpc_cred *cred = nfs_file_cred(fl->fl_file); in nlmclnt_lock()
517 unsigned char fl_flags = fl->fl_flags; in nlmclnt_lock()
525 fl->fl_flags |= FL_ACCESS; in nlmclnt_lock()
526 status = do_vfs_lock(fl); in nlmclnt_lock()
527 fl->fl_flags = fl_flags; in nlmclnt_lock()
531 block = nlmclnt_prepare_block(host, fl); in nlmclnt_lock()
540 fl->fl_u.nfs_fl.state = host->h_state; in nlmclnt_lock()
563 if (nlmclnt_cancel(host, req->a_args.block, fl) == 0) in nlmclnt_lock()
570 if (fl->fl_u.nfs_fl.state != host->h_state) { in nlmclnt_lock()
575 fl->fl_flags |= FL_SLEEP; in nlmclnt_lock()
576 if (do_vfs_lock(fl) < 0) in nlmclnt_lock()
579 fl->fl_flags = fl_flags; in nlmclnt_lock()
603 fl_type = fl->fl_type; in nlmclnt_lock()
604 fl->fl_type = F_UNLCK; in nlmclnt_lock()
606 do_vfs_lock(fl); in nlmclnt_lock()
608 fl->fl_type = fl_type; in nlmclnt_lock()
609 fl->fl_flags = fl_flags; in nlmclnt_lock()
618 nlmclnt_reclaim(struct nlm_host *host, struct file_lock *fl, in nlmclnt_reclaim() argument
624 locks_init_lock(&req->a_args.lock.fl); in nlmclnt_reclaim()
625 locks_init_lock(&req->a_res.lock.fl); in nlmclnt_reclaim()
629 nlmclnt_setlockargs(req, fl); in nlmclnt_reclaim()
632 status = nlmclnt_call(nfs_file_cred(fl->fl_file), req, NLMPROC_LOCK); in nlmclnt_reclaim()
637 "(errno %d, status %d)\n", fl->fl_pid, in nlmclnt_reclaim()
659 nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl) in nlmclnt_unlock() argument
664 unsigned char fl_flags = fl->fl_flags; in nlmclnt_unlock()
671 fl->fl_flags |= FL_EXISTS; in nlmclnt_unlock()
673 status = do_vfs_lock(fl); in nlmclnt_unlock()
675 fl->fl_flags = fl_flags; in nlmclnt_unlock()
682 status = nlmclnt_async_call(nfs_file_cred(fl->fl_file), req, in nlmclnt_unlock()
756 static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl) in nlmclnt_cancel() argument
769 nlmclnt_setlockargs(req, fl); in nlmclnt_cancel()
773 status = nlmclnt_async_call(nfs_file_cred(fl->fl_file), req, in nlmclnt_cancel()