ReplicatedPG: clean out completed trimmed objects as we go

Also, explicitely maintain a max number of concurrently trimming
objects.

Fixes: 9113
Backport: dumpling, firefly, giant
Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: do not queue the snap trimmer constantly

Previously, we continuously requeued the snap trimmer while in
TrimmingObjects.  This is not a good idea now that we try to
limit the number of snap trimming repops in flight and requeue
the snap trimmer directly as those repops complete.

Fixes: #9113
Backport: giant, dumpling, firefly
Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: dump snap_trimq on pg query

Signed-off-by: Samuel Just <sam.just@inktank.com>
common: do not set ioprio if pid is not set

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
(cherry picked from commit c7e4c0bfe70bf29d3b8fe4df4e4b934853e33d26)
common: set_ioprio debug message including pid

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
(cherry picked from commit 33339c7754875eb7e513345ee6b26a9b2b4d2707)
osd: log error if set_ioprio fails to parse class

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
(cherry picked from commit 5088e0d49332d579ba7e33c2c9baee3d5f701a3e)
common: ceph_ioprio_string_to_class always returns -EINVAL

The l string is always empty because std::transform needs a
pre-allocated string. Replace with the in-place version. Add unit tests.

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

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
(cherry picked from commit 3535b7aba3df8b54fa5117b8a9c2f52b8f0f118b)

Conflicts:
	src/test/Makefile.am
Merge pull request #2662 from dachary/wip-9677-ioprio-class-firefly

common: ceph_ioprio_string_to_class always returns -EINVAL
mds: Locker: fix a NULL deref in _update_cap_fields

The MClientCaps* is allowed to be NULL, so we can't deref it unless
the dirty param is non-zero. So don't do the ahead-of-time lookup;
just call it explicitly in the if block.

Signed-off-by: Greg Farnum <greg@inktank.com>
(cherry picked from commit 3cd8a7fb9683577a7d6e934f18c29b7e84415be6)
Merge pull request #2681 from ceph/firefly-locker-null

mds: Locker: fix a NULL deref in _update_cap_fields
mds: Locker: remove unused variable

Signed-off-by: Yan, Zheng <zyan@redhat.com>
Merge pull request #2691 from ceph/firefly-unused-variable

Firefly unused variable
PGLog::IndexedLog::trim(): rollback_info_trimmed_to_riter may be log.rend()

Fixes: #9731
Backport: giant, firefly
Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit d458b4f0f31161f561ff98e58ed979cf20c6f588)
PG::choose_acting: in mixed cluster case, acting may include backfill

Fixes: 9696
Backport: firefly, giant
Introduced: 92cfd370395385ca5537b5bc72220934c9f09026
Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 9b18d99817c8b54e30dff45047dfe1b29871d659)
osd/ReplicatedPG: carry CopyOpRef in copy_from completion

There is a race with copy_from cancellation.  The internal Objecter
completion decodes a bunch of data and copies it into pointers provided
when the op is queued.  When we cancel, we need to ensure that we can cope
until control passes back to our provided completion.

Once we *do* get into the (ReplicatedPG) callbacks, we will bail out
because the tid in the CopyOp or FlushOp no longer matches.

Fix this by carrying a ref to keep the copy-from targets alive, and
clearing out the tids that we cancel.

Note that previously, the trigger for this was that the tid changes when
we handle a redirect, which made the op_cancel() call fail.  With the
coming Objecter changes, this will no longer be the case.  However, there
are also locking and threading changes that will make cancellation racy,
so we will not be able to rely on it always preventing the callback.
Either way, this will avoid the problem.

Fixes: #7588
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 589b639af7c8834a1e6293d58d77a9c440107bc3)
Merge remote-tracking branch 'upstream/wip-9696-firefly' into firefly
Merge remote-tracking branch 'origin/wip-7588-firefly' into firefly
osd: Remove unused PG functions queue_notify(), queue_info(), queue_log()

Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 70ef4c11cbae669799c30c7592073ad7aa11dcd6)
osd: Return EOPNOTSUPP if a set-alloc-hint occurs with OSDs that don't support

Add CEPH_FEATURE_OSD_SET_ALLOC_HINT feature bit
Collect the intersection of all peer feature bits during peering
When handling CEPH_OSD_OP_SETALLOCHINT check that all OSDs support it
by checking for CEPH_FEATURE_OSD_SET_ALLOC_HINT feature bit.

Fixes: #9419
Backport: firefly

Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 9b39033f2b2bcdd2be0f6da4dff06023d0f77499)

Conflicts:

	src/include/ceph_features.h
	src/osd/PG.cc
	src/osd/PG.h
	src/osd/ReplicatedPG.cc
rpm: 95-ceph-osd-alt.rules is not needed for centos7 / rhel7

The || instead of && had it always installed. That was fixed in EPEL
already.

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

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
(cherry picked from commit 5ff4a850a0d809b3f25988c6cceb82c35095ef84)