check endpoints is not empty before use it.

Signed-off-by: VRan Liu <gliuwr@gmail.com>
(cherry picked from commit 9d5e4edc15678de675d7a77badcbace0b710d553)
mon: fix `fs ls` on peons

This was incorrectly using pending_mdsmap instead
of mdsmap.  We didn't notice in test because of
single-mon configurations.

Fixes: #10288
Backport: giant

Signed-off-by: John Spray <john.spray@redhat.com>
os: do not attempt to detect discard by default

If the journal_discard option is false, the journal should no try to
guess if the device has discard capabilities.

http://tracker.ceph.com/issues/10296 Refs: #10296

Signed-off-by: Loic Dachary <ldachary@redhat.com>
tests: do not ignore ceph-disk.sh::test_activate_dev failure

The status of the test commands must be tested instead of being
silently ignored.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
Merge pull request #3152 from dachary/wip-10296-journal-discard

os: do not attempt to detect discard by default

Reviewed-by: Sage Weil <sage@redhat.com>
Merge pull request #3150 from ceph/wip-10288

mon: fix `fs ls` on peons

Reviewed-by: Greg Farnum <gfarnum@redhat.com>
PGLog: trim mod_desc after appending to the log

We'll want he callers up the chain to take the log
entry as a const ref.

Signed-off-by: Samuel Just <sjust@redhat.com>
PG::add_log_entry: no need to 0 offset in append_log

No longer used.

Signed-off-by: Samuel Just <sjust@redhat.com>
osd/: pass log_entries in write path as const ref

We need to use them after the submit_transaction call, so
we can't pass them by non-const ref.

Signed-off-by: Samuel Just <sjust@redhat.com>
osd/: s/backfill_read/recovery_read for obc locking

We are going to expand our usage of this for normal
replica recovery.

Signed-off-by: Samuel Just <sjust@redhat.com>
PGBackend: rename clear_state to clear_recovery_state

This is called when we complete recovery, and does not clear
all state.  clear_recovery_state is clearer.

Signed-off-by: Samuel Just <sjust@redhat.com>
ReplicatedPG: always take recovery_read_lock for recovery

Signed-off-by: Samuel Just <sjust@redhat.com>
osd/: update peer_missing and local missing if we write a degraded object

Signed-off-by: Samuel Just <sjust@redhat.com>
osd/: don't block writes on degraded objects

Signed-off-by: Samuel Just <sjust@redhat.com>
PG::purge_strays: purge peer_missing as well

Signed-off-by: Samuel Just <sjust@redhat.com>
osd/: go "peered" instead of "active" when < min_size

In the case of a replicated pool, the pg will transition to "peered"
rather than "active", where it can perform backfill bringing itself up
to min_size peers.  To that end, most operations now require
is_peered rather than is_active (OSDOps being the primary exception).
Also, rather than using the query_epoch on the activation message as the
activation epoch (for last_epoch_started) on the replica, we instead
use the last_epoch_started in the info sent by the primary.  This
allows the primary to not advance last_epoch_started past the last
known actual activation.  This will prevent later peering epochs from
requiring the last_update from a peered epoch to go active (might be
divergent).  We do allow scrubbing while peered.

Fixes: #7862
Signed-off-by: Samuel Just <sam.just@inktank.com>
OSD: allow recovery and scrub in peered

Signed-off-by: Samuel Just <sjust@redhat.com>
ReplicatedPG: only populate_obc_watchers if active

Signed-off-by: Samuel Just <sjust@redhat.com>
Merge remote-tracking branches 'athanatos/wip-10059', 'athanatos/wip-10150', 'athanatos/wip-10157', 'athanatos/wip-10259', 'athanatos/wip-7861', 'athanatos/wip-7862', 'athanatos/wip-8011' and 'upstream/master' into wip-sam-working