Commit Graph

911 Commits

Author SHA1 Message Date
Sage Weil
2a1eb466d3 msg/Pipe: fix msg leak in requeue_sent()
The sent list owns a reference to each message.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-01-06 20:38:22 -08:00
Sage Weil
94a5dd6b76 Merge remote-tracking branch 'gh/wip-3675'
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
2012-12-31 18:36:39 -08:00
Sage Weil
82f8bcddb5 msg/Pipe: use state_closed atomic_t for _lookup_pipe
We shouldn't look at Pipe::state in SimpleMessenger::_lookup_pipe() without
holding pipe_lock.  Instead, use an atomic that we set to non-zero only
when transitioning to the terminal STATE_CLOSED state.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-12-28 17:21:01 -08:00
Sage Weil
a5d692a7b9 msgr: inject delays at inconvenient times
Exercise some rare races by injecting delays before taking locks
via the 'ms inject internal delays' option.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-12-28 17:21:01 -08:00
Sage Weil
e99b4a307b msgr: fix race on Pipe removal from hash
When a pipe is faulting and shutting down, we have to drop pipe_lock to
take msgr lock and then remove the entry.  The Pipe in this case will
have STATE_CLOSED.  Handle this case in all places we do a lookup on
the rank_pipe hash so that we effectively ignore entries that are
CLOSED.

This fixes a race introduced by the previous commit where we won't use
the CLOSED pipe and try to register a new one, but the old one is still
registered.

See bug #3675.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-12-28 17:21:00 -08:00
Sage Weil
6339c5d439 msgr: don't queue message on closed pipe
If we have a con that refs a pipe but it is closed, don't use it.  If
the ref is still there, it is only because we are racing with fault()
and it is about to (or just was) be detached.  Either way,

Signed-off-by: Sage Weil <sage@inktank.com>
2012-12-28 17:21:00 -08:00
Sage Weil
7bf0b0854d msgr: atomically queue first message with connect_rank
Atomically queue the first message on the new pipe, without dropping
and retaking pipe_lock.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-12-28 17:21:00 -08:00
Sage Weil
83c8025d12 Merge remote-tracking branch 'gh/next' 2012-12-28 17:19:46 -08:00
Sage Weil
0a5d6d8759 msg/Pipe: remove broken cephs signing requirement check
Remove the special-case check, which does not inform the peer what
protocol features are missing.  It also enforces this requirement even
when we negotiate auth none.

Reported as part of bug #3657.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-12-28 17:10:28 -08:00
Sage Weil
65b787ea2a msg/Pipe: include remote socket addr in debug output
Signed-off-by: Sage Weil <sage@inktank.com>
2012-12-28 16:00:47 -08:00
Sage Weil
64b845f6ba features is uint64_t
This won't bite us for a while yet (we're on bit 26), but it will soon!

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
2012-12-27 17:24:54 -08:00
Sage Weil
f3bd3564fa Merge branch 'wip-msgr-delay-queue' into next 2012-12-04 14:52:22 -08:00
Sage Weil
8dcc6c399c msg/Pipe: flush delayed messages when stealing/failing pipes
If we are failing a pipe, flush the incoming messages before we try to
reconnect.  Similarly, flush queued messages on an existing pipe beore we
replace it.  This ensures that when we get a socket failure and reconnect
the delayed messages are handled in the normal fashion.

Specifically, it fixes a situation like:

 - read msg, update in_seq etc.
 - delay msg
 - pipe faults
 - peer reconnects, we replace existing pipe, discard delayed msgs
 - peer resends msgs
 - we discard, because they are < in_seq

