Lines Matching refs:fl
34 static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *host);
129 static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
136 memcpy(&lock->fh, NFS_FH(file_inode(fl->fl_file)), sizeof(struct nfs_fh));
140 (unsigned int)fl->fl_u.nfs_fl.owner->pid,
142 lock->svid = fl->fl_u.nfs_fl.owner->pid;
143 lock->fl.fl_start = fl->fl_start;
144 lock->fl.fl_end = fl->fl_end;
145 lock->fl.fl_type = fl->fl_type;
150 WARN_ON_ONCE(req->a_args.lock.fl.fl_ops != NULL);
157 * @fl: address of arguments for the lock operation
161 int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data)
174 nlmclnt_locks_init_private(fl, host);
175 if (!fl->fl_u.nfs_fl.owner) {
181 nlmclnt_setlockargs(call, fl);
185 if (fl->fl_type != F_UNLCK) {
187 status = nlmclnt_lock(call, fl);
189 status = nlmclnt_unlock(call, fl);
191 status = nlmclnt_test(call, fl);
194 fl->fl_ops->fl_release_private(fl);
195 fl->fl_ops = NULL;
213 locks_init_lock(&call->a_args.lock.fl);
214 locks_init_lock(&call->a_res.lock.fl);
431 nlmclnt_test(struct nlm_rqst *req, struct file_lock *fl)
435 status = nlmclnt_call(nfs_file_cred(fl->fl_file), req, NLMPROC_TEST);
441 fl->fl_type = F_UNLCK;
447 fl->fl_start = req->a_res.lock.fl.fl_start;
448 fl->fl_end = req->a_res.lock.fl.fl_end;
449 fl->fl_type = req->a_res.lock.fl.fl_type;
450 fl->fl_pid = -req->a_res.lock.fl.fl_pid;
463 static void nlmclnt_locks_copy_lock(struct file_lock *new, struct file_lock *fl)
465 spin_lock(&fl->fl_u.nfs_fl.owner->host->h_lock);
466 new->fl_u.nfs_fl.state = fl->fl_u.nfs_fl.state;
467 new->fl_u.nfs_fl.owner = nlmclnt_get_lockowner(fl->fl_u.nfs_fl.owner);
468 list_add_tail(&new->fl_u.nfs_fl.list, &fl->fl_u.nfs_fl.owner->host->h_granted);
469 spin_unlock(&fl->fl_u.nfs_fl.owner->host->h_lock);
472 static void nlmclnt_locks_release_private(struct file_lock *fl)
474 spin_lock(&fl->fl_u.nfs_fl.owner->host->h_lock);
475 list_del(&fl->fl_u.nfs_fl.list);
476 spin_unlock(&fl->fl_u.nfs_fl.owner->host->h_lock);
477 nlmclnt_put_lockowner(fl->fl_u.nfs_fl.owner);
485 static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *host)
487 fl->fl_u.nfs_fl.state = 0;
488 fl->fl_u.nfs_fl.owner = nlmclnt_find_lockowner(host, fl->fl_owner);
489 INIT_LIST_HEAD(&fl->fl_u.nfs_fl.list);
490 fl->fl_ops = &nlmclnt_lock_ops;
493 static int do_vfs_lock(struct file_lock *fl)
495 return locks_lock_file_wait(fl->fl_file, fl);
519 nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
521 const struct cred *cred = nfs_file_cred(fl->fl_file);
525 unsigned char fl_flags = fl->fl_flags;
534 fl->fl_flags |= FL_ACCESS;
535 status = do_vfs_lock(fl);
536 fl->fl_flags = fl_flags;
540 nlmclnt_prepare_block(&block, host, fl);
556 fl->fl_u.nfs_fl.state = host->h_state;
582 if (nlmclnt_cancel(host, req->a_args.block, fl) == 0)
589 if (fl->fl_u.nfs_fl.state != host->h_state) {
594 fl->fl_flags |= FL_SLEEP;
595 if (do_vfs_lock(fl) < 0)
598 fl->fl_flags = fl_flags;
625 fl_type = fl->fl_type;
626 fl->fl_type = F_UNLCK;
628 do_vfs_lock(fl);
630 fl->fl_type = fl_type;
631 fl->fl_flags = fl_flags;
640 nlmclnt_reclaim(struct nlm_host *host, struct file_lock *fl,
646 locks_init_lock(&req->a_args.lock.fl);
647 locks_init_lock(&req->a_res.lock.fl);
651 nlmclnt_setlockargs(req, fl);
654 status = nlmclnt_call(nfs_file_cred(fl->fl_file), req, NLMPROC_LOCK);
659 "(errno %d, status %d)\n", fl->fl_pid,
681 nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
686 unsigned char fl_flags = fl->fl_flags;
693 fl->fl_flags |= FL_EXISTS;
695 status = do_vfs_lock(fl);
697 fl->fl_flags = fl_flags;
704 status = nlmclnt_async_call(nfs_file_cred(fl->fl_file), req,
781 static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl)
794 nlmclnt_setlockargs(req, fl);
798 status = nlmclnt_async_call(nfs_file_cred(fl->fl_file), req,