aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-06-01 15:56:43 -0400
committerAlex Elder <elder@dreamhost.com>2012-06-06 10:23:54 -0400
commit6740a845b2543cc46e1902ba21bac743fbadd0dc (patch)
treec59f9b2eaf77083a1432ee1c24ffbffc081b9c0d
parent92ce034b5a740046cc643a21ea21eaad589e0043 (diff)
libceph: make ceph_con_revoke() a msg operation
ceph_con_revoke() is passed both a message and a ceph connection. Now that any message associated with a connection holds a pointer to that connection, there's no need to provide the connection when revoking a message. This has the added benefit of precluding the possibility of the providing the wrong connection pointer. If the message's connection pointer is null, it is not being tracked by any connection, so revoking it is a no-op. This is supported as a convenience for upper layers, so they can revoke a message that is not actually "in flight." Rename the function ceph_msg_revoke() to reflect that it is really an operation on a message, not a connection. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
-rw-r--r--include/linux/ceph/messenger.h3
-rw-r--r--net/ceph/messenger.c7
-rw-r--r--net/ceph/mon_client.c8
-rw-r--r--net/ceph/osd_client.c4
4 files changed, 14 insertions, 8 deletions
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 6df837f72761..9008f81c20cd 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -239,7 +239,8 @@ extern void ceph_con_open(struct ceph_connection *con,
239extern bool ceph_con_opened(struct ceph_connection *con); 239extern bool ceph_con_opened(struct ceph_connection *con);
240extern void ceph_con_close(struct ceph_connection *con); 240extern void ceph_con_close(struct ceph_connection *con);
241extern void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg); 241extern void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg);
242extern void ceph_con_revoke(struct ceph_connection *con, struct ceph_msg *msg); 242
243extern void ceph_msg_revoke(struct ceph_msg *msg);
243extern void ceph_con_revoke_message(struct ceph_connection *con, 244extern void ceph_con_revoke_message(struct ceph_connection *con,
244 struct ceph_msg *msg); 245 struct ceph_msg *msg);
245extern void ceph_con_keepalive(struct ceph_connection *con); 246extern void ceph_con_keepalive(struct ceph_connection *con);
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 88ac083bb995..d636903ad4b2 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2421,8 +2421,13 @@ EXPORT_SYMBOL(ceph_con_send);
2421/* 2421/*
2422 * Revoke a message that was previously queued for send 2422 * Revoke a message that was previously queued for send
2423 */ 2423 */
2424void ceph_con_revoke(struct ceph_connection *con, struct ceph_msg *msg) 2424void ceph_msg_revoke(struct ceph_msg *msg)
2425{ 2425{
2426 struct ceph_connection *con = msg->con;
2427
2428 if (!con)
2429 return; /* Message not in our possession */
2430
2426 mutex_lock(&con->mutex); 2431 mutex_lock(&con->mutex);
2427 if (!list_empty(&msg->list_head)) { 2432 if (!list_empty(&msg->list_head)) {
2428 dout("%s %p msg %p - was on queue\n", __func__, con, msg); 2433 dout("%s %p msg %p - was on queue\n", __func__, con, msg);
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index 8462ccec6333..7a16750d62a6 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -106,7 +106,7 @@ static void __send_prepared_auth_request(struct ceph_mon_client *monc, int len)
106 monc->pending_auth = 1; 106 monc->pending_auth = 1;
107 monc->m_auth->front.iov_len = len; 107 monc->m_auth->front.iov_len = len;
108 monc->m_auth->hdr.front_len = cpu_to_le32(len); 108 monc->m_auth->hdr.front_len = cpu_to_le32(len);
109 ceph_con_revoke(&monc->con, monc->m_auth); 109 ceph_msg_revoke(monc->m_auth);
110 ceph_msg_get(monc->m_auth); /* keep our ref */ 110 ceph_msg_get(monc->m_auth); /* keep our ref */
111 ceph_con_send(&monc->con, monc->m_auth); 111 ceph_con_send(&monc->con, monc->m_auth);
112} 112}
@@ -117,7 +117,7 @@ static void __send_prepared_auth_request(struct ceph_mon_client *monc, int len)
117static void __close_session(struct ceph_mon_client *monc) 117static void __close_session(struct ceph_mon_client *monc)
118{ 118{
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_msg_revoke(monc->m_auth);
121 ceph_con_close(&monc->con); 121 ceph_con_close(&monc->con);
122 monc->con.private = NULL; 122 monc->con.private = NULL;
123 monc->cur_mon = -1; 123 monc->cur_mon = -1;
@@ -229,7 +229,7 @@ static void __send_subscribe(struct ceph_mon_client *monc)
229 229
230 msg->front.iov_len = p - msg->front.iov_base; 230 msg->front.iov_len = p - msg->front.iov_base;
231 msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); 231 msg->hdr.front_len = cpu_to_le32(msg->front.iov_len);
232 ceph_con_revoke(&monc->con, msg); 232 ceph_msg_revoke(msg);
233 ceph_con_send(&monc->con, ceph_msg_get(msg)); 233 ceph_con_send(&monc->con, ceph_msg_get(msg));
234 234
235 monc->sub_sent = jiffies | 1; /* never 0 */ 235 monc->sub_sent = jiffies | 1; /* never 0 */
@@ -688,7 +688,7 @@ static void __resend_generic_request(struct ceph_mon_client *monc)
688 688
689 for (p = rb_first(&monc->generic_request_tree); p; p = rb_next(p)) { 689 for (p = rb_first(&monc->generic_request_tree); p; p = rb_next(p)) {
690 req = rb_entry(p, struct ceph_mon_generic_request, node); 690 req = rb_entry(p, struct ceph_mon_generic_request, node);
691 ceph_con_revoke(&monc->con, req->request); 691 ceph_msg_revoke(req->request);
692 ceph_con_send(&monc->con, ceph_msg_get(req->request)); 692 ceph_con_send(&monc->con, ceph_msg_get(req->request));
693 } 693 }
694} 694}
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 24b427b1eca4..ad78705a4aff 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -852,7 +852,7 @@ static void __unregister_request(struct ceph_osd_client *osdc,
852 852
853 if (req->r_osd) { 853 if (req->r_osd) {
854 /* make sure the original request isn't in flight. */ 854 /* make sure the original request isn't in flight. */
855 ceph_con_revoke(&req->r_osd->o_con, req->r_request); 855 ceph_msg_revoke(req->r_request);
856 856
857 list_del_init(&req->r_osd_item); 857 list_del_init(&req->r_osd_item);
858 if (list_empty(&req->r_osd->o_requests) && 858 if (list_empty(&req->r_osd->o_requests) &&
@@ -879,7 +879,7 @@ static void __unregister_request(struct ceph_osd_client *osdc,
879static void __cancel_request(struct ceph_osd_request *req) 879static void __cancel_request(struct ceph_osd_request *req)
880{ 880{
881 if (req->r_sent && req->r_osd) { 881 if (req->r_sent && req->r_osd) {
882 ceph_con_revoke(&req->r_osd->o_con, req->r_request); 882 ceph_msg_revoke(req->r_request);
883 req->r_sent = 0; 883 req->r_sent = 0;
884 } 884 }
885} 885}