]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: msgr zero in ceph_con_init
authorSage Weil <sage@newdream.net>
Tue, 8 Sep 2009 20:52:55 +0000 (13:52 -0700)
committerSage Weil <sage@newdream.net>
Tue, 8 Sep 2009 20:52:55 +0000 (13:52 -0700)
src/kernel/messenger.c
src/kernel/mon_client.c

index b7f2bea7903d9b964f7cc6cb6a63363cb062a738..9c8f8ac2fa37d55ad7bbf7b887f3e044a2f4e55e 100644 (file)
 /*
  * Ceph uses the messenger to exchange ceph_msg messages with other
  * hosts in the system.  The messenger provides ordered and reliable
- * delivery.  It tolerates TCP disconnects by reconnecting (with
+ * delivery.  We tolerate TCP disconnects by reconnecting (with
  * exponential backoff) in the case of a fault (disconnection, bad
  * crc, protocol error).  Acks allow sent messages to be discarded by
  * the sender.
- *
- * The network topology is flat: there is no "client" or "server," and
- * any node can initiate a connection (i.e., send messages) to any
- * other node.  There is a fair bit of complexity to handle the
- * "connection race" case where two nodes are simultaneously
- * connecting to each other so that the end result is a single
- * session.
- *
- * The messenger can also send messages in "lossy" mode, where there
- * is no error recovery or connect retry... the message is just
- * dropped if something goes wrong.
  */
 
-
 /* static tag bytes (protocol control messages) */
 static char tag_msg = CEPH_MSGR_TAG_MSG;
 static char tag_ack = CEPH_MSGR_TAG_ACK;
@@ -313,19 +301,17 @@ void ceph_con_put(struct ceph_connection *con)
 
 /*
  * initialize a new connection.
- *
- * NOTE: assumes struct is initially zeroed!
  */
 void ceph_con_init(struct ceph_messenger *msgr, struct ceph_connection *con)
 {
        dout("con_init %p\n", con);
+       memset(con, 0, sizeof(*con));
        atomic_set(&con->nref, 1);
        con->msgr = msgr;
        spin_lock_init(&con->out_queue_lock);
        INIT_LIST_HEAD(&con->out_queue);
        INIT_LIST_HEAD(&con->out_sent);
        INIT_DELAYED_WORK(&con->work, con_work);
-       con->private = NULL;
 }
 
 
index 06f13291e847e01f06586f2e27b80147790f2336..d6b52a7fbb7fb1643de49811a8840e61a9a2c3b8 100644 (file)
@@ -280,7 +280,7 @@ static void __request_mount(struct ceph_mon_client *monc)
 int ceph_monc_request_mount(struct ceph_mon_client *monc)
 {
        if (!monc->con) {
-               monc->con = kzalloc(sizeof(*monc->con), GFP_KERNEL);
+               monc->con = kmalloc(sizeof(*monc->con), GFP_KERNEL);
                if (!monc->con)
                        return -ENOMEM;
                ceph_con_init(monc->client->msgr, monc->con);