libceph: fix protocol feature mismatch failure path
PATCH 1/1 libceph: fix protocol feature mismatch failure path
We should not set con->state to CLOSED here; that happens in ceph_fault() in the caller, where it first asserts that the state is not yet CLOSED. Avoids a BUG when the features don't match.
--- net/ceph/messenger.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/ceph/messenger.c +1 -1
@@ -1508,9 +1508,9 @@ static int process_banner(struct ceph_connection *con)static void fail_protocol (struct ceph_connection *con) { +dout ("fail_protocol %p\n" , con);reset_connection (con);BUG_ON (con->state !=CON_STATE_NEGOTIATING ); - con->state =CON_STATE_CLOSED ; }static int process_connect (struct ceph_connection *con)
Signature · 1 line
1.7.9
Quoted 2 lines · Sage Weil
We should not set
con->stateto CLOSED here; that happens inceph_fault()in the caller, where it first asserts that the state is not yet CLOSED.
I'm not seeing the code path you're talking about. Do you mean in the LOSSYTX case?
(I don't doubt you're right, I'm just trying to follow along at home.)
Quoted 1 line
Avoids a BUG when the features don't match.
Is this related to the crashes reported here?
http://tracker.newdream.net/issues/3657
Quoted 10 lines
Signed-off-by Sage Weil <[email protected]>--- net/ceph/messenger.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)net/ceph/messenger.c +0
-0
net/ceph/messenger.c static int process_banner(struct ceph_connection *con) · line 1513
Quoted 6 lines
net/ceph/messenger.c +1
-0@@ -1508,9 +1508,9 @@ static int process_banner(struct ceph_connection *con)static void fail_protocol (struct ceph_connection *con) { +dout ("fail_protocol %p\n" , con);reset_connection (con);BUG_ON (con->state !=CON_STATE_NEGOTIATING );
Since fail_protocol becomes essentially a trivial wrapper for reset_connection(), I think it should just go away and call reset_connection() directly. The assertion that it's in NEGOTIATING state is not very useful at the moment; fail_protocol() is only called from process_connect(), and that's only called from try_read when the state is NEGOTIATING.
-Alex
Quoted 5 lines
net/ceph/messenger.c +0
-1- con->state =CON_STATE_CLOSED ; }static int process_connect (struct ceph_connection *con)
Quoted 6 lines · Alex Elder
Quoted 2 lines · Sage Weil
We should not set
con->stateto CLOSED here; that happens inceph_fault()in the caller, where it first asserts that the state is not yet CLOSED.I'm not seeing the code path you're talking about. Do you mean in the LOSSYTX case?
It's when the feature bits don't match. It calls this, sets CLOSED< and then returns -1 and con_work() calls ceph_fault().
Quoted 20 lines
(I don't doubt you're right, I'm just trying to follow along at home.)
Quoted 1 line
Avoids a BUG when the features don't match.
Is this related to the crashes reported here?
http://tracker.newdream.net/issues/3657Quoted 11 lines
Signed-off-by Sage Weil <[email protected]>--- net/ceph/messenger.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)net/ceph/messenger.c +0
-0@@ -1508,9 +1508,9 @@ static int process_banner(struct ceph_connection *con)
Quoted 13 lines
net/ceph/messenger.c static int process_banner(struct ceph_connection *con) · line 1513
Quoted 5 lines
net/ceph/messenger.c +1
-0static void fail_protocol (struct ceph_connection *con) { +dout ("fail_protocol %p\n" , con);reset_connection (con);BUG_ON (con->state !=CON_STATE_NEGOTIATING );Since
fail_protocolbecomes essentially a trivial wrapper forreset_connection(), I think it should just go away and callreset_connection()directly. The assertion that it's in NEGOTIATING state is not very useful at the moment;fail_protocol()is only called fromprocess_connect(), and that's only called fromtry_readwhen the state is NEGOTIATING.
Good point. I'll clean that up!
Quoted 10 lines
-Alex
Quoted 5 lines
net/ceph/messenger.c +0
-1- con->state =CON_STATE_CLOSED ; }static int process_connect (struct ceph_connection *con)