aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4callback.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-09-24 06:19:17 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-09-26 16:29:27 -0400
commit326129d02aea8efa1dfd1a210653a744e7c85239 (patch)
tree7913c0841ec25ae310f48eb1e41311a208f53373 /fs/nfsd/nfs4callback.c
parent2faf3b43507556bd80e5274270db1fce1408f4ff (diff)
nfsd: introduce a generic nfsd4_cb
Add a helper to queue up a callback. CB_NULL has a bit of special casing because it is special in the specification, but all other new callback operations will be able to share code with this and a few more changes to refactor the callback code. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4callback.c')
-rw-r--r--fs/nfsd/nfs4callback.c43
1 files changed, 10 insertions, 33 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 06e07e18ea78..03d9f4f298ec 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -49,12 +49,6 @@ static void nfsd4_mark_cb_fault(struct nfs4_client *, int reason);
49 49
50/* Index of predefined Linux callback client operations */ 50/* Index of predefined Linux callback client operations */
51 51
52enum {
53 NFSPROC4_CLNT_CB_NULL = 0,
54 NFSPROC4_CLNT_CB_RECALL,
55 NFSPROC4_CLNT_CB_SEQUENCE,
56};
57
58#define to_delegation(cb) \ 52#define to_delegation(cb) \
59 container_of(cb, struct nfs4_delegation, dl_recall) 53 container_of(cb, struct nfs4_delegation, dl_recall)
60 54
@@ -749,24 +743,9 @@ static const struct rpc_call_ops nfsd4_cb_probe_ops = {
749 743
750static struct workqueue_struct *callback_wq; 744static struct workqueue_struct *callback_wq;
751 745
752static void run_nfsd4_cb(struct nfsd4_callback *cb)
753{
754 queue_work(callback_wq, &cb->cb_work);
755}
756
757static void do_probe_callback(struct nfs4_client *clp) 746static void do_probe_callback(struct nfs4_client *clp)
758{ 747{
759 struct nfsd4_callback *cb = &clp->cl_cb_null; 748 return nfsd4_cb(&clp->cl_cb_null, clp, NFSPROC4_CLNT_CB_NULL);
760
761 cb->cb_clp = clp;
762
763 cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL];
764 cb->cb_msg.rpc_argp = NULL;
765 cb->cb_msg.rpc_resp = NULL;
766
767 cb->cb_ops = &nfsd4_cb_probe_ops;
768
769 run_nfsd4_cb(cb);
770} 749}
771 750
772/* 751/*
@@ -1005,7 +984,7 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb)
1005 } 984 }
1006 /* Yay, the callback channel's back! Restart any callbacks: */ 985 /* Yay, the callback channel's back! Restart any callbacks: */
1007 list_for_each_entry(cb, &clp->cl_callbacks, cb_per_client) 986 list_for_each_entry(cb, &clp->cl_callbacks, cb_per_client)
1008 run_nfsd4_cb(cb); 987 queue_work(callback_wq, &cb->cb_work);
1009} 988}
1010 989
1011static void 990static void
@@ -1046,21 +1025,19 @@ nfsd4_run_cb_recall(struct work_struct *w)
1046 nfsd4_run_callback_rpc(cb); 1025 nfsd4_run_callback_rpc(cb);
1047} 1026}
1048 1027
1049void nfsd4_cb_recall(struct nfs4_delegation *dp) 1028void nfsd4_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
1029 enum nfsd4_cb_op op)
1050{ 1030{
1051 struct nfsd4_callback *cb = &dp->dl_recall;
1052 struct nfs4_client *clp = dp->dl_stid.sc_client;
1053
1054 dp->dl_retries = 1;
1055 cb->cb_clp = clp; 1031 cb->cb_clp = clp;
1056 cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL]; 1032 cb->cb_msg.rpc_proc = &nfs4_cb_procedures[op];
1057 cb->cb_msg.rpc_argp = cb; 1033 cb->cb_msg.rpc_argp = cb;
1058 cb->cb_msg.rpc_resp = cb; 1034 cb->cb_msg.rpc_resp = cb;
1059 1035 if (op == NFSPROC4_CLNT_CB_NULL)
1060 cb->cb_ops = &nfsd4_cb_recall_ops; 1036 cb->cb_ops = &nfsd4_cb_probe_ops;
1061 1037 else
1038 cb->cb_ops = &nfsd4_cb_recall_ops;
1062 INIT_LIST_HEAD(&cb->cb_per_client); 1039 INIT_LIST_HEAD(&cb->cb_per_client);
1063 cb->cb_done = true; 1040 cb->cb_done = true;
1064 1041
1065 run_nfsd4_cb(&dp->dl_recall); 1042 queue_work(callback_wq, &cb->cb_work);
1066} 1043}