diff options
author | Sage Weil <sage@inktank.com> | 2012-06-27 15:24:34 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-07-06 00:14:38 -0400 |
commit | 735a72ef952d42a256f79ae3e6dc1c17a45c041b (patch) | |
tree | d092494049943c94f2e6711943b95e5b4fe10981 /net | |
parent | b7a9e5dd40f17a48a72f249b8bbc989b63bae5fd (diff) |
libceph: initialize mon_client con only once
Do not re-initialize the con on every connection attempt. When we
ceph_con_close, there may still be work queued on the socket (e.g., to
close it), and re-initializing will clobber the work_struct state.
Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ceph/mon_client.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index bcc80a0e2a98..bfd21a891d69 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c | |||
@@ -119,7 +119,6 @@ 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_msg_revoke(monc->m_auth); | 120 | ceph_msg_revoke(monc->m_auth); |
121 | ceph_con_close(&monc->con); | 121 | ceph_con_close(&monc->con); |
122 | monc->con.private = NULL; | ||
123 | monc->cur_mon = -1; | 122 | monc->cur_mon = -1; |
124 | monc->pending_auth = 0; | 123 | monc->pending_auth = 0; |
125 | ceph_auth_reset(monc->auth); | 124 | ceph_auth_reset(monc->auth); |
@@ -142,9 +141,6 @@ static int __open_session(struct ceph_mon_client *monc) | |||
142 | monc->sub_renew_after = jiffies; /* i.e., expired */ | 141 | monc->sub_renew_after = jiffies; /* i.e., expired */ |
143 | monc->want_next_osdmap = !!monc->want_next_osdmap; | 142 | monc->want_next_osdmap = !!monc->want_next_osdmap; |
144 | 143 | ||
145 | ceph_con_init(&monc->con, monc, &mon_con_ops, | ||
146 | &monc->client->msgr); | ||
147 | |||
148 | dout("open_session mon%d opening\n", monc->cur_mon); | 144 | dout("open_session mon%d opening\n", monc->cur_mon); |
149 | ceph_con_open(&monc->con, | 145 | ceph_con_open(&monc->con, |
150 | CEPH_ENTITY_TYPE_MON, monc->cur_mon, | 146 | CEPH_ENTITY_TYPE_MON, monc->cur_mon, |
@@ -798,6 +794,9 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl) | |||
798 | if (!monc->m_auth) | 794 | if (!monc->m_auth) |
799 | goto out_auth_reply; | 795 | goto out_auth_reply; |
800 | 796 | ||
797 | ceph_con_init(&monc->con, monc, &mon_con_ops, | ||
798 | &monc->client->msgr); | ||
799 | |||
801 | monc->cur_mon = -1; | 800 | monc->cur_mon = -1; |
802 | monc->hunting = true; | 801 | monc->hunting = true; |
803 | monc->sub_renew_after = jiffies; | 802 | monc->sub_renew_after = jiffies; |