Signed-off-by: Sage Weil <sage@inktank.com>
2012-12-01 12:45:22 -08:00
Samuel Just
47699f39b9 osd/: make OSDService messenger helpers return ConnectionRef
Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-11-30 11:08:55 -08:00
Sage Weil
6d65fa4ef9 msg/Pipe: release dispatch throttle on delayed queue discard
This avoids leaking into the throttle and deadlocking.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-29 16:09:45 -08:00
Sage Weil
158260b6ae msg/Pipe: start delay thread *after* we know peer type
At end of connect(), or end of accept().

Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-29 16:09:45 -08:00
Sage Weil
f0bf616878 msg/Pipe: drop queue helpers
There is a single caller; these only obfuscate.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-29 16:09:45 -08:00
Sage Weil
f454bb591d msg/Pipe: refactor msgr delays
- move all delay state into a single class
- create thread once and only once per Pipe
- adjust debug levels
- discard messages at the appropriate times

Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-29 16:09:45 -08:00
Greg Farnum
b97aaca387 msgr: add a delay_until queue that is used to delay deliveries.
Its life-cycle matches that of delay_queue, and the delayed_delivery
function respects it. For now queue_received is just setting it to
delay everything by 1 second.

Signed-off-by: Greg Farnum <greg@inktank.com>
2012-11-29 16:09:45 -08:00
Greg Farnum
01059e9b43 msgr: clear out the delay queue when stop()ing
After some brief thought, I believe deleting any messages in the
delay queue is correct -- we are trying to simulate line delays
in delivery and so anything still in the queue has supposedly
not arrived yet. So delete them when we stop the Pipe for
any reason.

Signed-off-by: Greg Farnum <greg@inktank.com>
2012-11-29 16:09:44 -08:00
Greg Farnum
0e92f89204 msgr: move the delay queue initialization into start_reader
The Pipe doesn't know the peer type in the constructor. It
doesn't always know in start_reader either, so this needs more work,
but at least it knows more frequently than it did.

Signed-off-by: Greg Farnum <greg@inktank.com>
2012-11-29 16:09:44 -08:00
Greg Farnum
90f66980bf messenger: add the shell of a system to delay incoming Message delivery
When ms_inject_delay_type matches that of the incoming Connection,
the Pipe sets up a delay queue that it shuttles all Messages through.
This lets us check cleanup and some notification code but doesn't
actually generate any delays.

Signed-off-by: Greg Farnum <greg@inktank.com>
2012-11-29 16:09:44 -08:00
Greg Farnum
820911b265 msgr: use get_myaddr and set_myaddr to set the nonce
We can't set it directly via get_myaddr as its a const ref. Dur.

Signed-off-by: Greg Farnum <greg@inktank.com>
2012-11-21 12:00:37 -08:00
Greg Farnum
c31f94d152 set the nonce unconditionally on bind 2012-11-21 10:55:35 -08:00
Sage Weil
82042adfe0 msg/Pipe: remove useless reader_joining
We set it but do not read it.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-18 08:29:01 -08:00
Sage Weil
c07c93e01d msg/Pipe: join previous reader threads
We may stop and then restart the reader thread.  Join previous threads
before we create new ones.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-18 08:29:00 -08:00
Sage Weil
c4caf871aa msg/DispatchQueue: fix message leak from discard_queue()
We need to drop the Message ref() here; the msgr owns one ref
independent of those from the intrusive_ptr's in the queue itself.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-18 08:29:00 -08:00
Sage Weil
183953e14b msg/SimpleMessenger: use put() on local_connection
This aids leak debugging; not much else.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-18 08:29:00 -08:00
Sage Weil
e0e9a2dab7 msg/Pipe: don't leak session_security
Make sure we free old instances of sesseion_security before we reset the
pointer.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-18 08:29:00 -08:00
Sage Weil
25f003ba5f msg/Accepter: only close socket if >= 0
It is possible for rebind() to fail, in which case the OSD will go through
it's shutdown procedure and call stop().  This is simpler than trying to
avoid calling stop() when rebind() fails.

