drbd: Converted drbd_send_handshake() from mdev to tconn
authorPhilipp Reisner <philipp.reisner@linbit.com>
Mon, 7 Feb 2011 15:47:12 +0000 (16:47 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Wed, 28 Sep 2011 08:29:50 +0000 (10:29 +0200)
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_receiver.c

index e640ffdad9cdee887c4878f798f85fcf10f7f40c..845ff34d206070e3053d7e897d4b9bb09510035e 100644 (file)
@@ -378,7 +378,7 @@ struct p_block_req {
  */
 
 struct p_handshake {
-       struct p_header head;   /* Note: You must always use a h80 here */
+       struct p_header head;   /* Note: vnr will be ignored */
        u32 protocol_min;
        u32 feature_flags;
        u32 protocol_max;
index 60a4f651a084db175617e381b704ee48971f17fb..565f2ea47ab86e83fd18dec1a326afd61c21817b 100644 (file)
@@ -3952,28 +3952,28 @@ static void drbd_disconnect(struct drbd_conf *mdev)
  *
  * for now, they are expected to be zero, but ignored.
  */
-static int drbd_send_handshake(struct drbd_conf *mdev)
+static int drbd_send_handshake(struct drbd_tconn *tconn)
 {
        /* ASSERT current == mdev->tconn->receiver ... */
-       struct p_handshake *p = &mdev->tconn->data.sbuf.handshake;
+       struct p_handshake *p = &tconn->data.sbuf.handshake;
        int ok;
 
-       if (mutex_lock_interruptible(&mdev->tconn->data.mutex)) {
-               dev_err(DEV, "interrupted during initial handshake\n");
+       if (mutex_lock_interruptible(&tconn->data.mutex)) {
+               conn_err(tconn, "interrupted during initial handshake\n");
                return 0; /* interrupted. not ok. */
        }
 
-       if (mdev->tconn->data.socket == NULL) {
-               mutex_unlock(&mdev->tconn->data.mutex);
+       if (tconn->data.socket == NULL) {
+               mutex_unlock(&tconn->data.mutex);
                return 0;
        }
 
        memset(p, 0, sizeof(*p));
        p->protocol_min = cpu_to_be32(PRO_VERSION_MIN);
        p->protocol_max = cpu_to_be32(PRO_VERSION_MAX);
-       ok = _drbd_send_cmd(mdev, mdev->tconn->data.socket, P_HAND_SHAKE,
-                           &p->head, sizeof(*p), 0 );
-       mutex_unlock(&mdev->tconn->data.mutex);
+       ok = _conn_send_cmd(tconn, 0, tconn->data.socket, P_HAND_SHAKE,
+                           &p->head, sizeof(*p), 0);
+       mutex_unlock(&tconn->data.mutex);
        return ok;
 }
 
@@ -3993,7 +3993,7 @@ static int drbd_do_handshake(struct drbd_conf *mdev)
        enum drbd_packet cmd;
        int rv;
 
-       rv = drbd_send_handshake(mdev);
+       rv = drbd_send_handshake(mdev->tconn);
        if (!rv)
                return 0;