buffer: use Mutex instead of Spinlock for raw crcs

Signed-off-by: Sage Weil <sage@inktank.com>
mon: fix Session ref leak in handle_get_version

Signed-off-by: Sage Weil <sage@inktank.com>
ReplicatedPG::agent_work: skip hitset objects before getting object context

Otherwise, we might read the attr on a hitset object we are in the
process of deleting.

Fixes: #8086
Signed-off-by: Samuel Just <sam.just@inktank.com>
mds: share max size to client who is allowed for WR cap

WR cap is allowed for the loner client when filelock is in excl->mix
state. MDS should share max size with the loner client in this case.
Otherwise the client may wait for the max size forever.

Fixes: #8092
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
osd: OSDMap: have osdmap json dump print valid boolean instead of string

Fixes: 8108

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
ReplicatedPG::get_snapset_context: assert snap obj is not missing

Signed-off-by: Samuel Just <sam.just@inktank.com>
mds: fix cap revoke confirmation

when the _revokes list is emptied, it doesn't mean that client has
released the revoking caps. It's possible that client was flusing
dirty metadata.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: dynamically adjust priority of committing dirfrags

Adjust priority of committing dirfrags according to number of
expiring log segments. The more expiring log segments, the higher
priority. Because it mean MDS does not trim log segments quickly
enough.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.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 #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>
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>