Fixes: #3504
Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-16 16:10:56 -08:00
Samuel Just
b53e06cac8 DispatchQueue: lock DispatchQueue when for get_queue_len()
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2012-11-15 15:59:18 -08:00
Sage Weil
b40387de23 msg/Pipe: fix leak of Authorizer
Reported-by: Joao Luis <joao.luis@inktank.com>
Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-15 10:06:07 -08:00
Samuel Just
12c2b7fa20 msg/DispatchQueue: release throttle on messages when dropping an id
Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-11-14 17:05:58 -08:00
Samuel Just
bd4707ad9a msg/: use PrioritizedQueue to handle DispatchQueue queueing
Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-11-13 10:45:00 -08:00
Samuel Just
bbdae98115 Pipe: we don't queue DispatchQueue codes on an actual pipe
The dispatch queue event codes are now queued directly and
won't end up in a real Pipe.

Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-11-13 10:45:00 -08:00
Samuel Just
d12911252b common: add RefCountedObj.cc with intrusive_ptr hooks
Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-11-13 10:45:00 -08:00
Samuel Just
14730d77e3 Merge remote-tracking branch 'upstream/wip_recovery_reserve'
Reviewed-by: Samuel Just <sam.just@inktank.com>
2012-11-07 17:24:04 -08:00
Sage Weil
92604ce4af Merge branch 'wip-msgr-ports'
Reviewed-by: Greg Farnum <greg@inktank.com>
2012-11-04 05:06:18 -08:00
Sage Weil
7483d1f990 msg/Accepter: use derr
Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-04 05:04:42 -08:00
Sage Weil
623553d2b8 msgr: make bind port range configurable
Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-04 05:04:42 -08:00
Sage Weil
bcefc0e80a msg/Pipe: fix leak of AuthSessionHandler
Init ptr in ctor, delete in dtor.

Reported-by: Yan, Zheng <yan.zheng@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
2012-11-04 01:10:49 -08:00
Mike Ryan
d2c6d44b27 message: add MRecoveryReserve
This message will be used to reserve and release recovery slots on
replica PGs.

Signed-off-by: Mike Ryan <mike.ryan@inktank.com>
2012-11-01 01:05:01 -07:00
Sage Weil
184a676e64 msg/SimpleMessenger: start accepter in ready()
Start the accepter thread when the first dispatcher is ready.  This ensures
that there will be someone around to verify authorizers for incoming
connections, and means we have a bit less failure noise on the monitors
as a result.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-30 13:21:48 -07:00
Sage Weil
5dd5471643 msg/Pipe: fix seq # fix
02f6262f47 got this all wrong (though it
worked by accident).

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-30 13:21:48 -07:00
Sage Weil
a4db58fc11 msg/Pipe: whitespace cleanup
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-30 10:00:54 -07:00
Sage Weil
02f6262f47 msg/Pipe: only randomize start seq #'s if MSG_AUTH feature is present
The kernel client expects seq #'s to start at 1 or else it is unhappy.
So, only randomize these values if the MSG_AUTH feature is present--that is
the only time it matters anyway.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-30 10:00:42 -07:00
Sage Weil
56bce3ba26 auth: include features in cephx SessionHandler
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-29 15:47:45 -07:00
Peter Reiher
100fcca3cb Fixed problem with checking authorizer in accept().
Signed-off-by: Peter Reiher <reiher@inktank.com>
2012-10-29 14:47:14 -07:00
Peter Reiher
2157bcbf65 Temporary patch to a problem in Pipe related to monitor initialization.
Signed-off-by: Peter Reiher <reiher@inktank.com>
2012-10-29 12:42:29 -07:00
Peter Reiher
a67afa4b09 Merge branch 'wip-msgauth4'
Conflicts:
	src/common/config_opts.h
	Added a couple of options related to session authentication, accepted new values for option from master
2012-10-26 09:25:15 -07:00
Peter Reiher
ffb8c605a8 Various cleanup changes to session authentication code.
Signed-off-by: Peter Reiher <reiher@inktank.com>
2012-10-26 08:57:29 -07:00
Sage Weil
74ef52bcff Merge branch 'wip-msgr' 2012-10-22 14:47:24 -07:00
Sage Weil
4d20b60970 msg/Pipe: fix tight reconnect loop on connect failure
The fault() call in connect should not set onread=true since connect is
effectively a write path.  This was forcing the writer() into a tight
loop that repeatedly would call connect(); not very polite.

