summaryrefslogtreecommitdiff
path: root/sys-cluster/ceph/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-cluster/ceph/files
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-cluster/ceph/files')
-rw-r--r--sys-cluster/ceph/files/README.gentoo30
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.0-dont-use-virtualenvs.patch95
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.1-libzfs.patch11
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.1-unbundle-jerasure.patch355
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.3-CVE-2016-8626.patch33
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.3-build-without-openldap.patch32
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.5-Make-CephFS-bindings-and-tests-compatible-with-Python-3.patch22
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.5-Make-RBD-Python-bindings-compatible-with-Python-3.patch45
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.6-radosgw-swift-clean-up-flush-newline-behavior.patch92
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.7-fix-compilation-with-zstd.patch49
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.9-cflags.patch15
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.9-dont-run-lsb_release.patch65
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.9-filestore_fix_infinit_loops_in_fiemap.patch82
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.9-libradosstriper_fix_format_injection_vulnerability.patch35
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.9-librbd_filter_expected_error_codes_from_is_exclusive_lock_owner.patch28
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.9-osd-scrub_to_specifies_clone_ver_but_transaction_include.patch39
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.9-rbd-do_not_attempt_to_load_key_if_auth_is_disabled.patch39
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.9-rbd-nbd_relax_size_check_for_newer_kernel_versions.patch28
-rw-r--r--sys-cluster/ceph/files/ceph-10.2.9-unlock_sdata_op_ordering_lock_with_sdata_lock.patch32
-rw-r--r--sys-cluster/ceph/files/ceph-12.2.0-cflags.patch13
-rw-r--r--sys-cluster/ceph/files/ceph-12.2.0-use-provided-cpu-flag-values.patch37
-rw-r--r--sys-cluster/ceph/files/ceph-12.2.1-systemd-unitdir.patch10
-rw-r--r--sys-cluster/ceph/files/ceph-mds_at.service12
-rw-r--r--sys-cluster/ceph/files/ceph-mds_at.service.conf4
-rw-r--r--sys-cluster/ceph/files/ceph-mon_at.service19
-rw-r--r--sys-cluster/ceph/files/ceph-osd_at.service13
-rw-r--r--sys-cluster/ceph/files/ceph-osd_at.service.conf4
-rw-r--r--sys-cluster/ceph/files/ceph.confd-r14
-rw-r--r--sys-cluster/ceph/files/ceph.confd-r28
-rw-r--r--sys-cluster/ceph/files/ceph.confd-r361
-rw-r--r--sys-cluster/ceph/files/ceph.initd-r1.139
-rw-r--r--sys-cluster/ceph/files/ceph.initd-r240
-rw-r--r--sys-cluster/ceph/files/ceph.initd-r449
-rw-r--r--sys-cluster/ceph/files/ceph.initd-r587
-rw-r--r--sys-cluster/ceph/files/ceph.logrotate18
-rw-r--r--sys-cluster/ceph/files/ceph.target4
-rw-r--r--sys-cluster/ceph/files/envd-tcmalloc1
-rw-r--r--sys-cluster/ceph/files/rbdmap.initd122
-rw-r--r--sys-cluster/ceph/files/sysctld2
39 files changed, 1674 insertions, 0 deletions
diff --git a/sys-cluster/ceph/files/README.gentoo b/sys-cluster/ceph/files/README.gentoo
new file mode 100644
index 000000000000..6e5f8366136c
--- /dev/null
+++ b/sys-cluster/ceph/files/README.gentoo
@@ -0,0 +1,30 @@
+1) We'd suggest you to install following packages
+ sys-block/parted to manage disk partions
+ sys-fs/btrfs-progs to use btrfs filesytem
+ sys-fs/cryptsetup to use encrypted devices with dm-crypt
+
+2) To start several daemons of one specific type, create your own scripts
+ cd /etc/init.d
+ for dmn in mds.a mon.a osd.0 osd.1 osd.2; do
+ ln -s ceph ceph-${dmn};
+ rc-update add ceph-${dmn} default;
+ done
+
+3) If you spread ceph daemons over several different machines,
+ We'd highly recommend you to start ntp-client to keep the system time sync.
+ Try to choose one of following ntp client to install and add into runlevel.
+ net-misc/ntp
+ net-misc/openntpd
+ net-misc/chrony
+
+4) Starting from version 9.0.x, Ceph daemons run as user 'ceph' instead of 'root'.
+ In order to solve this, we recommand to stop ceph daemons, and fix the ownership
+
+ # chown -R ceph:ceph /var/lib/ceph
+
+ or
+
+ Add the following line to ceph.conf on all hosts:
+ " setuser match path = /var/lib/ceph/$type/$cluster-$id "
+
+ https://ceph.com/releases/v9-2-0-infernalis-released/
diff --git a/sys-cluster/ceph/files/ceph-10.2.0-dont-use-virtualenvs.patch b/sys-cluster/ceph/files/ceph-10.2.0-dont-use-virtualenvs.patch
new file mode 100644
index 000000000000..f3627636aeb9
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.0-dont-use-virtualenvs.patch
@@ -0,0 +1,95 @@
+diff --git a/Makefile.am b/Makefile.am
+index 7734be2..ba33bda 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -79,7 +79,6 @@ clean-local:
+ cd src/gmock && $(MAKE) $(AM_MAKEFLAGS) clean; \
+ fi
+
+- @rm -rf src/test/virtualenv
+ @rm -rf install-deps-*
+
+
+diff --git a/src/Makefile-env.am b/src/Makefile-env.am
+index df225d6..ca030cf 100644
+--- a/src/Makefile-env.am
++++ b/src/Makefile-env.am
+@@ -297,10 +297,6 @@ LIBCIVETWEB_DEPS =
+ DENCODER_SOURCES =
+ DENCODER_DEPS =
+
+-# put virtualenvs in this directory
+-# otherwise it may overflow #! 80 kernel limit
+-# beware that some build environments might not be able to write to /tmp
+ export TMPDIR ?= /tmp
+-export CEPH_BUILD_VIRTUALENV = $(TMPDIR)
+
+ radoslibdir = $(libdir)/rados-classes
+diff --git a/src/ceph-detect-init/Makefile.am b/src/ceph-detect-init/Makefile.am
+index 8ddcb1e..52dd5d5 100644
+--- a/src/ceph-detect-init/Makefile.am
++++ b/src/ceph-detect-init/Makefile.am
+@@ -53,15 +53,10 @@ EXTRA_DIST += \
+ ceph-detect-init/tests/test_all.py \
+ ceph-detect-init/tox.ini
+
+-export CEPH_DETECT_INIT_VIRTUALENV = ${CEPH_BUILD_VIRTUALENV}/ceph-detect-init-virtualenv
+-
+-ceph-detect-init-all: ${CEPH_DETECT_INIT_VIRTUALENV}
+-
+-${CEPH_DETECT_INIT_VIRTUALENV}:
+- cd $(srcdir)/ceph-detect-init ; ../tools/setup-virtualenv.sh ${CEPH_DETECT_INIT_VIRTUALENV} ; test -d wheelhouse && export NO_INDEX=--no-index ; ${CEPH_DETECT_INIT_VIRTUALENV}/bin/pip install $$NO_INDEX --use-wheel --find-links=file://$$(pwd)/wheelhouse -e .
++ceph-detect-init-all:
+
+ ceph-detect-init-clean:
+- cd $(srcdir)/ceph-detect-init ; python setup.py clean ; rm -fr wheelhouse .tox build ${CEPH_DETECT_INIT_VIRTUALENV} .coverage *.egg-info
++ cd $(srcdir)/ceph-detect-init
+
+ ceph-detect-init-install-data:
+ cd $(srcdir)/ceph-detect-init ; \
+diff --git a/src/ceph-disk/Makefile.am b/src/ceph-disk/Makefile.am
+index 9006303..0b35b0f 100644
+--- a/src/ceph-disk/Makefile.am
++++ b/src/ceph-disk/Makefile.am
+@@ -29,15 +29,10 @@ EXTRA_DIST += \
+ ceph-disk/tests/test_main.py \
+ ceph-disk/tox.ini
+
+-export CEPH_DISK_VIRTUALENV = ${CEPH_BUILD_VIRTUALENV}/ceph-disk-virtualenv
+-
+-ceph-disk-all: ${CEPH_DISK_VIRTUALENV}
+-
+-${CEPH_DISK_VIRTUALENV}:
+- cd $(srcdir)/ceph-disk ; ../tools/setup-virtualenv.sh ${CEPH_DISK_VIRTUALENV} ; test -d wheelhouse && export NO_INDEX=--no-index ; ${CEPH_DISK_VIRTUALENV}/bin/pip install $$NO_INDEX --use-wheel --find-links=file://$$(pwd)/wheelhouse -e .
++ceph-disk-all:
+
+ ceph-disk-clean:
+- cd $(srcdir)/ceph-disk ; python setup.py clean ; rm -fr wheelhouse .tox build ${CEPH_DISK_VIRTUALENV} .coverage *.egg-info
++ cd $(srcdir)/ceph-disk
+
+ ceph-disk-install-data:
+ cd $(srcdir)/ceph-disk ; \
+diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am
+index e730850..9569947 100644
+--- a/src/tools/Makefile.am
++++ b/src/tools/Makefile.am
+@@ -45,6 +45,3 @@ noinst_HEADERS += \
+ tools/rados/PoolDump.h \
+ tools/cephfs/DataScan.h \
+ tools/cephfs/RoleSelector.h
+-
+-EXTRA_DIST += \
+- tools/setup-virtualenv.sh
+diff --git a/src/tools/setup-virtualenv.sh b/src/tools/setup-virtualenv.sh
+index 9ff2d26..b6fca0a 100755
+--- a/src/tools/setup-virtualenv.sh
++++ b/src/tools/setup-virtualenv.sh
+@@ -15,6 +15,8 @@
+ # GNU Library Public License for more details.
+ #
+
++exit 0
++
+ DIR=$1
+ rm -fr $DIR
+ mkdir -p $DIR
diff --git a/sys-cluster/ceph/files/ceph-10.2.1-libzfs.patch b/sys-cluster/ceph/files/ceph-10.2.1-libzfs.patch
new file mode 100644
index 000000000000..34f8eb84beee
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.1-libzfs.patch
@@ -0,0 +1,11 @@
+--- ceph-10.2.1/configure.ac
++++ ceph-10.2.1/configure.ac
+@@ -908,7 +908,7 @@
+ ,
+ [with_libzfs=no])
+ AS_IF([test "x$with_libzfs" = xyes],
+- [PKG_CHECK_MODULES([LIBZFS], [zfs], [], [true])])
++ [PKG_CHECK_MODULES([LIBZFS], [libzfs], [], [true])])
+ AS_IF([test "x$with_libzfs" = xyes],
+ [AC_DEFINE([HAVE_LIBZFS], [1], [Defined if you have libzfs enabled])])
+ AM_CONDITIONAL(WITH_LIBZFS, [ test "$with_libzfs" = "yes" ])
diff --git a/sys-cluster/ceph/files/ceph-10.2.1-unbundle-jerasure.patch b/sys-cluster/ceph/files/ceph-10.2.1-unbundle-jerasure.patch
new file mode 100644
index 000000000000..8340b4d18bfd
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.1-unbundle-jerasure.patch
@@ -0,0 +1,355 @@
+diff --git a/src/erasure-code/jerasure/Makefile.am b/src/erasure-code/jerasure/Makefile.am
+index adcb95d..8099208 100644
+--- a/src/erasure-code/jerasure/Makefile.am
++++ b/src/erasure-code/jerasure/Makefile.am
+@@ -1,52 +1,17 @@
+ # jerasure plugin
+ noinst_HEADERS += \
+- erasure-code/jerasure/gf-complete/include/gf_complete.h \
+- erasure-code/jerasure/gf-complete/include/gf_general.h \
+- erasure-code/jerasure/gf-complete/include/gf_int.h \
+- erasure-code/jerasure/gf-complete/include/gf_method.h \
+- erasure-code/jerasure/gf-complete/include/gf_rand.h \
+- erasure-code/jerasure/gf-complete/include/gf_w16.h \
+- erasure-code/jerasure/gf-complete/include/gf_w32.h \
+- erasure-code/jerasure/gf-complete/include/gf_w4.h \
+- erasure-code/jerasure/gf-complete/include/gf_w64.h \
+- erasure-code/jerasure/gf-complete/include/gf_w8.h \
+- erasure-code/jerasure/jerasure/include/cauchy.h \
+- erasure-code/jerasure/jerasure/include/galois.h \
+- erasure-code/jerasure/jerasure/include/jerasure.h \
+- erasure-code/jerasure/jerasure/include/liberation.h \
+- erasure-code/jerasure/jerasure/include/reed_sol.h \
+ erasure-code/jerasure/ErasureCodeJerasure.h
+
+ jerasure_sources = \
+ erasure-code/ErasureCode.cc \
+- erasure-code/jerasure/jerasure/src/cauchy.c \
+- erasure-code/jerasure/jerasure/src/galois.c \
+- erasure-code/jerasure/jerasure/src/jerasure.c \
+- erasure-code/jerasure/jerasure/src/liberation.c \
+- erasure-code/jerasure/jerasure/src/reed_sol.c \
+- erasure-code/jerasure/gf-complete/src/gf_wgen.c \
+- erasure-code/jerasure/gf-complete/src/gf_method.c \
+- erasure-code/jerasure/gf-complete/src/gf_w16.c \
+- erasure-code/jerasure/gf-complete/src/gf.c \
+- erasure-code/jerasure/gf-complete/src/gf_w32.c \
+- erasure-code/jerasure/gf-complete/src/gf_w64.c \
+- erasure-code/jerasure/gf-complete/src/gf_w128.c \
+- erasure-code/jerasure/gf-complete/src/gf_general.c \
+- erasure-code/jerasure/gf-complete/src/gf_w4.c \
+- erasure-code/jerasure/gf-complete/src/gf_rand.c \
+- erasure-code/jerasure/gf-complete/src/gf_w8.c \
+ erasure-code/jerasure/ErasureCodePluginJerasure.cc \
+ erasure-code/jerasure/ErasureCodeJerasure.cc
+
+ erasure-code/jerasure/ErasureCodePluginJerasure.cc: ./ceph_ver.h
+
+ libec_jerasure_generic_la_SOURCES = ${jerasure_sources}
+-libec_jerasure_generic_la_CFLAGS = ${AM_CFLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include
+-libec_jerasure_generic_la_CXXFLAGS= ${AM_CXXFLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include
++libec_jerasure_generic_la_CFLAGS = ${AM_CFLAGS}
++libec_jerasure_generic_la_CXXFLAGS= ${AM_CXXFLAGS}
+ libec_jerasure_generic_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
+ libec_jerasure_generic_la_LDFLAGS = ${AM_LDFLAGS} -module -avoid-version -shared
+ if LINUX
+@@ -55,20 +20,11 @@ endif
+
+ erasure_codelib_LTLIBRARIES += libec_jerasure_generic.la
+
+-libec_jerasure_neon_la_SOURCES = ${jerasure_sources} \
+- erasure-code/jerasure/gf-complete/src/neon/gf_w4_neon.c \
+- erasure-code/jerasure/gf-complete/src/neon/gf_w8_neon.c \
+- erasure-code/jerasure/gf-complete/src/neon/gf_w16_neon.c \
+- erasure-code/jerasure/gf-complete/src/neon/gf_w32_neon.c \
+- erasure-code/jerasure/gf-complete/src/neon/gf_w64_neon.c
++libec_jerasure_neon_la_SOURCES = ${jerasure_sources}
+ libec_jerasure_neon_la_CFLAGS = ${AM_CFLAGS} \
+- ${ARM_NEON_FLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include
++ ${ARM_NEON_FLAGS}
+ libec_jerasure_neon_la_CXXFLAGS= ${AM_CXXFLAGS} \
+- ${ARM_NEON_FLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include
++ ${ARM_NEON_FLAGS}
+ libec_jerasure_neon_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
+ libec_jerasure_neon_la_LDFLAGS = ${AM_LDFLAGS} -module -avoid-version -shared
+ if LINUX
+@@ -84,16 +40,12 @@ libec_jerasure_sse3_la_CFLAGS = ${AM_CFLAGS} \
+ ${INTEL_SSE_FLAGS} \
+ ${INTEL_SSE2_FLAGS} \
+ ${INTEL_SSE3_FLAGS} \
+- ${INTEL_SSSE3_FLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include
++ ${INTEL_SSSE3_FLAGS}
+ libec_jerasure_sse3_la_CXXFLAGS= ${AM_CXXFLAGS} \
+ ${INTEL_SSE_FLAGS} \
+ ${INTEL_SSE2_FLAGS} \
+ ${INTEL_SSE3_FLAGS} \
+- ${INTEL_SSSE3_FLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include
++ ${INTEL_SSSE3_FLAGS}
+ libec_jerasure_sse3_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
+ libec_jerasure_sse3_la_LDFLAGS = ${AM_LDFLAGS} -module -avoid-version -shared
+ if LINUX
+@@ -111,18 +63,14 @@ libec_jerasure_sse4_la_CFLAGS = ${AM_CFLAGS} \
+ ${INTEL_SSE3_FLAGS} \
+ ${INTEL_SSSE3_FLAGS} \
+ ${INTEL_SSE4_1_FLAGS} \
+- ${INTEL_SSE4_2_FLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include
++ ${INTEL_SSE4_2_FLAGS}
+ libec_jerasure_sse4_la_CXXFLAGS= ${AM_CXXFLAGS} \
+ ${INTEL_SSE_FLAGS} \
+ ${INTEL_SSE2_FLAGS} \
+ ${INTEL_SSE3_FLAGS} \
+ ${INTEL_SSSE3_FLAGS} \
+ ${INTEL_SSE4_1_FLAGS} \
+- ${INTEL_SSE4_2_FLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include
++ ${INTEL_SSE4_2_FLAGS}
+ libec_jerasure_sse4_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
+ libec_jerasure_sse4_la_LDFLAGS = ${AM_LDFLAGS} -module -avoid-version -shared
+ if LINUX
+diff --git a/src/erasure-code/shec/ErasureCodePluginShec.cc b/src/erasure-code/shec/ErasureCodePluginShec.cc
+index d2b72f5..acbd172 100644
+--- a/src/erasure-code/shec/ErasureCodePluginShec.cc
++++ b/src/erasure-code/shec/ErasureCodePluginShec.cc
+@@ -71,7 +71,7 @@ public:
+ };
+
+ extern "C" {
+-#include "jerasure/include/galois.h"
++#include "galois.h"
+
+ extern gf_t *gfp_array[];
+ extern int gfp_is_composite[];
+diff --git a/src/erasure-code/shec/ErasureCodeShec.cc b/src/erasure-code/shec/ErasureCodeShec.cc
+index 2180328..c84ffc7 100644
+--- a/src/erasure-code/shec/ErasureCodeShec.cc
++++ b/src/erasure-code/shec/ErasureCodeShec.cc
+@@ -28,8 +28,8 @@
+ #include "crush/CrushWrapper.h"
+ #include "osd/osd_types.h"
+ extern "C" {
+-#include "jerasure/include/jerasure.h"
+-#include "jerasure/include/galois.h"
++#include "jerasure.h"
++#include "galois.h"
+
+ extern int calc_determinant(int *matrix, int dim);
+ extern int* reed_sol_vandermonde_coding_matrix(int k, int m, int w);
+diff --git a/src/erasure-code/shec/Makefile.am b/src/erasure-code/shec/Makefile.am
+index 6b658d5..3281c60 100644
+--- a/src/erasure-code/shec/Makefile.am
++++ b/src/erasure-code/shec/Makefile.am
+@@ -4,49 +4,19 @@ shec_sources = \
+ erasure-code/shec/ErasureCodePluginShec.cc \
+ erasure-code/shec/ErasureCodeShec.cc \
+ erasure-code/shec/ErasureCodeShecTableCache.cc \
+- erasure-code/shec/determinant.c \
+- erasure-code/jerasure/jerasure/src/cauchy.c \
+- erasure-code/jerasure/jerasure/src/galois.c \
+- erasure-code/jerasure/jerasure/src/jerasure.c \
+- erasure-code/jerasure/jerasure/src/liberation.c \
+- erasure-code/jerasure/jerasure/src/reed_sol.c \
+- erasure-code/jerasure/gf-complete/src/gf_wgen.c \
+- erasure-code/jerasure/gf-complete/src/gf_method.c \
+- erasure-code/jerasure/gf-complete/src/gf_w16.c \
+- erasure-code/jerasure/gf-complete/src/gf.c \
+- erasure-code/jerasure/gf-complete/src/gf_w32.c \
+- erasure-code/jerasure/gf-complete/src/gf_w64.c \
+- erasure-code/jerasure/gf-complete/src/gf_w128.c \
+- erasure-code/jerasure/gf-complete/src/gf_general.c \
+- erasure-code/jerasure/gf-complete/src/gf_w4.c \
+- erasure-code/jerasure/gf-complete/src/gf_rand.c \
+- erasure-code/jerasure/gf-complete/src/gf_w8.c
++ erasure-code/shec/determinant.c
+
+ noinst_HEADERS += \
+ erasure-code/shec/ErasureCodeShec.h \
+- erasure-code/shec/ErasureCodeShecTableCache.h \
+- erasure-code/jerasure/jerasure/include/cauchy.h \
+- erasure-code/jerasure/jerasure/include/galois.h \
+- erasure-code/jerasure/jerasure/include/jerasure.h \
+- erasure-code/jerasure/jerasure/include/liberation.h \
+- erasure-code/jerasure/jerasure/include/reed_sol.h \
+- erasure-code/jerasure/gf-complete/include/gf_int.h \
+- erasure-code/jerasure/gf-complete/include/gf_complete.h \
+- erasure-code/jerasure/gf-complete/include/gf_rand.h \
+- erasure-code/jerasure/gf-complete/include/gf_method.h \
+- erasure-code/jerasure/gf-complete/include/gf_general.h
++ erasure-code/shec/ErasureCodeShecTableCache.h
+
+ erasure-code/shec/ErasureCodePluginShec.cc: ./ceph_ver.h
+
+ libec_shec_generic_la_SOURCES = ${shec_sources}
+ libec_shec_generic_la_CFLAGS = ${AM_CFLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ libec_shec_generic_la_CXXFLAGS= ${AM_CXXFLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ libec_shec_generic_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
+@@ -57,22 +27,13 @@ endif
+
+ erasure_codelib_LTLIBRARIES += libec_shec_generic.la
+
+-libec_shec_neon_la_SOURCES = ${shec_sources} \
+- erasure-code/jerasure/gf-complete/src/neon/gf_w4_neon.c \
+- erasure-code/jerasure/gf-complete/src/neon/gf_w8_neon.c \
+- erasure-code/jerasure/gf-complete/src/neon/gf_w16_neon.c \
+- erasure-code/jerasure/gf-complete/src/neon/gf_w32_neon.c \
+- erasure-code/jerasure/gf-complete/src/neon/gf_w64_neon.c
++libec_shec_neon_la_SOURCES = ${shec_sources}
+ libec_shec_neon_la_CFLAGS = ${AM_CFLAGS} \
+ ${ARM_NEON_FLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ libec_shec_neon_la_CXXFLAGS= ${AM_CXXFLAGS} \
+ ${ARM_NEON_FLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ libec_shec_neon_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
+@@ -91,8 +52,6 @@ libec_shec_sse3_la_CFLAGS = ${AM_CFLAGS} \
+ ${INTEL_SSE2_FLAGS} \
+ ${INTEL_SSE3_FLAGS} \
+ ${INTEL_SSSE3_FLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ libec_shec_sse3_la_CXXFLAGS= ${AM_CXXFLAGS} \
+@@ -100,8 +59,6 @@ libec_shec_sse3_la_CXXFLAGS= ${AM_CXXFLAGS} \
+ ${INTEL_SSE2_FLAGS} \
+ ${INTEL_SSE3_FLAGS} \
+ ${INTEL_SSSE3_FLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ libec_shec_sse3_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
+@@ -122,8 +79,6 @@ libec_shec_sse4_la_CFLAGS = ${AM_CFLAGS} \
+ ${INTEL_SSSE3_FLAGS} \
+ ${INTEL_SSE4_1_FLAGS} \
+ ${INTEL_SSE4_2_FLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ libec_shec_sse4_la_CXXFLAGS= ${AM_CXXFLAGS} \
+@@ -133,8 +88,6 @@ libec_shec_sse4_la_CXXFLAGS= ${AM_CXXFLAGS} \
+ ${INTEL_SSSE3_FLAGS} \
+ ${INTEL_SSE4_1_FLAGS} \
+ ${INTEL_SSE4_2_FLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ libec_shec_sse4_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
+diff --git a/src/erasure-code/shec/determinant.c b/src/erasure-code/shec/determinant.c
+index 15b62c9..bf5d290 100755
+--- a/src/erasure-code/shec/determinant.c
++++ b/src/erasure-code/shec/determinant.c
+@@ -19,7 +19,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+
+-#include "jerasure/include/galois.h"
++#include "galois.h"
+
+ void print_matrix(int *mat, int dim)
+ {
+diff --git a/src/test/erasure-code/Makefile.am b/src/test/erasure-code/Makefile.am
+index bdce080..11895ae 100644
+--- a/src/test/erasure-code/Makefile.am
++++ b/src/test/erasure-code/Makefile.am
+@@ -166,12 +166,8 @@ check_TESTPROGRAMS += unittest_erasure_code
+ unittest_erasure_code_jerasure_SOURCES = \
+ test/erasure-code/TestErasureCodeJerasure.cc \
+ ${jerasure_sources}
+-unittest_erasure_code_jerasure_CFLAGS = $(AM_CFLAGS) \
+- -Ierasure-code/jerasure/gf-complete/include \
+- -Ierasure-code/jerasure/jerasure/include
+-unittest_erasure_code_jerasure_CXXFLAGS = $(UNITTEST_CXXFLAGS) \
+- -Ierasure-code/jerasure/gf-complete/include \
+- -Ierasure-code/jerasure/jerasure/include
++unittest_erasure_code_jerasure_CFLAGS = $(AM_CFLAGS)
++unittest_erasure_code_jerasure_CXXFLAGS = $(UNITTEST_CXXFLAGS)
+ unittest_erasure_code_jerasure_LDADD = $(LIBOSD) $(LIBCOMMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL)
+ if LINUX
+ unittest_erasure_code_jerasure_LDADD += -ldl
+@@ -232,13 +228,9 @@ unittest_erasure_code_shec_SOURCES = \
+ test/erasure-code/TestErasureCodeShec.cc \
+ ${shec_sources}
+ unittest_erasure_code_shec_CFLAGS = ${libec_shec_la_CFLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ unittest_erasure_code_shec_CXXFLAGS = ${libec_shec_la_CXXFLAGS} $(UNITTEST_CXXFLAGS) \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ unittest_erasure_code_shec_LDADD = $(LIBOSD) $(LIBCOMMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL)
+@@ -251,13 +243,9 @@ unittest_erasure_code_shec_all_SOURCES = \
+ test/erasure-code/TestErasureCodeShec_all.cc \
+ ${shec_sources}
+ unittest_erasure_code_shec_all_CFLAGS = ${libec_shec_la_CFLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ unittest_erasure_code_shec_all_CXXFLAGS = ${libec_shec_la_CXXFLAGS} $(UNITTEST_CXXFLAGS) \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ unittest_erasure_code_shec_all_LDADD = $(LIBOSD) $(LIBCOMMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL)
+@@ -270,13 +258,9 @@ unittest_erasure_code_shec_thread_SOURCES = \
+ test/erasure-code/TestErasureCodeShec_thread.cc \
+ ${shec_sources}
+ unittest_erasure_code_shec_thread_CFLAGS = ${libec_shec_la_CFLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ unittest_erasure_code_shec_thread_CXXFLAGS = ${libec_shec_la_CXXFLAGS} $(UNITTEST_CXXFLAGS) \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ unittest_erasure_code_shec_thread_LDADD = $(LIBOSD) $(LIBCOMMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL)
+@@ -289,13 +273,9 @@ unittest_erasure_code_shec_arguments_SOURCES = \
+ test/erasure-code/TestErasureCodeShec_arguments.cc \
+ ${shec_sources}
+ unittest_erasure_code_shec_arguments_CFLAGS = ${libec_shec_la_CFLAGS} \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ unittest_erasure_code_shec_arguments_CXXFLAGS = ${libec_shec_la_CXXFLAGS} $(UNITTEST_CXXFLAGS) \
+- -I$(srcdir)/erasure-code/jerasure/jerasure/include \
+- -I$(srcdir)/erasure-code/jerasure/gf-complete/include \
+ -I$(srcdir)/erasure-code/jerasure \
+ -I$(srcdir)/erasure-code/shec
+ unittest_erasure_code_shec_arguments_LDADD = $(LIBOSD) $(LIBCOMMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL)
diff --git a/sys-cluster/ceph/files/ceph-10.2.3-CVE-2016-8626.patch b/sys-cluster/ceph/files/ceph-10.2.3-CVE-2016-8626.patch
new file mode 100644
index 000000000000..d767d8170dfa
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.3-CVE-2016-8626.patch
@@ -0,0 +1,33 @@
+commit dc2ffda7819d2ebeed3526d9e6da8f53221818de
+Author: Yehuda Sadeh <yehuda@redhat.com>
+Date: Thu Oct 20 10:17:36 2016 -0700
+
+ rgw: handle empty POST condition
+
+ Fixes: http://tracker.ceph.com/issues/17635
+
+ Before accessing json entity, need to check that iterator is valid.
+ If there is no entry return appropriate error code.
+
+ Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
+ (cherry picked from commit 23cb642243e09ca4a8e104f62a3bb7b2cbb6ea12)
+
+diff --git a/src/rgw/rgw_policy_s3.cc b/src/rgw/rgw_policy_s3.cc
+index 3843511..8af70a8 100644
+--- a/src/rgw/rgw_policy_s3.cc
++++ b/src/rgw/rgw_policy_s3.cc
+@@ -286,11 +286,13 @@ int RGWPolicy::from_json(bufferlist& bl, string& err_msg)
+ int r = add_condition(v[0], v[1], v[2], err_msg);
+ if (r < 0)
+ return r;
+- } else {
++ } else if (!citer.end()) {
+ JSONObj *c = *citer;
+ dout(0) << "adding simple_check: " << c->get_name() << " : " << c->get_data() << dendl;
+
+ add_simple_check(c->get_name(), c->get_data());
++ } else {
++ return -EINVAL;
+ }
+ }
+ return 0;
diff --git a/sys-cluster/ceph/files/ceph-10.2.3-build-without-openldap.patch b/sys-cluster/ceph/files/ceph-10.2.3-build-without-openldap.patch
new file mode 100644
index 000000000000..ffc164536048
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.3-build-without-openldap.patch
@@ -0,0 +1,32 @@
+diff --git a/src/rgw/librgw.cc b/src/rgw/librgw.cc
+index c476129..cad54b8 100644
+--- a/src/rgw/librgw.cc
++++ b/src/rgw/librgw.cc
+@@ -470,7 +470,11 @@ namespace rgw {
+ const string& ldap_searchdn = store->ctx()->_conf->rgw_ldap_searchdn;
+ const string& ldap_dnattr =
+ store->ctx()->_conf->rgw_ldap_dnattr;
++#ifdef HAVE_OPENLDAP
+ std::string ldap_bindpw = parse_rgw_ldap_bindpw(store->ctx());
++#else
++ std::string ldap_bindpw;
++#endif /* HAVE_OPENLDAP */
+
+ ldh = new rgw::LDAPHelper(ldap_uri, ldap_binddn, ldap_bindpw.c_str(),
+ ldap_searchdn, ldap_dnattr);
+diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc
+index e9f24f3..7291e69 100644
+--- a/src/rgw/rgw_rest_s3.cc
++++ b/src/rgw/rgw_rest_s3.cc
+@@ -3091,7 +3091,11 @@ void RGW_Auth_S3::init_impl(RGWRados* store)
+ const string& ldap_searchdn = store->ctx()->_conf->rgw_ldap_searchdn;
+ const string& ldap_dnattr =
+ store->ctx()->_conf->rgw_ldap_dnattr;
++#ifdef HAVE_OPENLDAP
+ std::string ldap_bindpw = parse_rgw_ldap_bindpw(store->ctx());
++#else
++ std::string ldap_bindpw;
++#endif /* HAVE_OPENLDAP */
+
+ ldh = new rgw::LDAPHelper(ldap_uri, ldap_binddn, ldap_bindpw,
+ ldap_searchdn, ldap_dnattr);
diff --git a/sys-cluster/ceph/files/ceph-10.2.5-Make-CephFS-bindings-and-tests-compatible-with-Python-3.patch b/sys-cluster/ceph/files/ceph-10.2.5-Make-CephFS-bindings-and-tests-compatible-with-Python-3.patch
new file mode 100644
index 000000000000..08a7920035aa
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.5-Make-CephFS-bindings-and-tests-compatible-with-Python-3.patch
@@ -0,0 +1,22 @@
+commit e1dc386f93eb4613dc7e89cc76a031aeee5022ba
+Author: Oleh Prypin <oleh@pryp.in>
+Date: Thu Jul 21 18:33:25 2016 +0300
+
+ pybind: Make CephFS bindings and tests compatible with Python 3
+
+ Signed-off-by: Oleh Prypin <oleh@pryp.in>
+
+diff --git a/src/pybind/cephfs/cephfs.pyx b/src/pybind/cephfs/cephfs.pyx
+index ac17ada1a1..bd14de3b16 100644
+--- a/src/pybind/cephfs/cephfs.pyx
++++ b/src/pybind/cephfs/cephfs.pyx
+@@ -613,8 +613,7 @@ cdef class LibCephFS(object):
+
+ if not isinstance(mode, int):
+ raise TypeError('mode must be an int')
+- if isinstance(flags, basestring):
+- flags = cstr(flags, 'flags')
++ if isinstance(flags, str_type):
+ cephfs_flags = 0
+ if flags == '':
+ cephfs_flags = os.O_RDONLY
diff --git a/sys-cluster/ceph/files/ceph-10.2.5-Make-RBD-Python-bindings-compatible-with-Python-3.patch b/sys-cluster/ceph/files/ceph-10.2.5-Make-RBD-Python-bindings-compatible-with-Python-3.patch
new file mode 100644
index 000000000000..a81aae6e7ce8
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.5-Make-RBD-Python-bindings-compatible-with-Python-3.patch
@@ -0,0 +1,45 @@
+commit 773e01294da518c6ec18f0a8b72e05def85fef6c
+Author: Oleh Prypin <oleh@pryp.in>
+Date: Fri Jun 24 15:48:57 2016 +0300
+
+ pybind: Make RBD Python bindings compatible with Python 3
+
+ Signed-off-by: Oleh Prypin <oleh@pryp.in>
+
+diff --git a/src/pybind/rbd/rbd.pyx b/src/pybind/rbd/rbd.pyx
+index 52727bf39e..8f25dfbee0 100644
+--- a/src/pybind/rbd/rbd.pyx
++++ b/src/pybind/rbd/rbd.pyx
+@@ -745,7 +745,7 @@ class RBD(object):
+ break
+ elif ret != -errno.ERANGE:
+ raise make_ex(ret, 'error listing images')
+- return [decode_cstr(name) for name in c_names[:ret].split('\0')
++ return [decode_cstr(name) for name in c_names[:ret].split(b'\0')
+ if name]
+ finally:
+ free(c_names)
+@@ -1885,8 +1885,8 @@ written." % (self.name, ret, length))
+ raise make_ex(ret, 'error listing images')
+ if ret == 0:
+ return []
+- pools = map(decode_cstr, c_pools[:pools_size - 1].split('\0'))
+- images = map(decode_cstr, c_images[:images_size - 1].split('\0'))
++ pools = map(decode_cstr, c_pools[:pools_size - 1].split(b'\0'))
++ images = map(decode_cstr, c_images[:images_size - 1].split(b'\0'))
+ return list(zip(pools, images))
+ finally:
+ free(c_pools)
+@@ -1933,9 +1933,9 @@ written." % (self.name, ret, length))
+ raise make_ex(ret, 'error listing images')
+ if ret == 0:
+ return []
+- clients = map(decode_cstr, c_clients[:clients_size - 1].split('\0'))
+- cookies = map(decode_cstr, c_cookies[:cookies_size - 1].split('\0'))
+- addrs = map(decode_cstr, c_addrs[:addrs_size - 1].split('\0'))
++ clients = map(decode_cstr, c_clients[:clients_size - 1].split(b'\0'))
++ cookies = map(decode_cstr, c_cookies[:cookies_size - 1].split(b'\0'))
++ addrs = map(decode_cstr, c_addrs[:addrs_size - 1].split(b'\0'))
+ return {
+ 'tag' : decode_cstr(c_tag),
+ 'exclusive' : exclusive == 1,
diff --git a/sys-cluster/ceph/files/ceph-10.2.6-radosgw-swift-clean-up-flush-newline-behavior.patch b/sys-cluster/ceph/files/ceph-10.2.6-radosgw-swift-clean-up-flush-newline-behavior.patch
new file mode 100644
index 000000000000..3202de3cbe98
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.6-radosgw-swift-clean-up-flush-newline-behavior.patch
@@ -0,0 +1,92 @@
+From 39848e41b7c517cc5faab1ccf77c2804fd7d2628 Mon Sep 17 00:00:00 2001
+From: Marcus Watts <mwatts@redhat.com>
+Date: Wed, 11 Jan 2017 00:06:15 -0500
+Subject: [PATCH] radosgw/swift: clean up flush / newline behavior.
+
+The current code emits a newline after swift errors, but fails
+to account for it when it calculates 'content-length'. This results in
+some clients (go github.com/ncw/swift) producing complaints about the
+unsolicited newline such as this,
+ Unsolicited response received on idle HTTP channel starting with "\n"; err=<nil>
+
+This logic eliminates the newline on flush. This makes the content length
+calculation correct and eliminates the stray newline.
+
+There was already existing separator logic in the rgw plain formatter
+that can emit a newline at the correct point. It had been checking
+"len" to decide if previous data had been emitted, but that's reset to 0
+by flush(). So, this logic adds a new per-instance variable to separately
+track state that it emitted a previous item (and should emit a newline).
+
+Fixes: http://tracker.ceph.com/issues/18473
+Signed-off-by: Marcus Watts <mwatts@redhat.com>
+Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
+(cherry picked from commit 5f229d6a33eae4906f22cdb90941835e47ee9f02)
+---
+ src/rgw/rgw_formats.cc | 11 +++++++----
+ src/rgw/rgw_formats.h | 1 +
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/src/rgw/rgw_formats.cc b/src/rgw/rgw_formats.cc
+index 698ec96..61e9b66 100644
+--- a/src/rgw/rgw_formats.cc
++++ b/src/rgw/rgw_formats.cc
+@@ -25,6 +25,7 @@ RGWFormatter_Plain::RGWFormatter_Plain(const bool ukv)
+ : buf(NULL),
+ len(0),
+ max_len(0),
++ wrote_something(false),
+ min_stack_level(0),
+ use_kv(ukv)
+ {
+@@ -41,7 +42,7 @@ void RGWFormatter_Plain::flush(ostream& os)
+ return;
+
+ if (len) {
+- os << buf << "\n";
++ os << buf;
+ os.flush();
+ }
+
+@@ -156,13 +157,14 @@ void RGWFormatter_Plain::dump_format_va(const char *name, const char *ns, bool q
+ vsnprintf(buf, LARGE_SIZE, fmt, ap);
+
+ const char *eol;
+- if (len) {
++ if (wrote_something) {
+ if (use_kv && entry.is_array && entry.size > 1)
+ eol = ", ";
+ else
+ eol = "\n";
+ } else
+ eol = "";
++ wrote_something = true;
+
+ if (use_kv && !entry.is_array)
+ write_data("%s%s: %s", eol, name, buf);
+@@ -268,10 +270,11 @@ void RGWFormatter_Plain::dump_value_int(const char *name, const char *fmt, ...)
+ va_end(ap);
+
+ const char *eol;
+- if (len)
++ if (wrote_something) {
+ eol = "\n";
+- else
++ } else
+ eol = "";
++ wrote_something = true;
+
+ if (use_kv && !entry.is_array)
+ write_data("%s%s: %s", eol, name, buf);
+diff --git a/src/rgw/rgw_formats.h b/src/rgw/rgw_formats.h
+index 9df5251..1c5afd1 100644
+--- a/src/rgw/rgw_formats.h
++++ b/src/rgw/rgw_formats.h
+@@ -56,6 +56,7 @@ class RGWFormatter_Plain : public Formatter {
+ std::list<struct plain_stack_entry> stack;
+ size_t min_stack_level;
+ bool use_kv;
++ bool wrote_something;
+ };
+
+ class RGWFormatterFlusher {
diff --git a/sys-cluster/ceph/files/ceph-10.2.7-fix-compilation-with-zstd.patch b/sys-cluster/ceph/files/ceph-10.2.7-fix-compilation-with-zstd.patch
new file mode 100644
index 000000000000..4e76deabe65f
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.7-fix-compilation-with-zstd.patch
@@ -0,0 +1,49 @@
+From 5a11f31aac4fa6a5c5ebb4fa0964e1c07a420e8c Mon Sep 17 00:00:00 2001
+From: Zac Medico <zmedico@gentoo.org>
+Date: Wed, 12 Apr 2017 01:49:09 -0700
+Subject: [PATCH] configure: link against zstd if detected
+
+https://bugs.gentoo.org/show_bug.cgi?id=601610
+---
+ configure.ac | 6 ++++--
+ src/Makefile-env.am | 3 +++
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 51daf91..8914b71 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -851,12 +851,14 @@ AS_IF([test "x$with_librocksdb_static" = "xyes"],
+ AM_CONDITIONAL(WITH_SLIBROCKSDB, [ test "x$with_librocksdb_static" = "xyes" ])
+ AM_CONDITIONAL(WITH_LIBROCKSDB, [ test "x$with_librocksdb_static" = "xyes" -o "x$with_librocksdb" = "xyes" ])
+
+-# rocksdb detects bzlib and lz4 in its Makefile, which forces us to do the same.
++# rocksdb detects headers in its Makefile, which forces us to do the same.
+ AS_IF([test "x$with_librocksdb_static" = "xyes"], [
+ AC_CHECK_HEADER([bzlib.h], [have_bzlib=yes])
+- AC_CHECK_HEADER([lz4.h], [have_lz4=yes])])
++ AC_CHECK_HEADER([lz4.h], [have_lz4=yes])]
++ AC_CHECK_HEADER([zstd.h], [have_zstd=yes])])
+ AM_CONDITIONAL(HAVE_BZLIB, [test "x$have_bzlib" = "xyes"])
+ AM_CONDITIONAL(HAVE_LZ4, [test "x$have_lz4" = "xyes"])
++AM_CONDITIONAL(HAVE_ZSTD, [test "x$have_zstd" = "xyes"])
+
+ # needs libcurl and libxml2
+ if test "x$with_rest_bench" = xyes && test "x$with_system_libs3" = xno; then
+diff --git a/src/Makefile-env.am b/src/Makefile-env.am
+index 4771bad..0ee42f8 100644
+--- a/src/Makefile-env.am
++++ b/src/Makefile-env.am
+@@ -280,6 +280,9 @@ endif
+ if HAVE_LZ4
+ LIBKV += -llz4
+ endif
++if HAVE_ZSTD
++LIBKV += -lzstd
++endif
+ endif # WITH_SLIBROCKSDB
+ LIBKV += -lz -lleveldb -lsnappy
+ LIBOS += $(LIBOS_TYPES) $(LIBKV) $(LIBFUSE_LIBS)
+--
+2.10.2
+
diff --git a/sys-cluster/ceph/files/ceph-10.2.9-cflags.patch b/sys-cluster/ceph/files/ceph-10.2.9-cflags.patch
new file mode 100644
index 000000000000..31221ae2f994
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.9-cflags.patch
@@ -0,0 +1,15 @@
+diff --git a/src/Makefile-env.am b/src/Makefile-env.am
+index 4771bad02d..f92e20479b 100644
+--- a/src/Makefile-env.am
++++ b/src/Makefile-env.am
+@@ -53,10 +53,6 @@ endif
+ ## automake environment
+
+ HARDENING_CFLAGS = \
+- -O2 \
+- -g \
+- -pipe \
+- -Wall \
+ -Wp,-U_FORTIFY_SOURCE \
+ -Wp,-D_FORTIFY_SOURCE=2 \
+ -fexceptions \
diff --git a/sys-cluster/ceph/files/ceph-10.2.9-dont-run-lsb_release.patch b/sys-cluster/ceph/files/ceph-10.2.9-dont-run-lsb_release.patch
new file mode 100644
index 000000000000..a6b5515cee28
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.9-dont-run-lsb_release.patch
@@ -0,0 +1,65 @@
+diff --git a/src/ceph-detect-init/Makefile.am b/src/ceph-detect-init/Makefile.am
+index 3926ac4bec..90e2eae50c 100644
+--- a/src/ceph-detect-init/Makefile.am
++++ b/src/ceph-detect-init/Makefile.am
+@@ -67,7 +67,7 @@ ceph-detect-init-clean:
+ ceph-detect-init-install-data:
+ cd $(srcdir)/ceph-detect-init ; \
+ if test "$(DESTDIR)" ; then \
+- if lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
++ if command -v lsb_release >/dev/null && lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
+ options=--install-layout=deb ; \
+ else \
+ options=--prefix=/usr ; \
+diff --git a/src/ceph-disk/Makefile.am b/src/ceph-disk/Makefile.am
+index a8532878c8..d908b1649a 100644
+--- a/src/ceph-disk/Makefile.am
++++ b/src/ceph-disk/Makefile.am
+@@ -43,7 +43,7 @@ ceph-disk-clean:
+ ceph-disk-install-data:
+ cd $(srcdir)/ceph-disk ; \
+ if test "$(DESTDIR)" ; then \
+- if lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
++ if command -v lsb_release >/dev/null && lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
+ options=--install-layout=deb ; \
+ else \
+ options=--prefix=/usr ; \
+diff --git a/src/pybind/cephfs/Makefile.am b/src/pybind/cephfs/Makefile.am
+index 698522daa4..c49c190986 100644
+--- a/src/pybind/cephfs/Makefile.am
++++ b/src/pybind/cephfs/Makefile.am
+@@ -15,7 +15,7 @@ cephfs-pybind-clean: ${srcdir}/ceph_ver.h
+
+ cephfs-pybind-install-exec: ${srcdir}/ceph_ver.h
+ if test "$(DESTDIR)" ; then \
+- if lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
++ if command -v lsb_release >/dev/null && lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
+ options=--install-layout=deb ; \
+ else \
+ options=--prefix=/usr ; \
+diff --git a/src/pybind/rados/Makefile.am b/src/pybind/rados/Makefile.am
+index a4145bf0f4..960395fee8 100644
+--- a/src/pybind/rados/Makefile.am
++++ b/src/pybind/rados/Makefile.am
+@@ -15,7 +15,7 @@ rados-pybind-clean: ${srcdir}/ceph_ver.h
+
+ rados-pybind-install-exec: ${srcdir}/ceph_ver.h
+ if test "$(DESTDIR)" ; then \
+- if lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
++ if command -v lsb_release >/dev/null && lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
+ options=--install-layout=deb ; \
+ else \
+ options=--prefix=/usr ; \
+diff --git a/src/pybind/rbd/Makefile.am b/src/pybind/rbd/Makefile.am
+index 7dd49333fa..fbb940d07d 100644
+--- a/src/pybind/rbd/Makefile.am
++++ b/src/pybind/rbd/Makefile.am
+@@ -15,7 +15,7 @@ rbd-pybind-clean: ${srcdir}/ceph_ver.h
+
+ rbd-pybind-install-exec: ${srcdir}/ceph_ver.h
+ if test "$(DESTDIR)" ; then \
+- if lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
++ if command -v lsb_release >/dev/null && lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
+ options=--install-layout=deb ; \
+ else \
+ options=--prefix=/usr ; \
diff --git a/sys-cluster/ceph/files/ceph-10.2.9-filestore_fix_infinit_loops_in_fiemap.patch b/sys-cluster/ceph/files/ceph-10.2.9-filestore_fix_infinit_loops_in_fiemap.patch
new file mode 100644
index 000000000000..e67113e51cc8
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.9-filestore_fix_infinit_loops_in_fiemap.patch
@@ -0,0 +1,82 @@
+From b52bfe6b443f0ff88c8614441752102058063699 Mon Sep 17 00:00:00 2001
+From: Ning Yao <yaoning@unitedstack.com>
+Date: Thu, 6 Apr 2017 11:12:04 +0000
+Subject: [PATCH] os/filestore: fix infinit loops in fiemap()
+
+since fiemap can get extents based on offset --> len
+but we should consider last extents is retrieved when len == 0
+even though it is not last fiemap extents
+
+Signed-off-by: Ning Yao <yaoning@unitedstack.com>
+(cherry picked from commit 36f6b668a8910d76847674086cbc86910c78faee)
+---
+ src/os/filestore/FileStore.cc | 13 +++++--------
+ src/test/objectstore/store_test.cc | 21 +++++++++++++++++++++
+ 2 files changed, 26 insertions(+), 8 deletions(-)
+
+diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc
+index c47b0d0d2eae..95f48cdf4960 100644
+--- a/src/os/filestore/FileStore.cc
++++ b/src/os/filestore/FileStore.cc
+@@ -3102,17 +3102,14 @@ int FileStore::_do_fiemap(int fd, uint64_t offset, size_t len,
+ i++;
+ last = extent++;
+ }
+- const bool is_last = last->fe_flags & FIEMAP_EXTENT_LAST;
++ uint64_t xoffset = last->fe_logical + last->fe_length - offset;
++ offset = last->fe_logical + last->fe_length;
++ len -= xoffset;
++ const bool is_last = (last->fe_flags & FIEMAP_EXTENT_LAST) || (len == 0);
++ free(fiemap);
+ if (!is_last) {
+- uint64_t xoffset = last->fe_logical + last->fe_length - offset;
+- offset = last->fe_logical + last->fe_length;
+- len -= xoffset;
+- free(fiemap); /* fix clang warn: use-after-free */
+ goto more;
+ }
+- else {
+- free(fiemap);
+- }
+
+ return r;
+ }
+diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc
+index 5ab011ad17d8..4cada7e2e435 100644
+--- a/src/test/objectstore/store_test.cc
++++ b/src/test/objectstore/store_test.cc
+@@ -279,6 +279,7 @@ TEST_P(StoreTest, FiemapHoles) {
+ ASSERT_EQ(r, 0);
+ }
+ {
++ //fiemap test from 0 to SKIP_STEP * (MAX_EXTENTS - 1) + 3
+ bufferlist bl;
+ store->fiemap(cid, oid, 0, SKIP_STEP * (MAX_EXTENTS - 1) + 3, bl);
+ map<uint64_t,uint64_t> m, e;
+@@ -295,6 +296,26 @@ TEST_P(StoreTest, FiemapHoles) {
+ ASSERT_TRUE((m.size() == 1 &&
+ m[0] > SKIP_STEP * (MAX_EXTENTS - 1)) ||
+ (m.size() == MAX_EXTENTS && extents_exist));
++
++ // fiemap test from SKIP_STEP to SKIP_STEP * (MAX_EXTENTS - 2) + 3
++ // reset bufferlist and map
++ bl.clear();
++ m.clear();
++ e.clear();
++ store->fiemap(cid, oid, SKIP_STEP, SKIP_STEP * (MAX_EXTENTS - 2) + 3, bl);
++ p = bl.begin();
++ ::decode(m, p);
++ cout << " got " << m << std::endl;
++ ASSERT_TRUE(!m.empty());
++ ASSERT_GE(m[SKIP_STEP], 3u);
++ extents_exist = true;
++ if (m.size() == (MAX_EXTENTS - 2)) {
++ for (uint64_t i = 1; i < MAX_EXTENTS - 1; i++)
++ extents_exist = extents_exist && m.count(SKIP_STEP*i);
++ }
++ ASSERT_TRUE((m.size() == 1 &&
++ m[SKIP_STEP] > SKIP_STEP * (MAX_EXTENTS - 2)) ||
++ (m.size() == (MAX_EXTENTS - 1) && extents_exist));
+ }
+ {
+ ObjectStore::Transaction t;
diff --git a/sys-cluster/ceph/files/ceph-10.2.9-libradosstriper_fix_format_injection_vulnerability.patch b/sys-cluster/ceph/files/ceph-10.2.9-libradosstriper_fix_format_injection_vulnerability.patch
new file mode 100644
index 000000000000..eaf18c35783d
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.9-libradosstriper_fix_format_injection_vulnerability.patch
@@ -0,0 +1,35 @@
+diff --git a/src/libradosstriper/RadosStriperImpl.cc b/src/libradosstriper/RadosStriperImpl.cc
+index 22352d9125..70dcb7569f 100644
+--- a/src/libradosstriper/RadosStriperImpl.cc
++++ b/src/libradosstriper/RadosStriperImpl.cc
+@@ -12,6 +12,8 @@
+ *
+ */
+
++#include <boost/algorithm/string/replace.hpp>
++
+ #include "libradosstriper/RadosStriperImpl.h"
+
+ #include <errno.h>
+@@ -466,7 +468,9 @@ int libradosstriper::RadosStriperImpl::aio_read(const std::string& soid,
+ // get list of extents to be read from
+ vector<ObjectExtent> *extents = new vector<ObjectExtent>();
+ if (read_len > 0) {
+- std::string format = soid + RADOS_OBJECT_EXTENSION_FORMAT;
++ std::string format = soid;
++ boost::replace_all(format, "%", "%%");
++ format += RADOS_OBJECT_EXTENSION_FORMAT;
+ file_layout_t l;
+ l.from_legacy(layout);
+ Striper::file_to_extents(cct(), format.c_str(), &l, off, read_len,
+@@ -776,7 +780,9 @@ libradosstriper::RadosStriperImpl::internal_aio_write(const std::string& soid,
+ if (len > 0) {
+ // get list of extents to be written to
+ vector<ObjectExtent> extents;
+- std::string format = soid + RADOS_OBJECT_EXTENSION_FORMAT;
++ std::string format = soid;
++ boost::replace_all(format, "%", "%%");
++ format += RADOS_OBJECT_EXTENSION_FORMAT;
+ file_layout_t l;
+ l.from_legacy(layout);
+ Striper::file_to_extents(cct(), format.c_str(), &l, off, len, 0, extents);
diff --git a/sys-cluster/ceph/files/ceph-10.2.9-librbd_filter_expected_error_codes_from_is_exclusive_lock_owner.patch b/sys-cluster/ceph/files/ceph-10.2.9-librbd_filter_expected_error_codes_from_is_exclusive_lock_owner.patch
new file mode 100644
index 000000000000..6800285318f0
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.9-librbd_filter_expected_error_codes_from_is_exclusive_lock_owner.patch
@@ -0,0 +1,28 @@
+From 787ba33e5dba285dff874955a8f0d7aabd3f87fe Mon Sep 17 00:00:00 2001
+From: Jason Dillaman <dillaman@redhat.com>
+Date: Mon, 5 Jun 2017 08:17:05 -0400
+Subject: [PATCH] librbd: filter expected error codes from
+ is_exclusive_lock_owner
+
+Fixes: http://tracker.ceph.com/issues/20182
+Signed-off-by: Jason Dillaman <dillaman@redhat.com>
+(cherry picked from commit d4daaf54e6bc42cd4fb2111ea20b2042941b0c31)
+---
+ src/librbd/internal.cc | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc
+index 9fecb1e1688f..6021be078090 100644
+--- a/src/librbd/internal.cc
++++ b/src/librbd/internal.cc
+@@ -2110,7 +2110,9 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force,
+ // might have been blacklisted by peer -- ensure we still own
+ // the lock by pinging the OSD
+ int r = ictx->exclusive_lock->assert_header_locked();
+- if (r < 0) {
++ if (r == -EBUSY || r == -ENOENT) {
++ return 0;
++ } else if (r < 0) {
+ return r;
+ }
+
diff --git a/sys-cluster/ceph/files/ceph-10.2.9-osd-scrub_to_specifies_clone_ver_but_transaction_include.patch b/sys-cluster/ceph/files/ceph-10.2.9-osd-scrub_to_specifies_clone_ver_but_transaction_include.patch
new file mode 100644
index 000000000000..8bf14c2944ba
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.9-osd-scrub_to_specifies_clone_ver_but_transaction_include.patch
@@ -0,0 +1,39 @@
+From 153f77544118613e19d5e88c030c3901234cf950 Mon Sep 17 00:00:00 2001
+From: David Zafman <dzafman@redhat.com>
+Date: Tue, 18 Jul 2017 15:08:14 -0700
+Subject: [PATCH] osd: scrub_to specifies clone ver, but transaction include
+ head write ver
+
+Fixes: http://tracker.ceph.com/issues/20041
+
+Signed-off-by: David Zafman <dzafman@redhat.com>
+(cherry picked from commit fd598a0d23d61c645633ae774c3404a43d035e3c)
+
+Conflicts:
+ src/osd/ReplicatedPG.cc (trivial)
+---
+ src/osd/ReplicatedPG.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc
+index 4b4dc34c602a..4d80ad1770e1 100644
+--- a/src/osd/ReplicatedPG.cc
++++ b/src/osd/ReplicatedPG.cc
+@@ -8318,7 +8318,7 @@ void ReplicatedPG::op_applied(const eversion_t &applied_version)
+ last_update_applied = applied_version;
+ if (is_primary()) {
+ if (scrubber.active) {
+- if (last_update_applied == scrubber.subset_last_update) {
++ if (last_update_applied >= scrubber.subset_last_update) {
+ requeue_scrub();
+ }
+ } else {
+@@ -8326,7 +8326,7 @@ void ReplicatedPG::op_applied(const eversion_t &applied_version)
+ }
+ } else {
+ if (scrubber.active_rep_scrub) {
+- if (last_update_applied == static_cast<MOSDRepScrub*>(
++ if (last_update_applied >= static_cast<MOSDRepScrub*>(
+ scrubber.active_rep_scrub->get_req())->scrub_to) {
+ osd->op_wq.queue(
+ make_pair(
diff --git a/sys-cluster/ceph/files/ceph-10.2.9-rbd-do_not_attempt_to_load_key_if_auth_is_disabled.patch b/sys-cluster/ceph/files/ceph-10.2.9-rbd-do_not_attempt_to_load_key_if_auth_is_disabled.patch
new file mode 100644
index 000000000000..4b03e335bc58
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.9-rbd-do_not_attempt_to_load_key_if_auth_is_disabled.patch
@@ -0,0 +1,39 @@
+From 0cd7df3649d7486d444a61cab89c48a89ddd3e8d Mon Sep 17 00:00:00 2001
+From: Jason Dillaman <dillaman@redhat.com>
+Date: Thu, 29 Jun 2017 14:54:40 -0400
+Subject: [PATCH] rbd: do not attempt to load key if auth is disabled
+
+Fixes: http://tracker.ceph.com/issues/19035
+Signed-off-by: Jason Dillaman <dillaman@redhat.com>
+(cherry picked from commit 8b9c8df6d7f0b75c5451953bb322bc1f9afb6299)
+---
+ src/krbd.cc | 16 +++++++++-------
+ 1 file changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/src/krbd.cc b/src/krbd.cc
+index a0e546fa7f6f..2bb6b4270abd 100644
+--- a/src/krbd.cc
++++ b/src/krbd.cc
+@@ -129,13 +129,15 @@ static int build_map_buf(CephContext *cct, const char *pool, const char *image,
+ oss << " name=" << cct->_conf->name.get_id();
+
+ KeyRing keyring;
+- r = keyring.from_ceph_context(cct);
+- if (r == -ENOENT && !(cct->_conf->keyfile.length() ||
+- cct->_conf->key.length()))
+- r = 0;
+- if (r < 0) {
+- cerr << "rbd: failed to get secret" << std::endl;
+- return r;
++ if (cct->_conf->auth_client_required != "none") {
++ r = keyring.from_ceph_context(cct);
++ if (r == -ENOENT && !(cct->_conf->keyfile.length() ||
++ cct->_conf->key.length()))
++ r = 0;
++ if (r < 0) {
++ cerr << "rbd: failed to get secret" << std::endl;
++ return r;
++ }
+ }
+
+ CryptoKey secret;
diff --git a/sys-cluster/ceph/files/ceph-10.2.9-rbd-nbd_relax_size_check_for_newer_kernel_versions.patch b/sys-cluster/ceph/files/ceph-10.2.9-rbd-nbd_relax_size_check_for_newer_kernel_versions.patch
new file mode 100644
index 000000000000..5cb89be0edf1
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.9-rbd-nbd_relax_size_check_for_newer_kernel_versions.patch
@@ -0,0 +1,28 @@
+diff --git a/src/tools/rbd_nbd/rbd-nbd.cc b/src/tools/rbd_nbd/rbd-nbd.cc
+index 2e399ab832..88e1e0ff65 100644
+--- a/src/tools/rbd_nbd/rbd-nbd.cc
++++ b/src/tools/rbd_nbd/rbd-nbd.cc
+@@ -469,6 +469,10 @@ static int open_device(const char* path, bool try_load_moudle = false)
+
+ static int check_device_size(int nbd_index, unsigned long expected_size)
+ {
++ // There are bugs with some older kernel versions that result in an
++ // overflow for large image sizes. This check is to ensure we are
++ // not affected.
++
+ unsigned long size = 0;
+ std::string path = "/sys/block/nbd" + stringify(nbd_index) + "/size";
+ std::ifstream ifs;
+@@ -480,6 +484,12 @@ static int check_device_size(int nbd_index, unsigned long expected_size)
+ ifs >> size;
+ size *= RBD_NBD_BLKSIZE;
+
++ if (size == 0) {
++ // Newer kernel versions will report real size only after nbd
++ // connect. Assume this is the case and return success.
++ return 0;
++ }
++
+ if (size != expected_size) {
+ cerr << "rbd-nbd: kernel reported invalid device size (" << size
+ << ", expected " << expected_size << ")" << std::endl;
diff --git a/sys-cluster/ceph/files/ceph-10.2.9-unlock_sdata_op_ordering_lock_with_sdata_lock.patch b/sys-cluster/ceph/files/ceph-10.2.9-unlock_sdata_op_ordering_lock_with_sdata_lock.patch
new file mode 100644
index 000000000000..60f46ab36a40
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-10.2.9-unlock_sdata_op_ordering_lock_with_sdata_lock.patch
@@ -0,0 +1,32 @@
+From 3fa277b479d69699bf5a6875cd4a5efcf9ae0788 Mon Sep 17 00:00:00 2001
+From: Alexey Sheplyakov <asheplyakov@mirantis.com>
+Date: Tue, 27 Jun 2017 16:07:01 +0400
+Subject: [PATCH] jewel: osd: unlock sdata_op_ordering_lock with sdata_lock
+ hold to avoid missing wakeup signal
+
+Based on commit bc683385819146f3f6f096ceec97e1226a3cd237. The OSD code has
+been refactored a lot since Jewel, hence cherry-picking that patch introduces
+a lot of unrelated changes, and is much more difficult than reusing the idea.
+
+Fixes: http://tracker.ceph.com/issues/20428
+
+Signed-off-by: Alexey Sheplyakov <asheplyakov@mirantis.com>
+---
+ src/osd/OSD.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
+index f5cfda3b686a..38a2711f6f92 100644
+--- a/src/osd/OSD.cc
++++ b/src/osd/OSD.cc
+@@ -8727,9 +8727,9 @@ void OSD::ShardedOpWQ::_process(uint32_t thread_index, heartbeat_handle_d *hb )
+ assert(NULL != sdata);
+ sdata->sdata_op_ordering_lock.Lock();
+ if (sdata->pqueue->empty()) {
+- sdata->sdata_op_ordering_lock.Unlock();
+ osd->cct->get_heartbeat_map()->reset_timeout(hb, 4, 0);
+ sdata->sdata_lock.Lock();
++ sdata->sdata_op_ordering_lock.Unlock();
+ sdata->sdata_cond.WaitInterval(osd->cct, sdata->sdata_lock, utime_t(2, 0));
+ sdata->sdata_lock.Unlock();
+ sdata->sdata_op_ordering_lock.Lock();
diff --git a/sys-cluster/ceph/files/ceph-12.2.0-cflags.patch b/sys-cluster/ceph/files/ceph-12.2.0-cflags.patch
new file mode 100644
index 000000000000..0f02e6e6d433
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-12.2.0-cflags.patch
@@ -0,0 +1,13 @@
+diff --git a/cmake/modules/Distutils.cmake b/cmake/modules/Distutils.cmake
+index 24d1a50654..a9fac61196 100644
+--- a/cmake/modules/Distutils.cmake
++++ b/cmake/modules/Distutils.cmake
+@@ -43,7 +43,7 @@ function(distutils_add_cython_module name src)
+ CC=${PY_CC}
+ CXX=${PY_CXX}
+ LDSHARED=${PY_LDSHARED}
+- OPT=\"-DNDEBUG -g -fwrapv -O2 -w\"
++ OPT=\"-DNDEBUG -fwrapv -w\"
+ LDFLAGS=-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+ CYTHON_BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR}
+ CEPH_LIBDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
diff --git a/sys-cluster/ceph/files/ceph-12.2.0-use-provided-cpu-flag-values.patch b/sys-cluster/ceph/files/ceph-12.2.0-use-provided-cpu-flag-values.patch
new file mode 100644
index 000000000000..55c82b0a272b
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-12.2.0-use-provided-cpu-flag-values.patch
@@ -0,0 +1,37 @@
+diff --git a/cmake/modules/SIMDExt.cmake b/cmake/modules/SIMDExt.cmake
+index 5330835aa1..a4dd881e34 100644
+--- a/cmake/modules/SIMDExt.cmake
++++ b/cmake/modules/SIMDExt.cmake
+@@ -76,32 +76,25 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|ARM")
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|amd64|x86_64|AMD64")
+ set(HAVE_INTEL 1)
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "i686|amd64|x86_64|AMD64")
+- CHECK_C_COMPILER_FLAG(-msse HAVE_INTEL_SSE)
+ if(HAVE_INTEL_SSE)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse")
+ endif()
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
+- CHECK_C_COMPILER_FLAG(-msse2 HAVE_INTEL_SSE2)
+ if(HAVE_INTEL_SSE2)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse2")
+ endif()
+- CHECK_C_COMPILER_FLAG(-msse3 HAVE_INTEL_SSE3)
+ if(HAVE_INTEL_SSE3)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse3")
+ endif()
+- CHECK_C_COMPILER_FLAG(-mssse3 HAVE_INTEL_SSSE3)
+ if(HAVE_INTEL_SSSE3)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mssse3")
+ endif()
+- CHECK_C_COMPILER_FLAG(-mpclmul HAVE_INTEL_PCLMUL)
+ if(HAVE_INTEL_PCLMUL)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mpclmul")
+ endif()
+- CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_INTEL_SSE4_1)
+ if(HAVE_INTEL_SSE4_1)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.1")
+ endif()
+- CHECK_C_COMPILER_FLAG(-msse4.2 HAVE_INTEL_SSE4_2)
+ if(HAVE_INTEL_SSE4_2)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.2")
+ endif()
diff --git a/sys-cluster/ceph/files/ceph-12.2.1-systemd-unitdir.patch b/sys-cluster/ceph/files/ceph-12.2.1-systemd-unitdir.patch
new file mode 100644
index 000000000000..28d1a02d711b
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-12.2.1-systemd-unitdir.patch
@@ -0,0 +1,10 @@
+diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt
+index 3b03b6e613..c359ad2df9 100644
+--- a/systemd/CMakeLists.txt
++++ b/systemd/CMakeLists.txt
+@@ -17,4 +17,4 @@ install(FILES
+ ceph-disk@.service
+ ceph-volume@.service
+ rbdmap.service
+- DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/systemd/system)
++ DESTINATION ${SYSTEMD_UNITDIR})
diff --git a/sys-cluster/ceph/files/ceph-mds_at.service b/sys-cluster/ceph/files/ceph-mds_at.service
new file mode 100644
index 000000000000..c28604e3c430
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-mds_at.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Ceph metadata server daemon
+After=network-online.target local-fs.target
+Wants=network-online.target local-fs.target
+PartOf=ceph.target
+
+[Service]
+Environment=CLUSTER=ceph
+ExecStart=/usr/bin/ceph-mds -f --cluster ${CLUSTER} --id %i
+
+[Install]
+WantedBy=ceph.target
diff --git a/sys-cluster/ceph/files/ceph-mds_at.service.conf b/sys-cluster/ceph/files/ceph-mds_at.service.conf
new file mode 100644
index 000000000000..0172cbeadeee
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-mds_at.service.conf
@@ -0,0 +1,4 @@
+# Uncomment the following lines to configure the cluster name for Ceph MDSs.
+
+#[Service]
+#Environment=CLUSTER=ceph
diff --git a/sys-cluster/ceph/files/ceph-mon_at.service b/sys-cluster/ceph/files/ceph-mon_at.service
new file mode 100644
index 000000000000..4f54cc158c5b
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-mon_at.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=Ceph cluster monitor daemon
+After=network-online.target
+Wants=network-online.target
+
+# According to:
+# http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget
+# these can be removed once ceph-mon will dynamically change network
+# configuration.
+After=network-online.target local-fs.target
+Wants=network-online.target local-fs.target
+PartOf=ceph.target
+
+[Service]
+Environment=CLUSTER=ceph
+ExecStart=/usr/bin/ceph-mon -f --cluster ${CLUSTER} --id %i
+
+[Install]
+WantedBy=ceph.target
diff --git a/sys-cluster/ceph/files/ceph-osd_at.service b/sys-cluster/ceph/files/ceph-osd_at.service
new file mode 100644
index 000000000000..7bf125f63c78
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-osd_at.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Ceph object storage daemon
+After=network-online.target local-fs.target
+Wants=network-online.target local-fs.target
+PartOf=ceph.target
+
+[Service]
+Environment=CLUSTER=ceph
+ExecStart=/usr/bin/ceph-osd -f --cluster ${CLUSTER} --id %i
+ExecStartPre=/usr/libexec/ceph/ceph-osd-prestart.sh --cluster ${CLUSTER} --id %i
+
+[Install]
+WantedBy=ceph.target
diff --git a/sys-cluster/ceph/files/ceph-osd_at.service.conf b/sys-cluster/ceph/files/ceph-osd_at.service.conf
new file mode 100644
index 000000000000..959b948c1178
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-osd_at.service.conf
@@ -0,0 +1,4 @@
+# Uncomment the following lines to configure the cluster name for Ceph OSDs.
+
+#[Service]
+#Environment=CLUSTER=ceph
diff --git a/sys-cluster/ceph/files/ceph.confd-r1 b/sys-cluster/ceph/files/ceph.confd-r1
new file mode 100644
index 000000000000..3bdb8b485ed8
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph.confd-r1
@@ -0,0 +1,4 @@
+# Example
+
+# default ceph conf file
+#ceph_conf="/etc/ceph/ceph.conf"
diff --git a/sys-cluster/ceph/files/ceph.confd-r2 b/sys-cluster/ceph/files/ceph.confd-r2
new file mode 100644
index 000000000000..13b1cfad4588
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph.confd-r2
@@ -0,0 +1,8 @@
+# default ceph conf file
+#ceph_conf="/etc/ceph/ceph.conf"
+
+# Set ulimits for Ceph services.
+rc_ulimit="-n 32768"
+
+# initd stop timeout.
+#CEPH_TERMTIMEOUT="TERM/60/KILL/5"
diff --git a/sys-cluster/ceph/files/ceph.confd-r3 b/sys-cluster/ceph/files/ceph.confd-r3
new file mode 100644
index 000000000000..54673c2688f7
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph.confd-r3
@@ -0,0 +1,61 @@
+# /etc/conf.d/ceph: startup configurations for ceph
+
+# default ceph conf file
+#ceph_conf="/etc/ceph/ceph.conf"
+
+# Set ulimits for Ceph services.
+#rc_ulimit="-n 131072 -u 257256"
+
+# the directory under /run to store runtime information in
+#rundir=/run/ceph
+
+# the user and group to run ceph as
+
+# settings for openrc supervisor for various ceph daemons
+#
+# defaults (can be overidden for each daemon)
+#respawn_delay=20
+#respawn_max=5
+#respawn_period=1800
+#stdout="/dev/null"
+#stderr="/dev/null"
+
+# radosgw
+#radosgw_respawn_max
+#radosgw_respawn_delay=20
+#radosgw_respawn_period=1800
+#radosgw_stdout="/dev/null"
+#radosgw_stderr="/dev/null"
+
+# mon
+#mon_respawn_max=5
+#mon_respawn_delay=20
+#mon_respawn_period=1800
+#mon_stdout="/dev/null"
+#mon_stderr="/dev/null"
+
+# osd
+#osd_respawn_max=5
+#osd_respawn_delay=30
+#osd_respawn_period=1800
+#osd_stdout="/dev/null"
+#osd_stderr="/dev/null"
+
+# mds
+#mds_respawn_max=5
+#mds_respawn_delay=20
+#mds_respawn_period=1800
+#mds_stdout="/dev/null"
+#mds_stderr="/dev/null"
+
+# mgr
+#mgr_respawn_max=5
+#mgr_respawn_delay=20
+#mgr_respawn_period=1800
+#mgr_stdout="/dev/null"
+#mgr_stderr="/dev/null"
+
+# initd stop timeout.
+#CEPH_TERMTIMEOUT="TERM/120/KILL/5"
+#
+# vim:ft=gentoo-conf-d:ts=4:sts=4:sw=4:noet:
diff --git a/sys-cluster/ceph/files/ceph.initd-r1.1 b/sys-cluster/ceph/files/ceph.initd-r1.1
new file mode 100644
index 000000000000..bb603259715d
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph.initd-r1.1
@@ -0,0 +1,39 @@
+#!/sbin/openrc-run
+
+ceph_conf="${ceph_conf:-/etc/ceph/ceph.conf}"
+extra_commands="reload"
+daemon_type="${RC_SVCNAME#ceph-}"
+daemon_type="${daemon_type%.*}"
+daemon_id="${RC_SVCNAME#ceph-*.}"
+daemon_id="${daemon_id:-0}"
+command="/usr/bin/ceph-${daemon_type}"
+pidfile="/run/ceph/${daemon_type}.${daemon_id}.pid"
+command_args="-i ${daemon_id} --pid-file ${pidfile} -c ${ceph_conf}"
+
+depend() {
+ after net ntpd ntp-client chronyd
+ before netmount
+}
+
+is_type_valid() {
+ case ${daemon_type} in
+ mon|mds|osd) return 0;;
+ *) return 1;;
+ esac
+}
+
+start_pre() {
+ checkpath -d -q -o ceph "$(dirname "${pidfile}")"
+ if ! is_type_valid ;then
+ eerror "Please give valid Ceph Server Type: mds, mon, osd"
+ return 1
+ fi
+}
+
+reload() {
+ ebegin "Reloading Ceph ${daemon_type}.${daemon_id}"
+ start-stop-daemon --signal 1 ${start_stop_daemon_args} --pidfile "${pidfile}"
+ eend $?
+}
+
+# vim:ft=gentoo-init-d:ts=4:sts=4:sw=4:noet:
diff --git a/sys-cluster/ceph/files/ceph.initd-r2 b/sys-cluster/ceph/files/ceph.initd-r2
new file mode 100644
index 000000000000..16267c58a139
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph.initd-r2
@@ -0,0 +1,40 @@
+#!/sbin/openrc-run
+
+ceph_conf="${ceph_conf:-/etc/ceph/ceph.conf}"
+extra_commands="reload"
+daemon_type="${RC_SVCNAME#ceph-}"
+daemon_type="${daemon_type%.*}"
+daemon_id="${RC_SVCNAME#ceph-*.}"
+daemon_id="${daemon_id:-0}"
+command="/usr/bin/ceph-${daemon_type}"
+pidfile="/run/ceph/${daemon_type}.${daemon_id}.pid"
+command_args="-i ${daemon_id} --pid-file ${pidfile} -c ${ceph_conf}"
+start_stop_daemon_args="--user ceph --group ceph"
+
+depend() {
+ after net ntpd ntp-client chronyd
+ before netmount
+}
+
+is_type_valid() {
+ case ${daemon_type} in
+ mon|mds|osd) return 0;;
+ *) return 1;;
+ esac
+}
+
+start_pre() {
+ checkpath -d -q -o ceph "$(dirname "${pidfile}")"
+ if ! is_type_valid ;then
+ eerror "Please give valid Ceph Server Type: mds, mon, osd"
+ return 1
+ fi
+}
+
+reload() {
+ ebegin "Reloading Ceph ${daemon_type}.${daemon_id}"
+ start-stop-daemon --signal 1 ${start_stop_daemon_args} --pidfile "${pidfile}"
+ eend $?
+}
+
+# vim:ft=gentoo-init-d:ts=4:sts=4:sw=4:noet:
diff --git a/sys-cluster/ceph/files/ceph.initd-r4 b/sys-cluster/ceph/files/ceph.initd-r4
new file mode 100644
index 000000000000..33e1a3002ac9
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph.initd-r4
@@ -0,0 +1,49 @@
+#!/sbin/openrc-run
+
+ceph_conf="${ceph_conf:-/etc/ceph/ceph.conf}"
+extra_commands="reload"
+daemon_type="${RC_SVCNAME#ceph-}"
+daemon_type="${daemon_type%%.*}"
+daemon_id="${RC_SVCNAME#ceph-*.}"
+daemon_id="${daemon_id:-0}"
+command="/usr/bin/ceph-${daemon_type}"
+pidfile="/run/ceph/${daemon_type}.${daemon_id}.pid"
+command_args="-i ${daemon_id} --pid-file ${pidfile} -c ${ceph_conf}"
+start_stop_daemon_args="--user ceph --group ceph"
+retry="${CEPH_TERMTIMEOUT:-TERM/60/KILL/5}"
+
+depend() {
+ after net ntpd ntp-client chronyd
+ before netmount
+}
+
+is_type_valid() {
+ case ${daemon_type} in
+ mon|mds|osd) return 0;;
+ *) return 1;;
+ esac
+}
+
+start_pre() {
+ export CEPH_CONF="${ceph_conf}"
+
+ checkpath -d -q -o ceph "$(dirname "${pidfile}")"
+
+ if ! is_type_valid ;then
+ eerror "Please give valid Ceph Server Type: mds, mon, osd"
+ return 1
+ fi
+
+ if pgrep -f "[c]eph-${daemon_type} -i ${daemon_id} "; then
+ eerror "${daemon_type}.${daemon_id} is still running, refusing to start"
+ return 1
+ fi
+}
+
+reload() {
+ ebegin "Reloading Ceph ${daemon_type}.${daemon_id}"
+ start-stop-daemon --signal 1 ${start_stop_daemon_args} --pidfile "${pidfile}"
+ eend $?
+}
+
+# vim:ft=gentoo-init-d:ts=4:sts=4:sw=4:noet:
diff --git a/sys-cluster/ceph/files/ceph.initd-r5 b/sys-cluster/ceph/files/ceph.initd-r5
new file mode 100644
index 000000000000..7087de605175
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph.initd-r5
@@ -0,0 +1,87 @@
+#!/sbin/openrc-run
+
+ceph_conf="${ceph_conf:-/etc/ceph/ceph.conf}"
+extra_commands="reload"
+daemon_type="${RC_SVCNAME#ceph-}"
+daemon_type="${daemon_type%%.*}"
+daemon_id="${RC_SVCNAME#ceph-*.}"
+daemon_id="${daemon_id:-0}"
+: ${rundir:=/run/ceph}
+: ${user:=ceph}
+: ${group:=ceph}
+: ${rc_ulimit:=-n 131072 -u 257256}
+
+pidfile="${rundir}/supervisor-${daemon_type}.${daemon_id}.pid"
+daemon_pidfile="${rundir}/${daemon_type}.${daemon_id}.pid"
+
+command="/usr/bin/${RC_SVCNAME%%.*}"
+command_args="-i ${daemon_id} --pid-file ${daemon_pidfile} -c ${ceph_conf}"
+command_args_foreground="--foreground"
+
+retry="${CEPH_TERMTIMEOUT:-TERM/120/KILL/5}"
+start_stop_daemon_args="--user ${user} --group ${group}"
+supervise_daemon_args="--user ${user} --group ${group}"
+
+: ${supervisor:=supervise-daemon}
+: ${stdout:=/dev/null}
+: ${stderr:=/dev/null}
+: ${respawn_delay:=10}
+: ${respawn_max:=5}
+: ${respawn_period:=1800}
+
+: ${osd_respawn_delay:=15}
+: ${osd_respawn_max:=10}
+
+: ${radosgw_respawn_max:=5}
+: ${radosgw_respawn_period:=30}
+
+depend() {
+ use dns logger
+ after net ntpd ntp-client chronyd
+ before netmount
+}
+
+is_type_valid() {
+ case ${daemon_type} in
+ mon|mds|osd|mgr|radosgw) return 0;;
+ *) return 1;;
+ esac
+}
+
+start_pre() {
+ export CEPH_CONF="${ceph_conf}"
+
+ checkpath -d -q -o "${user}:${group}" "${rundir}"
+
+ if ! is_type_valid ;then
+ eerror "Please give valid Ceph Server Type: mds, mon, osd"
+ return 1
+
+ elif pgrep -f "[c]eph-${daemon_type} -i ${daemon_id} "; then
+ eerror "${daemon_type}.${daemon_id} is still running, refusing to start"
+ return 1
+ fi
+
+ local arg_name arg_val
+ for arg_name in std{out,err} respawn_{delay,max,period}; do
+ eval arg_val="\${${daemon_type}_${arg_name}}"
+
+ if [ -z "${arg_val}" ]; then
+ eval arg_val="\${${arg_name}}"
+ else
+ eval "${arg_name}=\"${arg_val}\""
+ fi
+
+ if [ "${arg_name}" = "stderr" ] || [ "${arg_name}" = "stdout" ]; then
+ supervise_daemon_args="${supervise_daemon_args} --${arg_name//_/-}=${arg_val}"
+ fi
+ done
+}
+
+reload() {
+ ebegin "Reloading Ceph ${daemon_type}.${daemon_id}"
+ start-stop-daemon --signal 1 "${start_stop_daemon_args}"
+ eend ${?}
+}
+
+# vim:ft=gentoo-init-d:ts=4:sts=4:sw=4:noet:
diff --git a/sys-cluster/ceph/files/ceph.logrotate b/sys-cluster/ceph/files/ceph.logrotate
new file mode 100644
index 000000000000..df03f5e69a4b
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph.logrotate
@@ -0,0 +1,18 @@
+/var/log/ceph/*.log
+{
+ rotate 7
+ daily
+ compress
+ sharedscripts
+ prerotate
+ for dmn in $(cd /run/ceph && ls *.asok 2>/dev/null); do
+ ceph --admin-daemon /run/ceph/${dmn} log flush 2>/dev/null >/dev/null
+ done
+ endscript
+ postrotate
+ for dmn in $(cd /run/ceph && ls *.asok 2>/dev/null); do
+ ceph --admin-daemon /run/ceph/${dmn} log reopen 2>/dev/null >/dev/null
+ done
+ endscript
+ missingok
+}
diff --git a/sys-cluster/ceph/files/ceph.target b/sys-cluster/ceph/files/ceph.target
new file mode 100644
index 000000000000..60734baff689
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph.target
@@ -0,0 +1,4 @@
+[Unit]
+Description=ceph target allowing to start/stop all ceph*@.service instances at once
+[Install]
+WantedBy=multi-user.target
diff --git a/sys-cluster/ceph/files/envd-tcmalloc b/sys-cluster/ceph/files/envd-tcmalloc
new file mode 100644
index 000000000000..bdb09670c636
--- /dev/null
+++ b/sys-cluster/ceph/files/envd-tcmalloc
@@ -0,0 +1 @@
+TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES=134217728
diff --git a/sys-cluster/ceph/files/rbdmap.initd b/sys-cluster/ceph/files/rbdmap.initd
new file mode 100644
index 000000000000..9313cf658863
--- /dev/null
+++ b/sys-cluster/ceph/files/rbdmap.initd
@@ -0,0 +1,122 @@
+#!/sbin/openrc-run
+
+DESC="RBD Mapping:"
+RBDMAPFILE="/etc/ceph/rbdmap"
+
+extra_started_commands="reload"
+
+depend() {
+ need localmount net
+ before netmount
+}
+
+start() {
+
+ if [ ! -f "${RBDMAPFILE}" ]; then
+ ewarn "$DESC : No ${RBDMAPFILE} found."
+ exit 0
+ fi
+
+ RET=0
+ # Read /etc/ceph/rbdmap to create non-existant mapping
+ while read DEV PARAMS; do
+ case "$DEV" in
+ ""|\#*)
+ continue
+ ;;
+ */*)
+ ;;
+ *)
+ DEV=rbd/$DEV
+ ;;
+ esac
+ ebegin "${DESC} '${DEV}'"
+ newrbd=""
+ MAP_RV=""
+ RET_OP=0
+ OIFS=$IFS
+ IFS=','
+ for PARAM in ${PARAMS[@]}; do
+ CMDPARAMS="${CMDPARAMS} --$(echo ${PARAM} | tr '=' ' ')"
+ done
+ IFS=$OIFS
+ if [ ! -b /dev/rbd/${DEV} ]; then
+ MAP_RV=$(rbd map ${DEV} ${CMDPARAMS} 2>&1)
+ if [ $? -eq 0 ]; then
+ newrbd="yes"
+ else
+ RET=$((${RET}+$?))
+ RET_OP=1
+ fi
+ fi
+ eend ${RET_OP} "${MAP_RV}"
+
+ if [ "$newrbd" ]; then
+ ## Mount new rbd
+ MNT_RV=""
+ mount --fake /dev/rbd/${DEV} >>/dev/null 2>&1 \
+ && MNT_RV=$(mount -vn /dev/rbd/${DEV} 2>&1)
+ [ -n "${MNT_RV}" ] && einfo "mount: ${MNT_RV}"
+
+ ## post-mapping
+ if [ -x "/etc/ceph/rbd.d/${DEV}" ]; then
+ einfo "RBD Running post-map hook '/etc/ceph/rbd.d/${DEV}'"
+ /etc/ceph/rbd.d/${DEV} map "/dev/rbd/${DEV}"
+ fi
+ fi
+ done < ${RBDMAPFILE}
+ eend ${RET}
+}
+
+stop() {
+
+ RET=0
+ ## Unmount and unmap all rbd devices
+ if ls /dev/rbd[0-9]* >/dev/null 2>&1; then
+ for DEV in /dev/rbd[0-9]*; do
+ ## pre-unmapping
+ for L in $(find /dev/rbd -type l); do
+ LL="${L##/dev/rbd/}"
+ if [ "$(readlink -f $L)" = "${DEV}" ] \
+ && [ -x "/etc/ceph/rbd.d/${LL}" ]; then
+ einfo "RBD pre-unmap: '${DEV}' hook '/etc/ceph/rbd.d/${LL}'"
+ /etc/ceph/rbd.d/${LL} unmap "$L"
+ break
+ fi
+ done
+
+ ebegin "Unmapping RBD device: '${DEV}'"
+ UMNT_RV=""
+ UMAP_RV=""
+ RET_OP=0
+ MNT=$(findmnt --mtab --source ${DEV} --noheadings | awk '{print $1'})
+ if [ -n "${MNT}" ]; then
+ einfo "un-mounting '${MNT}'"
+ UMNT_RV=$(umount "${MNT}" 2>&1)
+ fi
+ if mountpoint -q "${MNT}"; then
+ ## Un-mounting failed.
+ RET_OP=1
+ RET=$((${RET}+1))
+ else
+ ## Un-mapping.
+ UMAP_RV=$(rbd unmap $DEV 2>&1)
+ if [ $? -ne 0 ]; then
+ RET=$((${RET}+$?))
+ RET_OP=1
+ fi
+ fi
+ eend ${RET_OP} "${UMAP_RV}"
+ [ -n "${UMNT_RV}" ] && einfo "${UMNT_RV}"
+ done
+ fi
+ eend ${RET}
+}
+
+reload() {
+ start
+}
+
+status() {
+ rbd showmapped
+}
diff --git a/sys-cluster/ceph/files/sysctld b/sys-cluster/ceph/files/sysctld
new file mode 100644
index 000000000000..4d133264f554
--- /dev/null
+++ b/sys-cluster/ceph/files/sysctld
@@ -0,0 +1,2 @@
+# up the global pid max for ceph
+kernel.pid_max = 257256