Make <poolname> in "ceph osd tier --help" clearer.

The ceph osd tier --help info on the left always says <poolname>.
It is unclear which one to put <tierpool> on the right.

$ceph osd tier --help
osd tier add <poolname> <poolname> {--   add the tier <tierpool> to base pool
force-nonempty}                          <pool>
osd tier add-cache <poolname>            add a cache <tierpool> of size <size>
<poolname> <int[0-]>                     to existing pool <pool>
...

This patch modifies description on the right to tell which <poolname>:

osd tier add <poolname> <poolname> {--   add the tier <tierpool> (the second
 force-nonempty}                          one) to base pool <pool> (the first
                                           one)
...

Fix: http://tracker.ceph.com/issues/8256

Signed-off-by: Yilong Zhao <accelazh@gmail.com>
Avoid extra check for clean object

We needn't to check clean object via buffer state, skip the clean object.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
(cherry picked from commit f51e33bd9c5a8e1cfc7065b30785696dc45918bc)
osd/OSDMap: make get_features() take an entity type

Make the helper that returns what features are required of the OSDMap take
an entity type argument, as the required features may vary between
components in the cluster.

Backport: firefly
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 250677c965365edf3ecd24ef73700fc6d992ea42)
osd/OSDMap: do not require ERASURE_CODE feature of clients

Just because an EC pool exists in the cluster does not mean tha tthe client
has to support the feature:

1) The way client IO is initiated is no different for EC pools than for
   replicated pools.
2) People may add an EC pool to an existing cluster with old clients and
   locking those old clients out is very rude when they are not using the
   new pool.
3) The only direct client user of EC pools right now is rgw, and the new
   versions already need to support various other features like CRUSH_V2
   in order to work.  These features are present in new kernels.

Fixes: #8556
Backport: firefly
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 3fe1699f9620280d0070cfe6f01cfeb2332e7470)
enforce rados put aligment

Signed-off-by: Lluis Pamies-Juarez <lluis.pamies-juarez@hgst.com>
(cherry picked from commit 304b08a23a3db57010078046955a786fe3589ef8)
erasure-code: verify that rados put enforces alignment

http://tracker.ceph.com/issues/8622 refs: #8622

Signed-off-by: Loic Dachary <loic@dachary.org>
(cherry picked from commit b46c4056014dd6de5e3bd736f2c41f096ea708b4)
FileStore: make _clone() copy spill out marker

Previously we were not doing so, and that resulted in unpredictable loss
of xattrs from the client's perspective.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
(cherry picked from commit 239476a92849159d2a8966d90ca055c116bee91e)
FileStore: set XATTR_NO_SPILL_OUT when creating new files.

Fixes: #8205
Backport: firefly

Signed-off-by: Greg Farnum <greg@inktank.com>
(cherry picked from commit e3b995e1567f3ccc6d00ae27ab2aa99ca157228a)
osd: fix filestore perf stats update

Update the struct we are about to send, not the (unlocked!) one we will
send the next time around.

Backport: firefly, dumpling
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 4afffb4a10a0bbf7f2018ef3ed6b167c7921e46b)
rados.cc: fix pool alignment check

Only check pool alignment if io_ctx is initialized.

Introduced in 304b08a23a3db57010078046955a786fe3589ef8
Fixes: #8652
Signed-off-by: Samuel Just <sam.just@inktank.com>

(cherry picked from commit d7350a3741bf4cdb270c6361e68090fe280cf36d)

Conflicts:
	src/tools/rados/rados.cc
OSD::calc_priors_during: fix confusing for loop bracing (cosmetic)

Confusing lack of braces is confusing.

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit d76936b92300be5cc403fd5a36616a2424c7877d)

Conflicts:
	src/osd/OSD.cc
OSD::calc_priors_during: handle CRUSH_ITEM_NONE correctly

Fixes: #8507
Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 0bd6f6797c69af9aff851033c57c42121671c684)

Conflicts:
	src/osd/OSD.cc
Merge pull request #1982 from accelazh/firefly-fix-issue-8256

Make <poolname> in "ceph osd tier --help" clearer (fix issue 8256).

Reviewed-by: Loic Dachary <loic@dachary.org>
librados: simplify/fix rados_pool_list bounds checks

We were not breaking out of the loop when we filled up the buffer unless
we happened to do so on a pool name boundary.  This means that len would
roll over (it was unsigned).  In my case, I was not able to reproduce
anything particularly bad since (I think) the strncpy was interpreting the
large unsigned value as signed, but in any case this fixes it, simplifies
the arithmetic, and adds a simple test.

- use a single 'rl' value for the amount of buffer space we want to
  consume
- use this to check that there is room and also as the strncat length
- rely on the initial memset to ensure that the trailing 0 is in place.

Fixes: #8447
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 3ec32a6bb11d92e36a0e6381b40ce2fd1fbb016a)
mon: Fix default replicated pool ruleset choice

Specifically, in the case where the configured
default ruleset is CEPH_DEFAULT_CRUSH_REPLICATED_RULESET,
instead of assuming ruleset 0 exists, choose the lowest
numbered ruleset.

In the case where an explicit ruleset is passed to
OSDMonitor::prepare_pool_crush_ruleset, verify
that it really exists.

The idea is to eliminate cases where a pool could
exist with its crush ruleset set to something
other than a value ruleset ID.

Fixes: #8373

Signed-off-by: John Spray <john.spray@inktank.com>
(cherry picked from commit 1d9e4ac2e2bedfd40ee2d91a4a6098150af9b5df)

Conflicts:

	src/crush/CrushWrapper.h
XfsFileStoreBackend: call ioctl(XFS_IOC_FSSETXATTR) less often

No need to call ioctl(XFS_IOC_FSSETXATTR) if extsize is already set to
the value we want or if any extents are allocated - XFS will refuse to
change extsize in that's the case.

Fixes: #8241
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
(cherry picked from commit bc3b30ed09b8f3eb86b61e3a05ccacfd928faa95)
log the command that is being run with subprocess

Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
(cherry picked from commit e189a668285f9ab73116bc19f9df1cc515473541)
mon: fix set cache_target_full_ratio

It was a noop because it was incorrectly using the variable n. Add a
test to protect against regression.

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

Reported-by: Geoffrey Hartz <hartz.geoffrey@gmail.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
(cherry picked from commit c2225f874dcf37222d831b65b5a319d598d2fcd9)
erasure-code: OSDMonitor::get_erasure_code is a const

If it is not, the non const version of OSDMap::get_erasure_code_profile
is called and a profile is created as a side effect, which is not
intended.

http://tracker.ceph.com/issues/8307 refs: #8307

Signed-off-by: Loic Dachary <loic@dachary.org>
(cherry picked from commit 3c638111a4943758b6089c63a42aabbf281ac257)
erasure-code: pool create must not create profiles

If a non existent profile is provided as an argument to osd pool create,
it must exit on error and not create the profile as a side effect.

http://tracker.ceph.com/issues/8307 refs: #8307

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