ceph: return error code when failing to get result from admin socket

Make sure we return a non-zero result code when we fail to read something
from the admin socket.

Backport: cuttlefish, bobtail
Signed-off-by: Sage Weil <sage@inktank.com>
OSD: snap collections can be ignored on split

Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
PG: clear snap_collections on upgrade

Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
OSD: handle stray snap collections from upgrade bug

Previously, we failed to clear snap_collections, which causes split to
spawn a bunch of snap collections.  In load_pgs, we now clear any such
snap collections and then snap_collections field on the PG itself.

Related: #4927
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Merge branch 'wip_split_upgrade' into next

Fixes: #4927
init-ceph: fix osd_data location when checking df utilization

Do not assume default osd data location.

Fixes: #4951
Backport: cuttlefish, bobtail
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Gary Lowelll <gary.lowell@inktank.com>
ceph-create-keys: gracefully handle no data from admin socket

Old ceph-mon (prior to 393c9372f82ef37fc6497dd46fc453507a463d42) would
return an empty string and success if the command was not registered yet.
Gracefully handle that case by retrying.

If we still fail to parse, exit entirely with EINVAL.

Fixes: #4952
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@intank.com>
OSD,PG: lock_with_map_lock_held() is the same as lock()

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: reassert_lock_with_map_lock_held() is dead

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: rename must_delay_request to op_must_wait_for_map, make static

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG,OSD: delay ops for map prior to queueing in the OpWQ

Previously, we simply queued ops in the OpWQ without checking.  The PG
would then check in do_request whether the message should wait for a new
map.  Unfortunately, this has the side effect that any op requeued for
any reason must also requeue the waiting_for_map queue.

Now, we will check before queueing the op whether it must wait on a map.
To avoid contention, there is now a map_lock which must be held along
with the PG lock in order to update the osdmap_ref.  The map_lock also
protects the waiting_for_map list and queueing PG ops at the back of
the OpWQ.  A few details:
1) It is no longer necessary to requeue waiting_for_map in on_change()
since the other ops are queued at the front.
2) Once waiting_for_map is non-empty, all ops are delayed to simplify
ordering.
3) waiting_for_map may now be non-empty during split, so we must split
waiting_for_map along with waiting_for_active.  This must be done
under the map_lock.

Signed-off-by: Samuel Just <sam.just@inktank.com>
Merge remote-tracking branch 'upstream/wip_4955' into wip_pg_res
common/sharedptr_registry.hpp: add remove

remove() can be used to clear an entry before all of its
references are removed.

Signed-off-by: Samuel Just <sam.just@inktank.com>
OSD: remove the deleting state ref on cancelation

When the PG deletion is canceled, remove the DeletingState ref
from the registry.  Subsequent operations do not need to wait for
remaining references to go away.

Signed-off-by: Samuel Just <sam.just@inktank.com>