aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/lockd/bind.h
diff options
context:
space:
mode:
authorBenjamin Coddington <bcodding@redhat.com>2017-04-11 12:50:11 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2017-04-21 10:45:01 -0400
commitb1ece737f44f91dca8f4829cf0b442e752e406db (patch)
treed0368ec8da45be194c4cde25d46e178ea9060715 /include/linux/lockd/bind.h
parent7d6ddf88c4db372689c8aa65ea652d0514d66c06 (diff)
lockd: Introduce nlmclnt_operations
NFS would enjoy the ability to modify the behavior of the NLM client's unlock RPC task in order to delay the transmission of the unlock until IO that was submitted under that lock has completed. This ability can ensure that the NLM client will always complete the transmission of an unlock even if the waiting caller has been interrupted with fatal signal. For this purpose, a pointer to a struct nlmclnt_operations can be assigned in a nfs_module's nfs_rpc_ops that will install those nlmclnt_operations on the nlm_host. The struct nlmclnt_operations defines three callback operations that will be used in a following patch: nlmclnt_alloc_call - used to call back after a successful allocation of a struct nlm_rqst in nlmclnt_proc(). nlmclnt_unlock_prepare - used to call back during NLM unlock's rpc_call_prepare. The NLM client defers calling rpc_call_start() until this callback returns false. nlmclnt_release_call - used to call back when the NLM client's struct nlm_rqst is freed. Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'include/linux/lockd/bind.h')
-rw-r--r--include/linux/lockd/bind.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 140edab64446..05728396a1a1 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -18,6 +18,7 @@
18 18
19/* Dummy declarations */ 19/* Dummy declarations */
20struct svc_rqst; 20struct svc_rqst;
21struct rpc_task;
21 22
22/* 23/*
23 * This is the set of functions for lockd->nfsd communication 24 * This is the set of functions for lockd->nfsd communication
@@ -43,6 +44,7 @@ struct nlmclnt_initdata {
43 u32 nfs_version; 44 u32 nfs_version;
44 int noresvport; 45 int noresvport;
45 struct net *net; 46 struct net *net;
47 const struct nlmclnt_operations *nlmclnt_ops;
46}; 48};
47 49
48/* 50/*
@@ -52,8 +54,26 @@ struct nlmclnt_initdata {
52extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init); 54extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init);
53extern void nlmclnt_done(struct nlm_host *host); 55extern void nlmclnt_done(struct nlm_host *host);
54 56
55extern int nlmclnt_proc(struct nlm_host *host, int cmd, 57/*
56 struct file_lock *fl); 58 * NLM client operations provide a means to modify RPC processing of NLM
59 * requests. Callbacks receive a pointer to data passed into the call to
60 * nlmclnt_proc().
61 */
62struct nlmclnt_operations {
63 /* Called on successful allocation of nlm_rqst, use for allocation or
64 * reference counting. */
65 void (*nlmclnt_alloc_call)(void *);
66
67 /* Called in rpc_task_prepare for unlock. A return value of true
68 * indicates the callback has put the task to sleep on a waitqueue
69 * and NLM should not call rpc_call_start(). */
70 bool (*nlmclnt_unlock_prepare)(struct rpc_task*, void *);
71
72 /* Called when the nlm_rqst is freed, callbacks should clean up here */
73 void (*nlmclnt_release_call)(void *);
74};
75
76extern int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data);
57extern int lockd_up(struct net *net); 77extern int lockd_up(struct net *net);
58extern void lockd_down(struct net *net); 78extern void lockd_down(struct net *net);
59 79