aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-09-24 06:19:18 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-09-26 16:29:28 -0400
commitf0b5de1b6b8b66552bcc7ae692f45940d411cf05 (patch)
treef3529730175ae2e4cca4ae1e2e99b4a6f51e1f3f
parent326129d02aea8efa1dfd1a210653a744e7c85239 (diff)
nfsd: split nfsd4_callback initialization and use
Split out initializing the nfs4_callback structure from using it. For the NULL callback this gets rid of tons of pointless re-initializations. Note that I don't quite understand what protects us from running multiple NULL callbacks at the same time, but at least this chance doesn't make it worse.. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/nfs4callback.c14
-rw-r--r--fs/nfsd/nfs4state.c8
-rw-r--r--fs/nfsd/state.h3
3 files changed, 13 insertions, 12 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 03d9f4f298ec..d97e2009e310 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -743,11 +743,6 @@ static const struct rpc_call_ops nfsd4_cb_probe_ops = {
743 743
744static struct workqueue_struct *callback_wq; 744static struct workqueue_struct *callback_wq;
745 745
746static void do_probe_callback(struct nfs4_client *clp)
747{
748 return nfsd4_cb(&clp->cl_cb_null, clp, NFSPROC4_CLNT_CB_NULL);
749}
750
751/* 746/*
752 * Poke the callback thread to process any updates to the callback 747 * Poke the callback thread to process any updates to the callback
753 * parameters, and send a null probe. 748 * parameters, and send a null probe.
@@ -756,7 +751,7 @@ void nfsd4_probe_callback(struct nfs4_client *clp)
756{ 751{
757 clp->cl_cb_state = NFSD4_CB_UNKNOWN; 752 clp->cl_cb_state = NFSD4_CB_UNKNOWN;
758 set_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags); 753 set_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags);
759 do_probe_callback(clp); 754 nfsd4_run_cb(&clp->cl_cb_null);
760} 755}
761 756
762void nfsd4_probe_callback_sync(struct nfs4_client *clp) 757void nfsd4_probe_callback_sync(struct nfs4_client *clp)
@@ -912,7 +907,7 @@ void nfsd4_shutdown_callback(struct nfs4_client *clp)
912 * instead, nfsd4_run_cb_null() will detect the killed 907 * instead, nfsd4_run_cb_null() will detect the killed
913 * client, destroy the rpc client, and stop: 908 * client, destroy the rpc client, and stop:
914 */ 909 */
915 do_probe_callback(clp); 910 nfsd4_run_cb(&clp->cl_cb_null);
916 flush_workqueue(callback_wq); 911 flush_workqueue(callback_wq);
917} 912}
918 913
@@ -1025,7 +1020,7 @@ nfsd4_run_cb_recall(struct work_struct *w)
1025 nfsd4_run_callback_rpc(cb); 1020 nfsd4_run_callback_rpc(cb);
1026} 1021}
1027 1022
1028void nfsd4_cb(struct nfsd4_callback *cb, struct nfs4_client *clp, 1023void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
1029 enum nfsd4_cb_op op) 1024 enum nfsd4_cb_op op)
1030{ 1025{
1031 cb->cb_clp = clp; 1026 cb->cb_clp = clp;
@@ -1038,6 +1033,9 @@ void nfsd4_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
1038 cb->cb_ops = &nfsd4_cb_recall_ops; 1033 cb->cb_ops = &nfsd4_cb_recall_ops;
1039 INIT_LIST_HEAD(&cb->cb_per_client); 1034 INIT_LIST_HEAD(&cb->cb_per_client);
1040 cb->cb_done = true; 1035 cb->cb_done = true;
1036}
1041 1037
1038void nfsd4_run_cb(struct nfsd4_callback *cb)
1039{
1042 queue_work(callback_wq, &cb->cb_work); 1040 queue_work(callback_wq, &cb->cb_work);
1043} 1041}
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index ae9846b976b4..a0ead0c57268 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -645,6 +645,9 @@ alloc_init_deleg(struct nfs4_client *clp, struct svc_fh *current_fh)
645 INIT_LIST_HEAD(&dp->dl_perclnt); 645 INIT_LIST_HEAD(&dp->dl_perclnt);
646 INIT_LIST_HEAD(&dp->dl_recall_lru); 646 INIT_LIST_HEAD(&dp->dl_recall_lru);
647 dp->dl_type = NFS4_OPEN_DELEGATE_READ; 647 dp->dl_type = NFS4_OPEN_DELEGATE_READ;
648 dp->dl_retries = 1;
649 nfsd4_init_cb(&dp->dl_recall, dp->dl_stid.sc_client,
650 NFSPROC4_CLNT_CB_RECALL);
648 INIT_WORK(&dp->dl_recall.cb_work, nfsd4_run_cb_recall); 651 INIT_WORK(&dp->dl_recall.cb_work, nfsd4_run_cb_recall);
649 return dp; 652 return dp;
650out_dec: 653out_dec:
@@ -1869,6 +1872,7 @@ static struct nfs4_client *create_client(struct xdr_netobj name,
1869 free_client(clp); 1872 free_client(clp);
1870 return NULL; 1873 return NULL;
1871 } 1874 }
1875 nfsd4_init_cb(&clp->cl_cb_null, clp, NFSPROC4_CLNT_CB_NULL);
1872 INIT_WORK(&clp->cl_cb_null.cb_work, nfsd4_run_cb_null); 1876 INIT_WORK(&clp->cl_cb_null.cb_work, nfsd4_run_cb_null);
1873 clp->cl_time = get_seconds(); 1877 clp->cl_time = get_seconds();
1874 clear_bit(0, &clp->cl_cb_slot_busy); 1878 clear_bit(0, &clp->cl_cb_slot_busy);
@@ -3388,9 +3392,7 @@ static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
3388 * it's safe to take a reference. 3392 * it's safe to take a reference.
3389 */ 3393 */
3390 atomic_inc(&dp->dl_stid.sc_count); 3394 atomic_inc(&dp->dl_stid.sc_count);
3391 dp->dl_retries = 1; 3395 nfsd4_run_cb(&dp->dl_recall);
3392 nfsd4_cb(&dp->dl_recall, dp->dl_stid.sc_client,
3393 NFSPROC4_CLNT_CB_RECALL);
3394} 3396}
3395 3397
3396/* Called from break_lease() with i_lock held. */ 3398/* Called from break_lease() with i_lock held. */
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 5fb6ab17f386..3c3a1903b4fa 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -543,8 +543,9 @@ void nfsd4_run_cb_recall(struct work_struct *w);
543extern void nfsd4_probe_callback(struct nfs4_client *clp); 543extern void nfsd4_probe_callback(struct nfs4_client *clp);
544extern void nfsd4_probe_callback_sync(struct nfs4_client *clp); 544extern void nfsd4_probe_callback_sync(struct nfs4_client *clp);
545extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *); 545extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *);
546extern void nfsd4_cb(struct nfsd4_callback *cb, struct nfs4_client *clp, 546extern void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
547 enum nfsd4_cb_op op); 547 enum nfsd4_cb_op op);
548extern void nfsd4_run_cb(struct nfsd4_callback *cb);
548extern int nfsd4_create_callback_queue(void); 549extern int nfsd4_create_callback_queue(void);
549extern void nfsd4_destroy_callback_queue(void); 550extern void nfsd4_destroy_callback_queue(void);
550extern void nfsd4_shutdown_callback(struct nfs4_client *); 551extern void nfsd4_shutdown_callback(struct nfs4_client *);