Lines Matching +full:lock +full:- +full:status
1 // SPDX-License-Identifier: GPL-2.0
28 struct nlm_lock *lock = &argp->lock; in nlm4svc_retrieve_args() local
35 if (lock->lock_start > OFFSET_MAX || in nlm4svc_retrieve_args()
36 (lock->lock_len && ((lock->lock_len - 1) > (OFFSET_MAX - lock->lock_start)))) in nlm4svc_retrieve_args()
40 if (!(host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len)) in nlm4svc_retrieve_args()
41 || (argp->monitor && nsm_monitor(host) < 0)) in nlm4svc_retrieve_args()
47 int mode = lock_to_openmode(&lock->fl); in nlm4svc_retrieve_args()
49 lock->fl.c.flc_flags = FL_POSIX; in nlm4svc_retrieve_args()
51 error = nlm_lookup_file(rqstp, &file, lock); in nlm4svc_retrieve_args()
57 lock->fl.c.flc_file = file->f_file[mode]; in nlm4svc_retrieve_args()
58 lock->fl.c.flc_pid = current->tgid; in nlm4svc_retrieve_args()
59 lock->fl.fl_start = (loff_t)lock->lock_start; in nlm4svc_retrieve_args()
60 lock->fl.fl_end = lock->lock_len ? in nlm4svc_retrieve_args()
61 (loff_t)(lock->lock_start + lock->lock_len - 1) : in nlm4svc_retrieve_args()
63 lock->fl.fl_lmops = &nlmsvc_lock_operations; in nlm4svc_retrieve_args()
64 nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid); in nlm4svc_retrieve_args()
65 if (!lock->fl.c.flc_owner) { in nlm4svc_retrieve_args()
92 * TEST: Check for conflicting lock
97 struct nlm_args *argp = rqstp->rq_argp; in __nlm4svc_proc_test()
104 resp->cookie = argp->cookie; in __nlm4svc_proc_test()
107 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) in __nlm4svc_proc_test()
108 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; in __nlm4svc_proc_test()
110 test_owner = argp->lock.fl.c.flc_owner; in __nlm4svc_proc_test()
112 resp->status = nlmsvc_testlock(rqstp, file, host, &argp->lock, in __nlm4svc_proc_test()
113 &resp->lock); in __nlm4svc_proc_test()
114 if (resp->status == nlm_drop_reply) in __nlm4svc_proc_test()
117 dprintk("lockd: TEST4 status %d\n", ntohl(resp->status)); in __nlm4svc_proc_test()
128 return __nlm4svc_proc_test(rqstp, rqstp->rq_resp); in nlm4svc_proc_test()
134 struct nlm_args *argp = rqstp->rq_argp; in __nlm4svc_proc_lock()
139 dprintk("lockd: LOCK called\n"); in __nlm4svc_proc_lock()
141 resp->cookie = argp->cookie; in __nlm4svc_proc_lock()
144 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) in __nlm4svc_proc_lock()
145 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; in __nlm4svc_proc_lock()
147 /* Now try to lock the file */ in __nlm4svc_proc_lock()
148 resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock, in __nlm4svc_proc_lock()
149 argp->block, &argp->cookie, in __nlm4svc_proc_lock()
150 argp->reclaim); in __nlm4svc_proc_lock()
151 if (resp->status == nlm_drop_reply) in __nlm4svc_proc_lock()
154 dprintk("lockd: LOCK status %d\n", ntohl(resp->status)); in __nlm4svc_proc_lock()
156 nlmsvc_release_lockowner(&argp->lock); in __nlm4svc_proc_lock()
165 return __nlm4svc_proc_lock(rqstp, rqstp->rq_resp); in nlm4svc_proc_lock()
171 struct nlm_args *argp = rqstp->rq_argp; in __nlm4svc_proc_cancel()
177 resp->cookie = argp->cookie; in __nlm4svc_proc_cancel()
181 resp->status = nlm_lck_denied_grace_period; in __nlm4svc_proc_cancel()
186 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) in __nlm4svc_proc_cancel()
187 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; in __nlm4svc_proc_cancel()
190 resp->status = nlmsvc_cancel_blocked(SVC_NET(rqstp), file, &argp->lock); in __nlm4svc_proc_cancel()
192 dprintk("lockd: CANCEL status %d\n", ntohl(resp->status)); in __nlm4svc_proc_cancel()
193 nlmsvc_release_lockowner(&argp->lock); in __nlm4svc_proc_cancel()
202 return __nlm4svc_proc_cancel(rqstp, rqstp->rq_resp); in nlm4svc_proc_cancel()
206 * UNLOCK: release a lock
211 struct nlm_args *argp = rqstp->rq_argp; in __nlm4svc_proc_unlock()
217 resp->cookie = argp->cookie; in __nlm4svc_proc_unlock()
219 /* Don't accept new lock requests during grace period */ in __nlm4svc_proc_unlock()
221 resp->status = nlm_lck_denied_grace_period; in __nlm4svc_proc_unlock()
226 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) in __nlm4svc_proc_unlock()
227 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; in __nlm4svc_proc_unlock()
229 /* Now try to remove the lock */ in __nlm4svc_proc_unlock()
230 resp->status = nlmsvc_unlock(SVC_NET(rqstp), file, &argp->lock); in __nlm4svc_proc_unlock()
232 dprintk("lockd: UNLOCK status %d\n", ntohl(resp->status)); in __nlm4svc_proc_unlock()
233 nlmsvc_release_lockowner(&argp->lock); in __nlm4svc_proc_unlock()
242 return __nlm4svc_proc_unlock(rqstp, rqstp->rq_resp); in nlm4svc_proc_unlock()
246 * GRANTED: A server calls us to tell that a process' lock request
252 struct nlm_args *argp = rqstp->rq_argp; in __nlm4svc_proc_granted()
254 resp->cookie = argp->cookie; in __nlm4svc_proc_granted()
257 resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock); in __nlm4svc_proc_granted()
258 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); in __nlm4svc_proc_granted()
265 return __nlm4svc_proc_granted(rqstp, rqstp->rq_resp); in nlm4svc_proc_granted()
293 struct nlm_args *argp = rqstp->rq_argp; in nlm4svc_callback()
299 argp->lock.caller, in nlm4svc_callback()
300 argp->lock.len); in nlm4svc_callback()
309 stat = func(rqstp, &call->a_res); in nlm4svc_callback()
315 call->a_flags = RPC_TASK_ASYNC; in nlm4svc_callback()
357 struct nlm_args *argp = rqstp->rq_argp; in nlm4svc_proc_share()
358 struct nlm_res *resp = rqstp->rq_resp; in nlm4svc_proc_share()
364 resp->cookie = argp->cookie; in nlm4svc_proc_share()
366 /* Don't accept new lock requests during grace period */ in nlm4svc_proc_share()
367 if (locks_in_grace(SVC_NET(rqstp)) && !argp->reclaim) { in nlm4svc_proc_share()
368 resp->status = nlm_lck_denied_grace_period; in nlm4svc_proc_share()
373 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) in nlm4svc_proc_share()
374 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; in nlm4svc_proc_share()
377 resp->status = nlmsvc_share_file(host, file, argp); in nlm4svc_proc_share()
379 dprintk("lockd: SHARE status %d\n", ntohl(resp->status)); in nlm4svc_proc_share()
380 nlmsvc_release_lockowner(&argp->lock); in nlm4svc_proc_share()
392 struct nlm_args *argp = rqstp->rq_argp; in nlm4svc_proc_unshare()
393 struct nlm_res *resp = rqstp->rq_resp; in nlm4svc_proc_unshare()
399 resp->cookie = argp->cookie; in nlm4svc_proc_unshare()
403 resp->status = nlm_lck_denied_grace_period; in nlm4svc_proc_unshare()
408 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) in nlm4svc_proc_unshare()
409 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; in nlm4svc_proc_unshare()
411 /* Now try to lock the file */ in nlm4svc_proc_unshare()
412 resp->status = nlmsvc_unshare_file(host, file, argp); in nlm4svc_proc_unshare()
414 dprintk("lockd: UNSHARE status %d\n", ntohl(resp->status)); in nlm4svc_proc_unshare()
415 nlmsvc_release_lockowner(&argp->lock); in nlm4svc_proc_unshare()
422 * NM_LOCK: Create an unmonitored lock
427 struct nlm_args *argp = rqstp->rq_argp; in nlm4svc_proc_nm_lock()
431 argp->monitor = 0; /* just clean the monitor flag */ in nlm4svc_proc_nm_lock()
441 struct nlm_args *argp = rqstp->rq_argp; in nlm4svc_proc_free_all()
459 struct nlm_reboot *argp = rqstp->rq_argp; in nlm4svc_proc_sm_notify()
480 struct nlm_res *argp = rqstp->rq_argp; in nlm4svc_proc_granted_res()
487 nlmsvc_grant_reply(&argp->cookie, argp->status); in nlm4svc_proc_granted_res()
506 #define St 1 /* status */
538 .pc_name = "LOCK",