mds: logging in SessionMap

(move definitions to .cc to get it)

Signed-off-by: John Spray <john.spray@redhat.com>
mds: fix crash killing sessions without conn

Bug was introduced in 54eca56695  (mds: use Connection::mark_down()).
Used to call SimpleMessenger::mark_down, which had a check for
connection==NULL, when calling conn->mark_down() we must
now do our own nullness check.

Fixes: #9173

Signed-off-by: John Spray <john.spray@redhat.com>
doc: Update docs about OSD benchmark syntax
Revert "doc: Update docs about OSD benchmark syntax"

This reverts commit 36f15c3026debd808920a04bc3a60c96b119405b.

Commit included submodule change which was not supposed to happen.
doc: Update docs about OSD benchmark syntax
erasure-code: preload the isa plugin by default

But only do so when it has been compiled because a recent enough yasm
has been found.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: add directory to plugin init functions

The prototype of the init functions of erasure coded plugins is changed
from

   int __erasure_code_init(char *plugin_name)

to

   int __erasure_code_init(char *plugin_name, char *directory)

The jerasure plugin will find optimized variants in this directory and
load them. The load() and preload() functions of
ErasureCodePluginRegistry only use a directory instead of a more generic
parameters map. The parameters map was only used for the directory entry
anyway.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: remove unused errno.h include

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: add Red Hat to copyright notices

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: add ErasureCodeInterface::get_coding_chunk_count

Signed-off-by: Loic Dachary <loic@dachary.org>
erasure-code: relax profile parameter syntax

Do not restrict the character set of the key=value pairs of osd
erasure-code-profile set to allow for things like:

             layers='[
                       [ "_aAA_aAA", "" ],
                       [ "bBBB____", "" ],
                       [ "____cCCC", "" ],
                     ]'

Signed-off-by: Loic Dachary <loic@dachary.org>
erasure-code: override the default only if the plugin match

When setting a new erasure coded profile, the key/value of the default
profile are re-used so that ruleset-failure-domain=osd can be overridden
like so:

        ceph osd erasure-code-profile set ruleset-failure-domain=osd

This is however not appropriate if the plugin is different from the
defaut plugin (for instance LRC instead of jerasure) because the
parameters are not the same.

If the plugin is changed, the default profile is not reused.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: delegate chunk remapping to the plugin

Remapping the chunks after they have been encoded by the plugin is fine
if remapping is transparent to the plugin. However, the goal is to
delegate the remapping of the chunks to the plugin, for LRC in
particular. The chunks are therefore reordered according to the
directions found in the mapping array before they are passed to
decode_chunks.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: jerasure preloads the plugin variant

The variant selection depending on the available CPU features is
encapsulated in a helper. The helper is used in the factory() method and
in the load() method.

The factory() method may load a variant that is not the default, for
benchmark purposes. Such a variant is not preloaded by the load() method
and upgrading while running may be problematic. However, running with a
non standard variant is used for benchmarking and upgrades in this
context are not a concern.

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

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: wrap lines for emacs compile command

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: implement ErasureCodePluginRegistry::remove

Which is symmetric to the add method and used for test.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: add Ceph version check to plugins

Add the __erasure_code_version function to all plugins, to return the
Ceph version against which they have been compiled. When a plugin is
loaded, an error is thrown if the version of the plugin does not match
the version of the daemon loading it.

If the symbol does not exist, which will be true of older plugins, set
the version to "an older version" so it never matches.

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

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: assert the PluginRegistry lock is held when it must

Add lock to the preload method and assert that it is held by methods
requiring it. Although preload is called at bootstrap and does not
require the lock, adding it does not hurt and makes the lock policy
clearer to understand.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: locally repairable code plugin

Recursively apply erasure code techniques so that recovering from the
loss of some chunks only require a subset of the available chunks, most
of the time.

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

Signed-off-by: Loic Dachary <loic@dachary.org>
erasure-code: high level LRC configuration

Add a configuration mode to the LRC plugin, suitable for most use cases
and simpler to explain and understand. It uses k,m parameters similar to
the jerasure and isa plugins and adds l for locality. For instance:

   k=4 m=2 l=3
   ruleset_locality=rack
   ruleset_failure_domain=host

Will translate into

   local_group_count = (k+m)/l

   ruleset-steps = "["
    " [\"choose\", \"rack\", " + local_group_count + "], "
    " [\"chooseleaf\", \"host\", " + (l + 1) + "], "
    "]";

   layers = "[ "
      "  [ \"DDc_DDc_\", \"\" ],"
      "  [ \"DDDc____\", \"\" ],"
      "  [ \"____DDDc\", \"\" ],"
      "]";

It is less flexible because k+m must be a multiple of l and other
similar relationships and also because it cannot express recursive
configurations with locality in the datacenter and locality in a rack
within the datacenter.

Signed-off-by: Loic Dachary <loic@dachary.org>