ceph: detect lossy state of connection
authorSage Weil <sage@newdream.net>
Mon, 14 Dec 2009 22:56:56 +0000 (14:56 -0800)
committerSage Weil <sage@newdream.net>
Tue, 22 Dec 2009 00:39:49 +0000 (16:39 -0800)
The server indicates whether a connection is lossy; set our LOSSYTX bit
appropriately.  Do not set lossy bit on outgoing connections.

Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/messenger.c

index 98519bd33f04f751dd36a8af6f37f21a8836a398..986d8fb9c57408e2d7ae0f577e13350cfd1c7fb3 100644 (file)
@@ -625,8 +625,6 @@ static void prepare_write_connect(struct ceph_messenger *msgr,
        con->out_connect.global_seq = cpu_to_le32(global_seq);
        con->out_connect.protocol_version = cpu_to_le32(proto);
        con->out_connect.flags = 0;
-       if (test_bit(LOSSYTX, &con->state))
-               con->out_connect.flags = CEPH_MSG_CONNECT_LOSSY;
 
        if (!after_banner) {
                con->out_kvec_left = 0;
@@ -1168,6 +1166,10 @@ static int process_connect(struct ceph_connection *con)
                     con->connect_seq);
                WARN_ON(con->connect_seq !=
                        le32_to_cpu(con->in_reply.connect_seq));
+
+               if (con->in_reply.flags & CEPH_MSG_CONNECT_LOSSY)
+                       set_bit(LOSSYTX, &con->state);
+
                prepare_read_tag(con);
                break;