This is a note to let you know that I've just added the patch titled

    libceph: WARN, don't BUG on unexpected connection states

to the 3.7-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     0009-libceph-WARN-don-t-BUG-on-unexpected-connection-stat.patch
and it can be found in the queue-3.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From b95ad0140dc8d2375bff4b0f30f6832cbb29e17c Mon Sep 17 00:00:00 2001
From: Alex Elder <[email protected]>
Date: Wed, 26 Dec 2012 10:43:57 -0600
Subject: libceph: WARN, don't BUG on unexpected connection states

From: Alex Elder <[email protected]>

(cherry picked from commit 122070a2ffc91f87fe8e8493eb0ac61986c5557c)

A number of assertions in the ceph messenger are implemented with
BUG_ON(), killing the system if connection's state doesn't match
what's expected.  At this point our state model is (evidently) not
well understood enough for these assertions to trigger a BUG().
Convert all BUG_ON(con->state...) calls to be WARN_ON(con->state...)
so we learn about these issues without killing the machine.

We now recognize that a connection fault can occur due to a socket
closure at any time, regardless of the state of the connection.  So
there is really nothing we can assert about the state of the
connection at that point so eliminate that assertion.

Reported-by: Ugis <[email protected]>
Tested-by: Ugis <[email protected]>
Signed-off-by: Alex Elder <[email protected]>
Reviewed-by: Sage Weil <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
 net/ceph/messenger.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -561,7 +561,7 @@ void ceph_con_open(struct ceph_connectio
        mutex_lock(&con->mutex);
        dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr));
 
-       BUG_ON(con->state != CON_STATE_CLOSED);
+       WARN_ON(con->state != CON_STATE_CLOSED);
        con->state = CON_STATE_PREOPEN;
 
        con->peer_name.type = (__u8) entity_type;
@@ -1509,7 +1509,7 @@ static int process_banner(struct ceph_co
 static void fail_protocol(struct ceph_connection *con)
 {
        reset_connection(con);
-       BUG_ON(con->state != CON_STATE_NEGOTIATING);
+       WARN_ON(con->state != CON_STATE_NEGOTIATING);
        con->state = CON_STATE_CLOSED;
 }
 
@@ -1635,7 +1635,7 @@ static int process_connect(struct ceph_c
                        return -1;
                }
 
-               BUG_ON(con->state != CON_STATE_NEGOTIATING);
+               WARN_ON(con->state != CON_STATE_NEGOTIATING);
                con->state = CON_STATE_OPEN;
 
                con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq);
@@ -2132,7 +2132,6 @@ more:
                if (ret < 0)
                        goto out;
 
-               BUG_ON(con->state != CON_STATE_CONNECTING);
                con->state = CON_STATE_NEGOTIATING;
 
                /*
@@ -2160,7 +2159,7 @@ more:
                goto more;
        }
 
-       BUG_ON(con->state != CON_STATE_OPEN);
+       WARN_ON(con->state != CON_STATE_OPEN);
 
        if (con->in_base_pos < 0) {
                /*
@@ -2374,7 +2373,7 @@ static void ceph_fault(struct ceph_conne
        dout("fault %p state %lu to peer %s\n",
             con, con->state, ceph_pr_addr(&con->peer_addr.in_addr));
 
-       BUG_ON(con->state != CON_STATE_CONNECTING &&
+       WARN_ON(con->state != CON_STATE_CONNECTING &&
               con->state != CON_STATE_NEGOTIATING &&
               con->state != CON_STATE_OPEN);
 


Patches currently in stable-queue which might be from [email protected] are

queue-3.7/0007-libceph-move-linger-requests-sooner-in-kick_requests.patch
queue-3.7/0009-libceph-WARN-don-t-BUG-on-unexpected-connection-stat.patch
queue-3.7/0005-libceph-don-t-use-rb_init_node-in-ceph_osdc_alloc_re.patch
queue-3.7/0004-libceph-init-event-node-in-ceph_osdc_create_event.patch
queue-3.7/0008-libceph-always-reset-osds-when-kicking.patch
queue-3.7/0002-libceph-report-connection-fault-with-warning.patch
queue-3.7/0003-libceph-init-osd-o_node-in-create_osd.patch
queue-3.7/0001-libceph-socket-can-close-in-any-connection-state.patch
queue-3.7/0006-libceph-register-request-before-unregister-linger.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to