Patchwork [3.5.yuz,extended,stable] Patch "libceph: clear NEGOTIATING when done" has been added to staging queue

mail settings
Submitter Herton Ronaldo Krzesinski
Date Nov. 20, 2012, 5:17 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/200444/
State New
Headers show


Herton Ronaldo Krzesinski - Nov. 20, 2012, 5:17 p.m.
This is a note to let you know that I have just added a patch titled

    libceph: clear NEGOTIATING when done

to the linux-3.5.y-queue branch of the 3.5.yuz extended stable tree 
which can be found at:;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.yuz tree, see



From 99b3f60a8bbbada2597dd983a068635042b28b4f Mon Sep 17 00:00:00 2001
From: Alex Elder <>
Date: Wed, 23 May 2012 14:35:23 -0500
Subject: [PATCH 37/78] libceph: clear NEGOTIATING when done

commit 3ec50d1868a9e0493046400bb1fdd054c7f64ebd upstream.

A connection state's NEGOTIATING bit gets set while in CONNECTING
state after we have successfully exchanged a ceph banner and IP
addresses with the connection's peer (the server).  But that bit
is not cleared again--at least not until another connection attempt
is initiated.

Instead, clear it as soon as the connection is fully established.
Also, clear it when a socket connection gets prematurely closed
in the midst of establishing a ceph connection (in case we had
reached the point where it was set).

Signed-off-by: Alex Elder <>
Reviewed-by: Sage Weil <>
Signed-off-by: Herton Ronaldo Krzesinski <>
 net/ceph/messenger.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)



diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 5e8033f..9e586ea 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -1562,6 +1562,7 @@  static int process_connect(struct ceph_connection *con)
 			return -1;
+		clear_bit(NEGOTIATING, &con->state);
 		clear_bit(CONNECTING, &con->state);
 		con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq);
@@ -1951,7 +1952,6 @@  more:

 	/* open the socket first? */
 	if (con->sock == NULL) {
-		clear_bit(NEGOTIATING, &con->state);
 		set_bit(CONNECTING, &con->state);

@@ -2190,10 +2190,12 @@  static void con_work(struct work_struct *work)
 	if (test_and_clear_bit(SOCK_CLOSED, &con->flags)) {
-		if (test_and_clear_bit(CONNECTING, &con->state))
+		if (test_and_clear_bit(CONNECTING, &con->state)) {
+			clear_bit(NEGOTIATING, &con->state);
 			con->error_msg = "connection failed";
-		else
+		} else {
 			con->error_msg = "socket closed";
+		}
 		goto fault;