FileStore::_do_clone_range: _do_copy_range encodes error in return, not errno

Signed-off-by: Samuel Just <sam.just@inktank.com>
FileStore::_do_copy_range: read(2) might return EINTR

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: add ReplicatedPGRef

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG,ReplicatedPG: move intrusive_ptr declarations to top

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: do not put() in scrub() if pg is deleting

scrub() no longer handles the put, this call
must have been missed.

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: use PGRef in C_PG_ActivateCommitted

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: use PGRef for C_PG_FinishRecovery

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: use PGRef for FlushState

Signed-off-by: Samuel Just <sam.just@inktank.com>
OSD: use PGRef in consume_map

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: use PGRef in QueuePeeringEvt

Signed-off-by: Samuel Just <sam.just@inktank.com>
OSD: use PGRef in handle_pg_stats_ack

Signed-off-by: Samuel Just <sam.just@inktank.com>
OSD: use PGRef in handle_pg_remove

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: use ReplicatedPGRef for C_OSD_OpApplied

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: use ReplicatedPGRef for C_OSD_OpCommit

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: use ReplicatedPGRef for C_PG_MarkUnfoundLost

Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: use the ReplicatedPGRef typedef

Signed-off-by: Samuel Just <sam.just@inktank.com>
common/: add tracked_int_ptr.hpp

TrackedIntPtr acts like intrusive_ptr, but is able to
track a ref id.

Signed-off-by: Samuel Just <sam.just@inktank.com>
osd/: optionally track every pg ref

This involves three pieces:

For intrusive_ptr type references, we use TrackedIntPtr instead.  This
uses get_with_id and put_with_id to associate an id and backtrace with
each particular ref instance.

For refs taken via direct calls to get() and put(), get and put now
require a tag string.  The PG tracks individual ref counts for each tag
as well as the total.

Finally, PGs register/unregister themselves on construction/destruction
with OSDService.

As a result, on shutdown, we can check for live pgs and determine where
the references are held.

This behavior is compiled out by default, but can be included with the
--enable-pgrefdebugging flag.

Signed-off-by: Samuel Just <sam.just@inktank.com>
OpRequest: don't maintain history if the OSD is shutting down

Signed-off-by: Samuel Just <sam.just@inktank.com>
AsyncReserver: delete context in cancel_reservation

Fixes: #4662
Signed-off-by: Samuel Just <sam.just@inktank.com>