mon: EBUSY instead of EAGAIN when pgs creating

In 69321bf, EAGAIN changed behaviour to block indefinitely
rather than returning to user.  Change the return for
`osd pool set` operations that are blocked by creating PGs
to return EBUSY instead of EAGAIN, so that they are excepted
from this blocking behaviour.

Signed-off-by: John Spray <john.spray@inktank.com>
mon: set leader commands prior to first election

If we have just started and receive a command, we currently will reply with
EINVAL because the leader commands are empty.  Note that this race is very
difficult to reach because the (old) peon needs to forward a command to
the mon while it still thinks it has quorum, and the message needs to get
sent after the leader mon has restarted and reset its connection but before
it has declared a new election.

To fix this, we should assume at startup time that our commands are
valid.  If it is an internal command that does not require quorum, that
is fine.  If it does require quorum, we will retry the command after the
election completes and we will revalidate the command then.

Fixes: #8132
Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #1677 from ceph/wip-poolset-noblock

mon: Don't block on EAGAIN from `osd pool set`

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #1671 from ceph/wip-7699

mds: Fix respawn (add path resolution)

Reviewed-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #1684 from onlyjob/debian

spelling corrections

Reviewed-by: Sage Weil <sage@inktank.com>
osdc/Objecter: fix osd target for newly-homeless op

If we recalculate the mapping and find that there is no primary, we need
to set the 'osd' field to -1.  Otherwise, the caller will try to resend
to a dead session with bad results.

This was introduced in the refactor 860d72770c.

Fixes: #8130
Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #1687 from ceph/wip-8130

osdc/Objecter: fix osd target for newly-homeless op

Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
Merge pull request #1674 from ceph/wip-8086

ReplicatedPG::agent_work: skip hitset objects before getting object cont...

Reviewed-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: check clones for degraded

We check whether the head is degraded, and we check whether a clone is
unreadable, but in the case where we have a cache op on a degraded object,
we don't check.  That leads to an assert when the repop hits the replica
and the object is in the peer's missing set.

Fix this by adding a check on the clone when write_ordered is true.  Note
that checking write_ordered is better than whether it is a cache op because
we want to preserve write ordering even for reads that are flagged by the
client.

Fixes: #8048
Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #1685 from ceph/wip-8132

mon: set leader commands prior to first election

Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Merge pull request #1688 from ceph/wip-8048

osd/ReplicatedPG: check clones for degraded

Reviewed-by: Samuel Just <sam.just@inktank.com>
osd_types::object_stat_sum_t: fix add/sub for num_objects_omap

Introduced in a130a4452e4fb159dc62fb417077d98dc9ebd621
Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG::recover_replicas: do not recover clones while snap obj is missing

Otherwise, we cannot safely read the snapset for the clone.

Fixes: #8091
Signed-off-by: Samuel Just <sam.just@inktank.com>
Merge pull request #1689 from ceph/wip-8091

Wip 8091

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #1683 from ceph/wip-mds-op-prio

mds: dynamically adjust priority of committing dirfrags

Reviewed-by: Greg Farnum <greg@inktank.com>
osd_types: pg_t: add get_ancestor() method

Give us the ancestor for when the pool had a past value for pg_num.

Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #1678 from ceph/wip-8108

osd: OSDMap: have osdmap json dump print valid boolean instead of string

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #1676 from ceph/wip-8092

Wip 8092

Reviewed-by: Sage Weil <sage@inktank.com>
mon: wait for PaxosService readable in handle_get_version

We were waiting for the election to finish, but we need to *also* wait for
paxos to recover.  Being a peon or leader is not sufficient and we may
return a map that is still old.

Fixes: #7997
Signed-off-by: Sage Weil <sage@inktank.com>
mon: OSDMonitor: HEALTH_WARN on 'mon osd down out interval == 0'

A 'status' or 'health' request will return a HEALTH_WARN whenever the
monitor handling the request has the option set to zero.

Fixes: 7784

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>