mon: Properly handle errors from 'cmd_getval()' when needed

Not handling the error return from cmd_getval() may leave uninitialzied
values, which can cause issues, specially with non-string values.

Fixes: 6806

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: Monitor: handle invalid 'quorum' command argument

Don't rely on client side validation of possible command arguments.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: OSDMonitor: don't rely on client-side validation for command arguments

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Merge pull request #1490 from ceph/wip-6806

mon: Properly handle errors from 'cmd_getval()' when needed

Reviewed-by: Sage Weil <sage@inktank.com>
PG::find_best_info: fix log_tail component

The previous logic should have kept the current best info if it found a
replica which best could log-recover, but p couldn't.  However, the
continue in that loop advanced the inner loop instead of the outer loop
allowing the primary case to take over in cases where best had a longer
tail.  Instead, we will prefer the longer tail regardless of the other
infos to simplify the logic.

Fixes: #7755
Signed-off-by: Samuel Just <sam.just@inktank.com>
PG::start_peering_interval: always send_notify if !primary

Otherwise, we might get into a situation where the primary
forgets about a stray pg.  This is simpler and does not
increase the number of notifies by much.

Fixes: #7733
Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG::do_op: delay if snapdir is unreadable

Since all we really need on a snapdir is the context, we really only
need it to be !missing.  However, it might become !missing before it
becomes !unreadable.  That allows ops to end up in the
waiting_for_degraded queue before one in waiting_for_unreadable is
woken, which allows the ops to be reordered.  Rather than reintroduce an
extra waiting_for_missing queue, simply require !unreadable for snapdir
(which implies !misssing).

Fixes: #7777
Signed-off-by: Samuel Just <sam.just@inktank.com>
osd: add flush_journal admin socket command

Add flush_journal admin socket command to be able to flush journal to
the permanent store for online osds.  (For offline osds we already have
ceph-osd --flush-journal.)

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
qa: test_alloc_hint: flush journal before prodding the FS

OSDs that for some reason get behind on processing their op queue break
expect_alloc_hint_eq(), as it pokes the FS and not the journal.  Fix it
by flushing the journal before proceeding with anything else.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Merge pull request #1502 from ceph/wip-flush-journal-asok

wip-flush-journal-asok

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Merge pull request #1508 from ceph/wip-7777

ReplicatedPG::do_op: delay if snapdir is unreadable

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #1507 from ceph/wip-7733

PG::start_peering_interval: always send_notify if !primary

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #1506 from ceph/wip-7755

PG::find_best_info: fix log_tail component

Reviewed-by: Sage Weil <sage@inktank.com>
Merge remote-tracking branch 'gh/firefly'