Changing that, we want to avoid treating this as a normal fault (with the
failure callback) and instead back off.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
2012-10-22 14:47:01 -07:00
Sage Weil
0d3a53d482 msg/Pipe: correctly read from peers without MSG_AUTH
Read the old footer format if the feature isn't present on the
connection.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-16 09:35:52 -07:00
Sage Weil
fcf6273d04 Merge remote-tracking branch 'gh/wip-msgauth4' 2012-10-15 20:57:19 -07:00
Sage Weil
d123e31850 msg/Pipe: avoid duplicated code to randomize out_seq
Use helper.

Fix whitespace.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-13 12:39:14 -07:00
Sage Weil
ad97bbb0a1 Merge remote-tracking branch 'gh/next' 2012-10-04 10:08:46 -07:00
Dan Mick
01bfe55962 Merge branch 'wip-msgr' into next 2012-10-02 16:06:59 -07:00
Dan Mick
67a201d64b Avoid sign-extension of non-magic Message* values
Cast to (unsigned long) when checking for magic values, so
real ptrs don't get sign-extended.  Avoids triggering
assert(inq == &local_queue) failure.

Fixes: #3251
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Sage Weil <sage.weil@inktank.com>
2012-10-02 16:04:35 -07:00
Peter Reiher
1166f3a085 Compatibility code for session authentication; mostly passing keys around to where they're needed.
Signed-off-by: Peter Reiher <reiher@inktank.com>
2012-10-01 13:14:10 -07:00
Peter Reiher
2b56e800b5 Code to allow pipes to be prepared to sign messages and to call the authentication methods for signing and checking.
Signed-off-by: Peter Reiher <reiher@inktank.com>
2012-10-01 13:13:40 -07:00
Sage Weil
b5fb298d38 msg/Messenger: avoid large pass by value
CID 717049: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter bind_addr of type entity_addr_t (size 136 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
797d3ccb7a msg/Accepter: check getsockbyname() return value
CID 717442: Other violation (CHECKED_RETURN)
At (10): Calling function "getsockname(this->listen_sd, (sockaddr *)listen_addr.ss_addr(), &llen)" without checking return value. This library function may fail and return an error code.
At (11): No check of the return value of "getsockname(this->listen_sd, (sockaddr *)listen_addr.ss_addr(), &llen)".

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
a351f7a1f4 Merge remote-tracking branch 'gh/wip_backfill_full2'
Conflicts:
	src/include/ceph_features.h
2012-09-27 13:21:23 -07:00
Samuel Just
b54a0a252c osd/: add backfill reservations
Previously, a new osd would be bombarded by backfills from many osds
simultaneously, resulting in excessively high load.  Instead, we
want to limit the number of backfills coming into and going out
from a single osd.

To that end, each OSDService now has two AsyncReserver instances: one
for backfills going from the osd (local_reserver) and one for backfills
going to the osd (remote_reserver).  For a primary to initiate a
backfill, it must first obtain a reservation from its own
local_reserver.  Then, it must obtain a reservation from the backfill
target's remote_reserver via a MBackfillReserve message. This process is
managed by substates of Active and ReplicaActive (see the changes in
PG.h).  The reservations are dropped either on the Backfilled event,
which is sent on the primary before calling recovery_complete and on the
replica on receipt of the BackfillComplete progress message), or upon
leaving Active or ReplicaActive.

It's important that we always grab the local reservation before the
remote reservation in order to prevent a circular dependency.

Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-09-25 11:43:47 -07:00
Sage Weil
3b4f754a18 msg/Accepter: assert that listen_sd always >= 0
The listen_sd is set by bind(); we should never call stop() when it is
is still negative.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-21 10:17:00 -07:00
Sage Weil
f13eaf4ca8 msg/Accepter: fix race in accepter shutdown
We want to avoid a race like:

