common/Finisher: add queue(list<Context*>&)

Signed-off-by: Samuel Just <sam.just@inktank.com>
osd_types: add pg_log_t::rollback_info_trimmed_to

Signed-off-by: Samuel Just <sam.just@inktank.com>
PGLog: initialize complete_to

Signed-off-by: Samuel Just <sam.just@inktank.com>
os/: add async flush_commit() method to Sequencer and implementations

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: add machinery to temporarily buffer outgoing recovery messages

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: block outgoing peering messages until the last interval is durable

Signed-off-by: Samuel Just <sam.just@inktank.com>
PGLog: fix logging whitespace in trim

Signed-off-by: Samuel Just <sam.just@inktank.com>
PGLog: add rollback_info_trimmed_to_riter to IndexedLog and use in PG

Signed-off-by: Samuel Just <sam.just@inktank.com>
osd/: plumb rollback_trim_to through interfaces and messages

We simply trim the roll back info up to min_last_complete_ondisk
since we cannot correctly rollback past that point anyway!

ReplicatedPG
-> PGBackend::submit_transaction
-> Backend messages
-> PGBackend::Listener::log_operation
-> append_log

Signed-off-by: Samuel Just <sam.just@inktank.com>
osd/: in scrub, check for and remove obsolete rollback objs

Signed-off-by: Samuel Just <sam.just@inktank.com>
common: s/stringstream/ostream/ in str_map

There is no need to specialize more than ostream : it only makes it
impossible to use cerr or cout as a parameter to str_map.

Reviewed-By: Christophe Courtaut <christophe.courtaut@gmail.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
(cherry picked from commit 6aa45b133956b974a992b372496b90c908d94f12)
erasure-code: create default profile if necessary

After an upgrade to firefly, the existing Ceph clusters do not have the
default erasure code profile. Although it may be created with

   ceph osd erasure-code-profile set default

it was not included in the release notes and is confusing for the
administrator.

The *osd pool create* and *osd crush rule create-erasure* commands are
modified to implicitly create the default erasure code profile if it is
not found.

In order to avoid code duplication, the default erasure code profile
code creation that happens when a new firefly ceph cluster is created is
encapsulated in the OSDMap::get_erasure_code_profile_default method.

Conversely, handling the pending change in OSDMonitor is not
encapsulated in a function but duplicated instead. If it was a function
the caller would need a switch to distinguish between the case when goto
wait is needed, or goto reply or proceed because nothing needs to be
done. It is unclear if having a function would lead to smaller or more
maintainable code.

http://tracker.ceph.com/issues/8601 Fixes: #8601

Backport: firefly
Signed-off-by: Loic Dachary <loic@dachary.org>
(cherry picked from commit 4e1405e7720eda71a872c991045ac8ead6f3e7d8)
msg/SimpleMessenger: drop local_conneciton priv link on shutdwon

This breaks ref cycles between the local_connection and session, and let's
us drop the explicit set_priv() calls in OSD::shutdown().

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 63c1711a9e237c14d137131f56751970ad1567b1)
use llrintl when converting double to micro

This avoids rounding error (noticeable on i386).

Backport: firefly
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 80911736bd61b6b88eac0974d24f21c15c5385a4)

Conflicts:
	src/mon/OSDMonitor.cc
enforce rados put aligment

Signed-off-by: Lluis Pamies-Juarez <lluis.pamies-juarez@hgst.com>
(cherry picked from commit 304b08a23a3db57010078046955a786fe3589ef8)
(cherry picked from commit dece65064d949b5afcc359cd408615883b5e002a)
qa/workunits/rest/test.py: make osd create test idempotent

Avoid possibility that we create multiple OSDs do to retries by passing in
the optional uuid arg.  (A stray osd id will make the osd tell tests a
few lines down fail.)

Fixes: #8728
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit bb3e1c92b6682ed39968dc5085b69c117f43cbb0)
osd: allow greedy get_write() for ObjectContext locks

There are several lockers that need to take a write lock
because there is an operation that is already in progress and
know it is safe to do so.  In particular, they need to skip
the starvation checks (op waiters, backfill waiting).

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 09626501d7a0ff964027fd7a534465b76bad23cb)
osd/ReplicatedPG: greedily take write_lock for copyfrom finish, snapdir

In the cases where we are taking a write lock and are careful
enough that we know we should succeed (i.e, we assert(got)),
use the get_write_greedy() variant that skips the checks for
waiters (be they ops or backfill) that are normally necessary
to avoid starvation.  We don't care about staration here
because our op is already in-progress and can't easily be
aborted, and new ops won't start because they do make those
checks.

Fixes: #8889
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 6fe27823b8459271bf0c0e807493bb7cf1e4559b)
osd/ReplicatedPG: debug obc locks

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 356af4bf46d6387e2f1a59646548f9a77e49e5f8)
mon: OSDMonitor: return immediately if 'osd tier cache-mode' is a no-op

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
(cherry picked from commit d01aa5bff30441eec1ffaa3e59a21187f8478475)