mds: use lock-safe OSDMap accessors; adjust Objecter wait_for_map call

We need to handle a race between when we inspect the OSDMap and when we
try to wait for the next map.

Signed-off-by: Sage Weil <sage@redhat.com>
mds/SnapServer: use lock safe OSDMap accessors

Signed-off-by: Sage Weil <sage@redhat.com>
osdc/Filer: use lock-safe OSDMap accessors

Signed-off-by: Sage Weil <sage@redhat.com>
osdc/Objecter: make OSDMap private

Signed-off-by: Sage Weil <sage@redhat.com>
osdc/Objecter: take over ownership of OSDMap

Instead of taking a pointer to an existing OSDMap in our constructor,
allocate our own, so that we completely own it.

Signed-off-by: Sage Weil <sage@redhat.com>
mds: mark objecter completions with _IO_, take mds_lock

For any completion we pass directly to Objecter, make sure we take the
mds_lock in finish(), and mark the class with _IO_ in the name.

Note that this doesn't address the use of Journaler.  And this assumes that
we are not holding the mds_lock already when Objecter::handle_osd_op_reply
is called.

Signed-off-by: Sage Weil <sage@redhat.com>
mds: push objecter completions to a Finisher

Most/all of the MDS completions need to be reentrant (and potentially
call back into the Objecter).  Shove them all onto a Finisher to make
sure that is safe.

Signed-off-by: Sage Weil <sage@redhat.com>
include/Context: add generic C_Lock

Wrap a callback in a Mutex.

Signed-off-by: Sage Weil <sage@redhat.com>
client: add a Finisher for the Objecter

Signed-off-by: Sage Weil <sage@redhat.com>
client: let Objecter dispatch directly

Add Objecter as a direct dispatcher.  Drop all of the callbacks and
messages we were passing along.  Wrap the IO completions in client_lock
(via C_Lock) and shunt them to the objecter_finisher.

Signed-off-by: Sage Weil <sage@redhat.com>
librados dispatch fix
mon/MonClient: fix shutdown typo

Signed-off-by: Sage Weil <sage@redhat.com>
osdc/Objecter: ignore messenger events before or after initalized

Signed-off-by: Sage Weil <sage@redhat.com>
mds: allow Objecter to dispatch its own messages

Signed-off-by: Sage Weil <sage@redhat.com>
librados/RadosClient: remove unused get_pool_name()

Signed-off-by: Sage Weil <sage@redhat.com>
librados: wait for map on create_ioctx failure

Ensure we have a map so we don't simply complain that a pool doesn't
exists.  Only take the lock and wait if we fail to lookup the pool,
though, so we avoid contending the lock in the general case.

Signed-off-by: Sage Weil <sage@redhat.com>