diff options
author | Sage Weil <sage@inktank.com> | 2012-06-27 15:24:08 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-07-06 00:14:35 -0400 |
commit | b7a9e5dd40f17a48a72f249b8bbc989b63bae5fd (patch) | |
tree | f4951e53776e2ec45f9b539b786be67c8a7f42a2 /net/ceph/messenger.c | |
parent | 261030215d970c62f799e6e508e3c68fc7ec2aa9 (diff) |
libceph: set peer name on con_open, not init
The peer name may change on each open attempt, even when the connection is
reused.
Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net/ceph/messenger.c')
-rw-r--r-- | net/ceph/messenger.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index dcc50e4cd5cd..ae082d95fc72 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -523,12 +523,17 @@ EXPORT_SYMBOL(ceph_con_close); | |||
523 | /* | 523 | /* |
524 | * Reopen a closed connection, with a new peer address. | 524 | * Reopen a closed connection, with a new peer address. |
525 | */ | 525 | */ |
526 | void ceph_con_open(struct ceph_connection *con, struct ceph_entity_addr *addr) | 526 | void ceph_con_open(struct ceph_connection *con, |
527 | __u8 entity_type, __u64 entity_num, | ||
528 | struct ceph_entity_addr *addr) | ||
527 | { | 529 | { |
528 | dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr)); | 530 | dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr)); |
529 | set_bit(OPENING, &con->state); | 531 | set_bit(OPENING, &con->state); |
530 | WARN_ON(!test_and_clear_bit(CLOSED, &con->state)); | 532 | WARN_ON(!test_and_clear_bit(CLOSED, &con->state)); |
531 | 533 | ||
534 | con->peer_name.type = (__u8) entity_type; | ||
535 | con->peer_name.num = cpu_to_le64(entity_num); | ||
536 | |||
532 | memcpy(&con->peer_addr, addr, sizeof(*addr)); | 537 | memcpy(&con->peer_addr, addr, sizeof(*addr)); |
533 | con->delay = 0; /* reset backoff memory */ | 538 | con->delay = 0; /* reset backoff memory */ |
534 | queue_con(con); | 539 | queue_con(con); |
@@ -548,7 +553,7 @@ bool ceph_con_opened(struct ceph_connection *con) | |||
548 | */ | 553 | */ |
549 | void ceph_con_init(struct ceph_connection *con, void *private, | 554 | void ceph_con_init(struct ceph_connection *con, void *private, |
550 | const struct ceph_connection_operations *ops, | 555 | const struct ceph_connection_operations *ops, |
551 | struct ceph_messenger *msgr, __u8 entity_type, __u64 entity_num) | 556 | struct ceph_messenger *msgr) |
552 | { | 557 | { |
553 | dout("con_init %p\n", con); | 558 | dout("con_init %p\n", con); |
554 | memset(con, 0, sizeof(*con)); | 559 | memset(con, 0, sizeof(*con)); |
@@ -558,9 +563,6 @@ void ceph_con_init(struct ceph_connection *con, void *private, | |||
558 | 563 | ||
559 | con_sock_state_init(con); | 564 | con_sock_state_init(con); |
560 | 565 | ||
561 | con->peer_name.type = (__u8) entity_type; | ||
562 | con->peer_name.num = cpu_to_le64(entity_num); | ||
563 | |||
564 | mutex_init(&con->mutex); | 566 | mutex_init(&con->mutex); |
565 | INIT_LIST_HEAD(&con->out_queue); | 567 | INIT_LIST_HEAD(&con->out_queue); |
566 | INIT_LIST_HEAD(&con->out_sent); | 568 | INIT_LIST_HEAD(&con->out_sent); |