Lines Matching refs:fl
31 static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *host);
126 static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
133 memcpy(&lock->fh, NFS_FH(locks_inode(fl->fl_file)), sizeof(struct nfs_fh));
137 (unsigned int)fl->fl_u.nfs_fl.owner->pid,
139 lock->svid = fl->fl_u.nfs_fl.owner->pid;
140 lock->fl.fl_start = fl->fl_start;
141 lock->fl.fl_end = fl->fl_end;
142 lock->fl.fl_type = fl->fl_type;
147 WARN_ON_ONCE(req->a_args.lock.fl.fl_ops != NULL);
154 * @fl: address of arguments for the lock operation
158 int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data)
171 nlmclnt_locks_init_private(fl, host);
172 if (!fl->fl_u.nfs_fl.owner) {
178 nlmclnt_setlockargs(call, fl);
182 if (fl->fl_type != F_UNLCK) {
184 status = nlmclnt_lock(call, fl);
186 status = nlmclnt_unlock(call, fl);
188 status = nlmclnt_test(call, fl);
191 fl->fl_ops->fl_release_private(fl);
192 fl->fl_ops = NULL;
210 locks_init_lock(&call->a_args.lock.fl);
211 locks_init_lock(&call->a_res.lock.fl);
428 nlmclnt_test(struct nlm_rqst *req, struct file_lock *fl)
432 status = nlmclnt_call(nfs_file_cred(fl->fl_file), req, NLMPROC_TEST);
438 fl->fl_type = F_UNLCK;
444 fl->fl_start = req->a_res.lock.fl.fl_start;
445 fl->fl_end = req->a_res.lock.fl.fl_end;
446 fl->fl_type = req->a_res.lock.fl.fl_type;
447 fl->fl_pid = -req->a_res.lock.fl.fl_pid;
457 static void nlmclnt_locks_copy_lock(struct file_lock *new, struct file_lock *fl)
459 spin_lock(&fl->fl_u.nfs_fl.owner->host->h_lock);
460 new->fl_u.nfs_fl.state = fl->fl_u.nfs_fl.state;
461 new->fl_u.nfs_fl.owner = nlmclnt_get_lockowner(fl->fl_u.nfs_fl.owner);
462 list_add_tail(&new->fl_u.nfs_fl.list, &fl->fl_u.nfs_fl.owner->host->h_granted);
463 spin_unlock(&fl->fl_u.nfs_fl.owner->host->h_lock);
466 static void nlmclnt_locks_release_private(struct file_lock *fl)
468 spin_lock(&fl->fl_u.nfs_fl.owner->host->h_lock);
469 list_del(&fl->fl_u.nfs_fl.list);
470 spin_unlock(&fl->fl_u.nfs_fl.owner->host->h_lock);
471 nlmclnt_put_lockowner(fl->fl_u.nfs_fl.owner);
479 static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *host)
481 fl->fl_u.nfs_fl.state = 0;
482 fl->fl_u.nfs_fl.owner = nlmclnt_find_lockowner(host, fl->fl_owner);
483 INIT_LIST_HEAD(&fl->fl_u.nfs_fl.list);
484 fl->fl_ops = &nlmclnt_lock_ops;
487 static int do_vfs_lock(struct file_lock *fl)
489 return locks_lock_file_wait(fl->fl_file, fl);
513 nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
515 const struct cred *cred = nfs_file_cred(fl->fl_file);
519 unsigned char fl_flags = fl->fl_flags;
527 fl->fl_flags |= FL_ACCESS;
528 status = do_vfs_lock(fl);
529 fl->fl_flags = fl_flags;
533 block = nlmclnt_prepare_block(host, fl);
542 fl->fl_u.nfs_fl.state = host->h_state;
565 if (nlmclnt_cancel(host, req->a_args.block, fl) == 0)
572 if (fl->fl_u.nfs_fl.state != host->h_state) {
577 fl->fl_flags |= FL_SLEEP;
578 if (do_vfs_lock(fl) < 0)
581 fl->fl_flags = fl_flags;
605 fl_type = fl->fl_type;
606 fl->fl_type = F_UNLCK;
608 do_vfs_lock(fl);
610 fl->fl_type = fl_type;
611 fl->fl_flags = fl_flags;
620 nlmclnt_reclaim(struct nlm_host *host, struct file_lock *fl,
626 locks_init_lock(&req->a_args.lock.fl);
627 locks_init_lock(&req->a_res.lock.fl);
631 nlmclnt_setlockargs(req, fl);
634 status = nlmclnt_call(nfs_file_cred(fl->fl_file), req, NLMPROC_LOCK);
639 "(errno %d, status %d)\n", fl->fl_pid,
661 nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
666 unsigned char fl_flags = fl->fl_flags;
673 fl->fl_flags |= FL_EXISTS;
675 status = do_vfs_lock(fl);
677 fl->fl_flags = fl_flags;
684 status = nlmclnt_async_call(nfs_file_cred(fl->fl_file), req,
758 static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl)
771 nlmclnt_setlockargs(req, fl);
775 status = nlmclnt_async_call(nfs_file_cred(fl->fl_file), req,