- entry() starts, populates pfd with listen_sd, gets past !done check
- stop() does shutdown + close on listen_sd
- someone else opens a new fd
- entry() thread calls poll(2) on wrong sd
- stop() calls join, waits forever for entry thread

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-21 10:17:00 -07:00
Sage Weil
46b86426e8 Merge branch 'wip-msgr'
Reviewed-by: Greg Farnum <greg@inktank.com>
2012-09-04 12:17:13 -07:00
Sage Weil
035cf96501 msg/Pipe: kill useless onconnect arg
This reduces debug output but nothing else, for know discernable reason.
Drop it.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-04 11:54:44 -07:00
Sage Weil
4ab9f02f2a msg/Pipe: do not special-case failure during connect
Do not special case failure during connect.  In particular, we may be
reconnecting and experience a second fault, and wipe out our session
(e.g., between the fs client and the mds) and destroy important session
state.

This logic dates back to the original patch in '08 when the standby
state was introduced.

Bug: #3070
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-03 14:00:27 -07:00
Sage Weil
ea078e1872 msg/DispatchQueue: simplify shutdown()
lcok isn't held during dispatch, so we can take it unconditionally.  THis
also makes coverity happier:

CID 716966: Data race condition (MISSING_LOCK)
At (4): Accessing "this->stop" ("DispatchQueue.stop") requires the "Mutex._m" lock.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-31 13:11:35 -07:00
Sage Weil
b7af8d8bb0 msg/Message: fix possible null deref
cct may be null

