aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-05-27 00:26:43 -0400
committerAlex Elder <elder@dreamhost.com>2012-06-06 10:23:54 -0400
commit20581c1faf7b15ae1f8b80c0ec757877b0b53151 (patch)
treeb2d0a20386c8fa6ae6bddbc6da1f313570889f66 /net
parentec87ef4309d33bd9c87a53bb5152a86ae7a65f25 (diff)
libceph: init monitor connection when opening
Hold off initializing a monitor client's connection until just before it gets opened for use. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/mon_client.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index 062b72478077..6adbea78b168 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -119,6 +119,7 @@ static void __close_session(struct ceph_mon_client *monc)
119 dout("__close_session closing mon%d\n", monc->cur_mon); 119 dout("__close_session closing mon%d\n", monc->cur_mon);
120 ceph_con_revoke(&monc->con, monc->m_auth); 120 ceph_con_revoke(&monc->con, monc->m_auth);
121 ceph_con_close(&monc->con); 121 ceph_con_close(&monc->con);
122 monc->con.private = NULL;
122 monc->cur_mon = -1; 123 monc->cur_mon = -1;
123 monc->pending_auth = 0; 124 monc->pending_auth = 0;
124 ceph_auth_reset(monc->auth); 125 ceph_auth_reset(monc->auth);
@@ -141,9 +142,13 @@ static int __open_session(struct ceph_mon_client *monc)
141 monc->sub_renew_after = jiffies; /* i.e., expired */ 142 monc->sub_renew_after = jiffies; /* i.e., expired */
142 monc->want_next_osdmap = !!monc->want_next_osdmap; 143 monc->want_next_osdmap = !!monc->want_next_osdmap;
143 144
144 dout("open_session mon%d opening\n", monc->cur_mon); 145 ceph_con_init(&monc->client->msgr, &monc->con);
146 monc->con.private = monc;
147 monc->con.ops = &mon_con_ops;
145 monc->con.peer_name.type = CEPH_ENTITY_TYPE_MON; 148 monc->con.peer_name.type = CEPH_ENTITY_TYPE_MON;
146 monc->con.peer_name.num = cpu_to_le64(monc->cur_mon); 149 monc->con.peer_name.num = cpu_to_le64(monc->cur_mon);
150
151 dout("open_session mon%d opening\n", monc->cur_mon);
147 ceph_con_open(&monc->con, 152 ceph_con_open(&monc->con,
148 &monc->monmap->mon_inst[monc->cur_mon].addr); 153 &monc->monmap->mon_inst[monc->cur_mon].addr);
149 154
@@ -760,10 +765,6 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
760 goto out; 765 goto out;
761 766
762 /* connection */ 767 /* connection */
763 ceph_con_init(&monc->client->msgr, &monc->con);
764 monc->con.private = monc;
765 monc->con.ops = &mon_con_ops;
766
767 /* authentication */ 768 /* authentication */
768 monc->auth = ceph_auth_init(cl->options->name, 769 monc->auth = ceph_auth_init(cl->options->name,
769 cl->options->key); 770 cl->options->key);
@@ -836,8 +837,6 @@ void ceph_monc_stop(struct ceph_mon_client *monc)
836 mutex_lock(&monc->mutex); 837 mutex_lock(&monc->mutex);
837 __close_session(monc); 838 __close_session(monc);
838 839
839 monc->con.private = NULL;
840
841 mutex_unlock(&monc->mutex); 840 mutex_unlock(&monc->mutex);
842 841
843 ceph_auth_destroy(monc->auth); 842 ceph_auth_destroy(monc->auth);