osd: Improve logging output including pg_shard_t as osd#(shard)

Signed-off-by: David Zafman <david.zafman@inktank.com>
osd: Add logging of missed l_osd_agent_skip cases

Signed-off-by: David Zafman <david.zafman@inktank.com>
osd: Error from start_flush() not checked in agent_maybe_flush()

This caused a very minor memory leak since ctx was allocated
Include logging of l_osd_agent_skip

Signed-off-by: David Zafman <david.zafman@inktank.com>
osd: start_flush() should check for missing clones and return if requested

Fixes: #7659

Signed-off-by: David Zafman <david.zafman@inktank.com>
PG: always clear agent_state in clear_primary_state

We aren't actually active between activate() and all_activated_committed().
We'd have to suspend agent_work during that period which seems like too much
complexity for too little work saved.

Fixes: #7904
Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: hit_set_setup, agent_setup, skip if !active

We call these in on_activate and on_pool_change.  In the former, we are
necessarily active.  In the latter, we only want to do anything if we are
active (otherwise, it will be taken care of when we eventually do become
active).

Fixes: #7904
Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: improve get_object_context debugging

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG::_verify_no_head_clones: missing implies that the clone exists

Fixes: #7659
Signed-off-by: Samuel Just <sam.just@inktank.com>
osd: add 'osd debug reject backfill probability' option

This will make the OSD randomly reject backfill reservation requests.  This
exercises the failure code paths but does not break overall behavior
because the primary will back off and retry later.

This should help us reproduce #7922.

Signed-off-by: Sage Weil <sage@inktank.com>
ReplicatedPG: do not create snapdir on head eviction

Head eviction implies that no clones are present.  Also, add
an exists flag to SnapSetContext in order prevent an ssc from
a recent eviction from preventing a snap read from activating
the promotion machinery.

Fixes: #7858
Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG::do_op: use get_object_context for list-snaps

find_object_context provides some niceties which we don't need since we know
the oid of the clones.  Problematically, it also return ENOENT if the snap
requested happens to have been removed.  Even in such a case, the clone may
well still exist for other snaps.  Rather than modify find_object_context to
avoid this situation for this caller, we'll simply do it inline in do_op.

Fixes: #7858
Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: handle FLAG_OMAP on promote and copyfrom

Fixes: #7967
Signed-off-by: Samuel Just <sam.just@inktank.com>
osd/: track num_objects_omap in pg stats

Fixes: #7831
Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG::agent_choose_mode: exclude omap objects for ec base pool

Fixes: #7831
Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG::agent_choose_mode: use num_user_objects for target_max_bytes calc

Signed-off-by: Samuel Just <sam.just@inktank.com>
rgw: only look at next placement rule if we're not at the last rule

Fixes: #7978
We tried to move to the next placement rule, but we were already at the
last one, so we ended up looping forever.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Merge pull request #1599 from ceph/wip-7978

rgw: only look at next placement rule if we're not at the last rule

Reviewed-by: Sage Weil <sage@inktank.com>
ReplicatedPG::agent_choose_mode: improve debugging

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG::_delete_oid: adjust num_object_clones

Signed-off-by: Samuel Just <sam.just@inktank.com>
Fix byte-order dependency in calculation of initial challenge

Fixes: #7977
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>