CID 716930: Dereference after null check (FORWARD_NULL)
At (11): Dereferencing null pointer "cct".

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-31 13:11:35 -07:00
Sage Weil
650ec35b08 msg: pass by reference
CID 717048: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter a of type entity_addr_t (size 136 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-31 13:11:35 -07:00
Sage Weil
a3bf558ab8 fix accepter bind fix 2012-08-31 13:11:35 -07:00
Sage Weil
4eb31463e9 msg/Accepter: move nonce init to ctor
This was suggested by Greg too but I was too lazy.

CID 717331: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "nonce" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-31 13:11:35 -07:00
Sage Weil
ec5133b09c msg/Pipe: make banner buffer slightly bigger
CID 717023: Out-of-bounds access (OVERRUN_DYNAMIC)
At (4): Allocating insufficient memory for the terminating null of the string.

This appears to be a false positive (we don't interpret the buffer as a
string, ever), but it will make coverity happier.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-31 13:11:35 -07:00
Sage Weil
1b1a0bf60a msg/Accepter: check setsockopt return value
CCID 716856: Other violation (CHECKED_RETURN)
At (7): Calling function "setsockopt(this->listen_sd, 1, 2, &on, 4U)" without checking return value. This library function may fail and return an error code.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-31 13:11:34 -07:00
Sage Weil
d47c9af6b2 Merge branch 'wip-msgr' 2012-08-23 13:29:10 -07:00
Sage Weil
e229f8451d msg/Pipe: conditionally detect session reset
Lossless peers (osd<->osd, mds<->mds, mon<->mon) never reset sessions
to each other.  In the osd and mds cases, there is no need to check for
session resets.  More significantly, these checks can trigger with an
unfortunately sequence of socket failures.  In particular,

 - A sends connect request to B
 - B accepts, increments connect_seq, then has a socket failure
   before telling A
 - A reconnects, stil with connect_seq == 0
 - B sees connect_seq == 0 and thinks there was a reset

This warrants a closer look in the fs client <-> mds case, but for now,
in the cluster-internal communications, it is moot, since reset
detection is unnecessary.

In the monitor case: we do need to check with resets because the peers
reuse the same entity_addr_t's (nonce==0), which means that a daemon
restart is effectively a reset.  In that case, use a different policy
that continues to check for resets.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
2012-08-23 13:28:57 -07:00
Sage Weil
7141a6ce53 msg/Pipe: log port number
This helps correlate log output with specific tcp sessions as reported by
e.g. netstat or tcpdump or whatever.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-17 11:46:37 -07:00
Sage Weil
ef80abed73 msg/SimpleMessenger: fix leak of local_connection
Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-16 14:43:07 -07:00
Samuel Just
08b8bba433 Merge branch 'next' 2012-08-15 15:21:09 -07:00
Samuel Just
3e7df78e67 PG,Message: move intrusive_ptr_* into top namespace
gcc 4.7 requires that the intrusive_ptr_* functions be in
the same namespace as the templated class.

Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-08-15 14:40:17 -07:00
Sage Weil
efe913b886 Merge branch 'wip-crush-tunables'
Reviewed-by: Greg Farnum <greg@inktank.com>
2012-08-14 13:13:03 -07:00
Sage Weil
da35b4c207 msgr: make set_policy_throttler safe, act on default
Add locking in set_policy_throttler.

Also, make it act on the default policy when the specified type does not
have a sepcific policy set for it.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-14 10:42:37 -07:00
Sage Weil
73218a7a65 msgr: make set_policy() and set_default_policy() safe to re-use
Introduce a policy_lock in SimpleMessenger to make this safe even after
the messenger has been started up.  The user needs to be aware that
policy changes will not affect connections that are already established.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-14 10:42:37 -07:00
Sage Weil
4e7d49e0c6 Merge branch 'wip-msgr' 2012-08-13 13:34:29 -07:00
Sage Weil
75172c70ab msg/Accepter: fix nonce initialization
This needs to be provided to the Accepter at bind time, not by start().
Otherwise the nonce is effectively always 0, which is useless and breaks
all sorts of things.  Broken by 8453a8198c.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-13 13:28:42 -07:00
Sage Weil
8af2cf3ca0 msgr: expose get_policy() through generic Messenger API
Return a copy instead of a const reference, too...

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-13 11:03:50 -07:00
Sage Weil
95ecab27cb Merge branch 'wip-msgr' 2012-08-13 09:58:49 -07:00
Sage Weil
ac02b34ed8 msg/Pipe: discard_queue() -> discard_out_queue()
We only discard outgoing messages; incoming messages are handled by the
IncomingQueue.. but this method doesn't touch that.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-13 08:46:15 -07:00
Sage Weil
d58df35f88 msg/Pipe: simplify Pipe::tcp_read() return value
0 for success; no reason to return length (always == len).

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-13 08:46:14 -07:00
Sage Weil
76954c13c1 msg/Pipe: document tcp_*()
Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-13 08:46:14 -07:00
Sage Weil
5d5045d31a msg/Accepter: use learned_addr() from Accepter::bind()
Normally we never go from need_addr == false to need_addr == true.
It always starts out as true, so this else is useless on the first
call to Accepter::bind().

The only exception is rebind().  Add an unlearn_addr() that will clear
need_addr.  This is almost unnecessary, but doing so fixes a small bug
where the local_connection->peer_addr doesn't get updated when we do a
rebind().

Drop now-unused set_need_addr().  We keep get_need_addr() only because
it is useful in the debug output and for the assert.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-13 08:46:14 -07:00
Sage Weil
1b8f2e0599 msg/SimpleMessenger: push need_addr check into learned_addr()
This puts all of the do/do not lock logic in one place, and documents
it.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-13 08:46:14 -07:00
Sage Weil
8453a8198c msg/Accepter: pass nonce on start
This lets us drop the otherwise awkward SimpleMessenger::get_nonce()
accessor.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-13 08:46:14 -07:00
Sage Weil
a0017fcc25 msgr: protect set_myaddr()
This is used by Messenger implementation (and their constituent
components).

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-13 08:46:14 -07:00
Sage Weil
c84b7289c1 msg/Accepter: make members private
Nobody uses these.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-13 08:46:14 -07:00
Sage Weil
608c776bf9 msgr: remove useless SimpleMessenger::msgr
Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-13 08:46:14 -07:00
Sage Weil
b97f6e3544 msgr: some SimpleMessenger docs
Document basic modules and the lock ordering.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-13 08:46:14 -07:00