common: ping existing admin socket before unlink

When a daemon initializes it tries to create an admin socket and unlinks
any pre-existing file, regardless. If such a file is in use, it causes
the existing daemon to loose its admin socket.

The AdminSocketClient::ping is implemented to probe an existing socket,
using the "0" message. The AdminSocket::bind_and_listen function is
modified to call ping() on when it finds existing file. It unlinks the
file only if the ping fails.

http://tracker.ceph.com/issues/7188 fixes: #7188

Backport: emperor, dumpling
Reviewed-by: Sage Weil <sage@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
Merge pull request #1246 from dachary/wip-7188

common: ping existing admin socket before unlink
ceph_rest_api.py: don't fail if no up OSDs found on startup

allow find_up_osd() to return None, and have caller check for it

Fixes: #7463
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Merge pull request #1261 from ceph/wip-7463

ceph_rest_api.py: don't fail if no up OSDs found on startup

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
v0.77
doc/release-notes: v0.67.7

Signed-off-by: Sage Weil <sage@inktank.com>
doc/release-notes: v0.77

Also pending notes for v0.78

Signed-off-by: Sage Weil <sage@inktank.com>
OSDMap::_apply_primary_affinity: skip CRUSH_ITEM_NONE in non-default check

Fixes: #7482
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: David Zafman <david.zafman@inktank.com>
ReplicatedPG: fix stat uses to use the correct shard

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG::fill_in_copy_get, use getattr_maybe_cache

Also, add user_only flag to getattr_maybe_cache and cleanup
the other user.

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: ensure that ec appends are aligned

When not writing out the last chunk, _write_copy_chunk
will trim the chunk to a stripe boundary for ec pools
and adjust cursor.data_offset to compensate.

Signed-off-by: Samuel Just <sam.just@inktank.com>
ECBackend: handle short reads

async reads may have a length past the end of the object.

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: assert no omap for ec pool in _write_copy_chunk and skip

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: fix scrub feature check

acting[0] isn't necessarily the primary.  Start at
0 and explicitely skip the primary.

Signed-off-by: Samuel Just <sam.just@inktank.com>
RadosModel: copyfrom should result in a dirty object

Signed-off-by: Samuel Just <sam.just@inktank.com>
Merge branch 'next'

Conflicts:
	src/test/admin_socket.cc

Signed-off-by: Ken Dreyer <ken.dreyer@inktank.com>
ReplicatedPG::on_global_recover: requeue degraded, then unreadable

We need to requeue in reverse order since we are requeueing at the
front.

Signed-off-by: Samuel Just <sam.just@inktank.com>
ECBackend: deal with temp collection details in handle_sub_write

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG::build_might_have_unfound: skip CRUSH_ITEM_NONE

Signed-off-by: Samuel Just <sam.just@inktank.com>
Merge remote-tracking branch 'upstream/wip-copyget' into next

Fixes: #7471
Reviewed-by: Greg Farnum <greg@inktank.com>