ceph: initial update to 18.2.0

The ability to detected our python is fixed, but we are now
failing in the compilation phase on some of the applications.

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Bruce Ashfield 2023-11-09 05:11:44 +00:00
parent 628d9430a8
commit 3e1ee1fda7
16 changed files with 156 additions and 1035 deletions

View File

@ -1,30 +0,0 @@
From 85bde55627cfbb35d8b4735dec32bf33fa30079f Mon Sep 17 00:00:00 2001
From: Saul Wold <saul.wold@windriver.com>
Date: Fri, 28 May 2021 10:16:07 -0700
Subject: [PATCH] SnappyCompressor.h: fix snappy compiler error
snappy quietly changed public type
Known issue in ceph: https://tracker.ceph.com/issues/50934
Upstream-Status: Pending
Signed-off-by: Saul Wold <saul.wold@windriver.com>
---
src/compressor/snappy/SnappyCompressor.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compressor/snappy/SnappyCompressor.h b/src/compressor/snappy/SnappyCompressor.h
index 0cfb819c..2fbe35b7 100644
--- a/src/compressor/snappy/SnappyCompressor.h
+++ b/src/compressor/snappy/SnappyCompressor.h
@@ -96,7 +96,7 @@ class SnappyCompressor : public Compressor {
if (qat_enabled)
return qat_accel.decompress(p, compressed_len, dst);
#endif
- snappy::uint32 res_len = 0;
+ uint32_t res_len = 0;
BufferlistSource source_1(p, compressed_len);
if (!snappy::GetUncompressedLength(&source_1, &res_len)) {
return -1;

View File

@ -1,30 +0,0 @@
From 496465d9238109a93612e28682273e5bf576823b Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Sun, 22 May 2022 19:40:59 -0700
Subject: [PATCH 1/2] buffer.h: add missing header file due to gcc upgrade
The header file <memory> have been changed to be no longer included by other
heades, thus requiring explicit include. See https://gcc.gnu.org/gcc-12/porting_to.html
Upstream-Status: Pending
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
src/include/buffer.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/include/buffer.h b/src/include/buffer.h
index 5c8b427d..88845ee6 100644
--- a/src/include/buffer.h
+++ b/src/include/buffer.h
@@ -43,6 +43,7 @@
#include <list>
#include <vector>
#include <string>
+#include <memory>
#if __cplusplus >= 201703L
#include <string_view>
#endif // __cplusplus >= 201703L
--
2.36.0

View File

@ -24,11 +24,11 @@ Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com>
src/pybind/rgw/setup.py | 8 --------
7 files changed, 8 insertions(+), 55 deletions(-)
diff --git a/cmake/modules/Distutils.cmake b/cmake/modules/Distutils.cmake
index 5fe929499d..802eb37e32 100644
--- a/cmake/modules/Distutils.cmake
+++ b/cmake/modules/Distutils.cmake
@@ -18,17 +18,8 @@ function(distutils_install_module name)
Index: ceph-18.2.0/cmake/modules/Distutils.cmake
===================================================================
--- ceph-18.2.0.orig/cmake/modules/Distutils.cmake
+++ ceph-18.2.0/cmake/modules/Distutils.cmake
@@ -29,17 +29,10 @@
cmake_parse_arguments(DU "" "INSTALL_SCRIPT" "" ${ARGN})
install(CODE "
set(options --prefix=${CMAKE_INSTALL_PREFIX})
@ -39,25 +39,25 @@ index 5fe929499d..802eb37e32 100644
- list(APPEND options
- --root=\$ENV{DESTDIR}
- --single-version-externally-managed)
- if(NOT \"${DU_INSTALL_SCRIPT}\" STREQUAL \"\")
- list(APPEND options --install-script=${DU_INSTALL_SCRIPT})
- endif()
- endif()
if(NOT \"${DU_INSTALL_SCRIPT}\" STREQUAL \"\")
list(APPEND options --install-script=${DU_INSTALL_SCRIPT})
- endif()
+ list(APPEND options --root=${CMAKE_DESTDIR})
+ list(APPEND options --install-lib=${PYTHON_SITEPACKAGES_DIR})
execute_process(
COMMAND ${Python3_EXECUTABLE}
setup.py install \${options}
@@ -50,7 +41,7 @@ function(distutils_add_cython_module target name src)
# Note: no quotes, otherwise distutils will execute "/usr/bin/ccache gcc"
# CMake's implicit conversion between strings and lists is wonderful, isn't it?
string(REPLACE " " ";" cflags ${CMAKE_C_FLAGS})
- list(APPEND cflags -iquote${CMAKE_SOURCE_DIR}/src/include -w)
+ list(APPEND cflags -iquote${CMAKE_SOURCE_DIR}/src/include -w --sysroot=${CMAKE_SYSROOT})
@@ -65,7 +58,7 @@
if(DU_DISABLE_VTA AND HAS_VTA)
list(APPEND PY_CFLAGS -fno-var-tracking-assignments)
endif()
- list(APPEND PY_CPPFLAGS -iquote${CMAKE_SOURCE_DIR}/src/include -w)
+ list(APPEND PY_CPPFLAGS -iquote${CMAKE_SOURCE_DIR}/src/include -w --sysroot=${CMAKE_SYSROOT})
# This little bit of magic wipes out __Pyx_check_single_interpreter()
# Note: this is reproduced in distutils_install_cython_module
list(APPEND cflags -D'void0=dead_function\(void\)')
@@ -108,14 +99,8 @@ function(distutils_install_cython_module name)
list(APPEND PY_CPPFLAGS -D'void0=dead_function\(void\)')
@@ -135,14 +128,8 @@
set(ENV{CEPH_LIBDIR} \"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}\")
set(options --prefix=${CMAKE_INSTALL_PREFIX})
@ -74,10 +74,10 @@ index 5fe929499d..802eb37e32 100644
execute_process(
COMMAND
${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py
diff --git a/cmake/modules/FindRocksDB.cmake b/cmake/modules/FindRocksDB.cmake
index c5dd3dfaf6..be38597af2 100644
--- a/cmake/modules/FindRocksDB.cmake
+++ b/cmake/modules/FindRocksDB.cmake
Index: ceph-18.2.0/cmake/modules/FindRocksDB.cmake
===================================================================
--- ceph-18.2.0.orig/cmake/modules/FindRocksDB.cmake
+++ ceph-18.2.0/cmake/modules/FindRocksDB.cmake
@@ -9,9 +9,9 @@
# ROCKSDB_VERSION_MINOR
# ROCKSDB_VERSION_PATCH
@ -90,95 +90,100 @@ index c5dd3dfaf6..be38597af2 100644
if(ROCKSDB_INCLUDE_DIR AND EXISTS "${ROCKSDB_INCLUDE_DIR}/rocksdb/version.h")
foreach(ver "MAJOR" "MINOR" "PATCH")
diff --git a/src/compressor/zstd/CMakeLists.txt b/src/compressor/zstd/CMakeLists.txt
index a5ebdaf538..a234068150 100644
--- a/src/compressor/zstd/CMakeLists.txt
+++ b/src/compressor/zstd/CMakeLists.txt
@@ -9,7 +9,7 @@ ExternalProject_Add(zstd_ext
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${ZSTD_C_FLAGS}
- -DCMAKE_AR=${CMAKE_AR}
+ -DCMAKE_SYSROOT=${CMAKE_SYSROOT}
-DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_SHARED}
-G${CMAKE_GENERATOR}
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/libzstd
diff --git a/src/pybind/cephfs/setup.py b/src/pybind/cephfs/setup.py
index 19ae6c329a..c9a25ccfff 100755
--- a/src/pybind/cephfs/setup.py
+++ b/src/pybind/cephfs/setup.py
@@ -135,14 +135,6 @@ def check_sanity():
Index: ceph-18.2.0/src/pybind/cephfs/setup.py
===================================================================
--- ceph-18.2.0.orig/src/pybind/cephfs/setup.py
+++ ceph-18.2.0/src/pybind/cephfs/setup.py
@@ -135,20 +135,6 @@
finally:
shutil.rmtree(tmp_dir)
-
-if 'BUILD_DOC' in os.environ.keys():
- pass
-if 'BUILD_DOC' in os.environ or 'READTHEDOCS' in os.environ:
- ext_args = {}
- cython_constants = dict(BUILD_DOC=True)
- cythonize_args = dict(compile_time_env=cython_constants)
-elif check_sanity():
- pass
- ext_args = get_python_flags(['cephfs'])
- cython_constants = dict(BUILD_DOC=False)
- include_path = [os.path.join(os.path.dirname(__file__), "..", "rados")]
- cythonize_args = dict(compile_time_env=cython_constants,
- include_path=include_path)
-else:
- sys.exit(1)
-
cmdclass = {}
try:
from Cython.Build import cythonize
diff --git a/src/pybind/rados/setup.py b/src/pybind/rados/setup.py
index e2c5696404..4e99d26721 100755
--- a/src/pybind/rados/setup.py
+++ b/src/pybind/rados/setup.py
@@ -134,14 +134,6 @@ def check_sanity():
Index: ceph-18.2.0/src/pybind/rados/setup.py
===================================================================
--- ceph-18.2.0.orig/src/pybind/rados/setup.py
+++ ceph-18.2.0/src/pybind/rados/setup.py
@@ -130,17 +130,6 @@
finally:
shutil.rmtree(tmp_dir)
-
-if 'BUILD_DOC' in os.environ.keys():
- pass
-if 'BUILD_DOC' in os.environ or 'READTHEDOCS' in os.environ:
- ext_args = {}
- cython_constants = dict(BUILD_DOC=True)
-elif check_sanity():
- pass
- ext_args = get_python_flags(['rados'])
- cython_constants = dict(BUILD_DOC=False)
-else:
- sys.exit(1)
-
-cmdclass = {}
try:
from Cython.Build import cythonize
from Cython.Distutils import build_ext
Index: ceph-18.2.0/src/pybind/rbd/setup.py
===================================================================
--- ceph-18.2.0.orig/src/pybind/rbd/setup.py
+++ ceph-18.2.0/src/pybind/rbd/setup.py
@@ -133,20 +133,6 @@
finally:
shutil.rmtree(tmp_dir)
-
-if 'BUILD_DOC' in os.environ or 'READTHEDOCS' in os.environ:
- ext_args = {}
- cython_constants = dict(BUILD_DOC=True)
- cythonize_args = dict(compile_time_env=cython_constants)
-elif check_sanity():
- ext_args = get_python_flags(['rados', 'rbd'])
- cython_constants = dict(BUILD_DOC=False)
- include_path = [os.path.join(os.path.dirname(__file__), "..", "rados")]
- cythonize_args = dict(compile_time_env=cython_constants,
- include_path=include_path)
-else:
- sys.exit(1)
-
cmdclass = {}
try:
from Cython.Build import cythonize
diff --git a/src/pybind/rbd/setup.py b/src/pybind/rbd/setup.py
index 634484f140..f5bbbdab4f 100755
--- a/src/pybind/rbd/setup.py
+++ b/src/pybind/rbd/setup.py
@@ -133,14 +133,6 @@ def check_sanity():
Index: ceph-18.2.0/src/pybind/rgw/setup.py
===================================================================
--- ceph-18.2.0.orig/src/pybind/rgw/setup.py
+++ ceph-18.2.0/src/pybind/rgw/setup.py
@@ -134,20 +134,6 @@
finally:
shutil.rmtree(tmp_dir)
-
-if 'BUILD_DOC' in os.environ.keys():
- pass
-if 'BUILD_DOC' in os.environ or 'READTHEDOCS' in os.environ:
- ext_args = {}
- cython_constants = dict(BUILD_DOC=True)
- cythonize_args = dict(compile_time_env=cython_constants)
-elif check_sanity():
- pass
- ext_args = get_python_flags(['rados', 'rgw'])
- cython_constants = dict(BUILD_DOC=False)
- include_path = [os.path.join(os.path.dirname(__file__), "..", "rados")]
- cythonize_args = dict(compile_time_env=cython_constants,
- include_path=include_path)
-else:
- sys.exit(1)
-
cmdclass = {}
try:
from Cython.Build import cythonize
diff --git a/src/pybind/rgw/setup.py b/src/pybind/rgw/setup.py
index eb1591a460..b9f2428cf9 100755
--- a/src/pybind/rgw/setup.py
+++ b/src/pybind/rgw/setup.py
@@ -134,14 +134,6 @@ def check_sanity():
finally:
shutil.rmtree(tmp_dir)
-
-if 'BUILD_DOC' in os.environ.keys():
- pass
-elif check_sanity():
- pass
-else:
- sys.exit(1)
-
cmdclass = {}
try:
from Cython.Build import cythonize
--
2.20.1

View File

@ -16,19 +16,16 @@ Signed-off-by: Kai Kang <kai.kang@windriver.com>
cmake/modules/FindPython/Support.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/modules/FindPython/Support.cmake b/cmake/modules/FindPython/Support.cmake
index 6584699b79..c05bbe3306 100644
--- a/cmake/modules/FindPython/Support.cmake
+++ b/cmake/modules/FindPython/Support.cmake
@@ -17,7 +17,7 @@ if (NOT DEFINED _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
Index: ceph-18.2.0/cmake/modules/FindPython/Support.cmake
===================================================================
--- ceph-18.2.0.orig/cmake/modules/FindPython/Support.cmake
+++ ceph-18.2.0/cmake/modules/FindPython/Support.cmake
@@ -17,7 +17,7 @@
message (FATAL_ERROR "FindPython: INTERNAL ERROR")
endif()
if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL 3)
- set(_${_PYTHON_PREFIX}_VERSIONS 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
- set(_${_PYTHON_PREFIX}_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+ set(_${_PYTHON_PREFIX}_VERSIONS 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
elseif (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL 2)
set(_${_PYTHON_PREFIX}_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
else()
--
2.18.2

View File

@ -1,41 +0,0 @@
From 59e6b44f7ed4020a860e347322acfdacc6e4560b Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Fri, 28 Oct 2022 16:47:38 +0100
Subject: [PATCH] common: fix build with GCC 13 (missing <cstdint> include)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Needed for uint8_t. Only worked by chance before (see
https://www.gnu.org/software/gcc/gcc-13/porting_to.html).
```
FAILED: src/CMakeFiles/common-objs.dir/mds/FSMapUser.cc.o
/usr/bin/x86_64-pc-linux-gnu-g++ -DBOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION -DHAVE_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -D__CEPH__ -D__STDC_FORMAT_MACROS -D__linux__ -I/var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5_build/src/include -I/var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src -isystem /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5_build/include -isystem /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/xxHash -isystem /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/rapidjson/include -O2 -march=native -pipe -fPIC -U_FORTIFY_SOURCE -Wall -fno-strict-aliasing -fsigned-char -Wtype-limits -Wignored-qualifiers -Wpointer-arith -Werror=format-security -Winit-self -Wno-unknown-pragmas -Wnon-virtual-dtor -Wno-ignored-qualifiers -ftemplate-depth-1024 -Wpessimizing-move -Wredundant-move -Wstrict-null-sentinel -Woverloaded-virtual -fno-new-ttp-matching -fstack-protector-strong -fdiagnostics-color=auto -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -std=c++17 -MD -MT src/CMakeFiles/common-objs.dir/mds/FSMapUser.cc.o -MF src/CMakeFiles/common-objs.dir/mds/FSMapUser.cc.o.d -o src/CMakeFiles/common-objs.dir/mds/FSMapUser.cc.o -c /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/mds/FSMapUser.cc
In file included from /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/log/SubsystemMap.h:12,
from /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/common/config.h:23,
from /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/mds/mdstypes.h:13,
from /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/mds/FSMapUser.h:21,
from /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/mds/FSMapUser.cc:1:
/var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/common/subsys_types.h:56:23: error: uint8_t in namespace std does not name a type; did you mean wint_t?
```
Bug: https://bugs.gentoo.org/878531
Signed-off-by: Sam James <sam@gentoo.org>
Upstream-Status: Backport [https://github.com/ceph/ceph/commit/74794f9d6f5c6671438085bdba730b504901a7c0]
---
src/common/subsys_types.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/common/subsys_types.h b/src/common/subsys_types.h
index 52171809..bd7cc439 100644
--- a/src/common/subsys_types.h
+++ b/src/common/subsys_types.h
@@ -17,6 +17,7 @@
#include <algorithm>
#include <array>
+#include <cstdint>
enum ceph_subsys_id_t {
ceph_subsys_, // default

View File

@ -15,12 +15,12 @@ Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
src/pybind/rgw/setup.py | 6 +++++-
4 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/pybind/cephfs/setup.py b/src/pybind/cephfs/setup.py
index c9a25ccf..972f936c 100755
--- a/src/pybind/cephfs/setup.py
+++ b/src/pybind/cephfs/setup.py
@@ -63,9 +63,13 @@ def get_python_flags(libs):
distutils.sysconfig.get_config_vars('LIBS', 'SYSLIBS')), [])
Index: ceph-18.2.0/src/pybind/cephfs/setup.py
===================================================================
--- ceph-18.2.0.orig/src/pybind/cephfs/setup.py
+++ ceph-18.2.0/src/pybind/cephfs/setup.py
@@ -63,9 +63,13 @@
filter(lambda lib: lib.startswith('-l'), py_libs)]
compiler = new_compiler()
distutils.sysconfig.customize_compiler(compiler)
+ libpl = distutils.sysconfig.get_config_var('LIBPL')
@ -31,15 +31,15 @@ index c9a25ccf..972f936c 100755
include_dirs=[distutils.sysconfig.get_python_inc()],
- library_dirs=distutils.sysconfig.get_config_vars('LIBDIR', 'LIBPL'),
+ library_dirs=[distutils.sysconfig.get_config_var('LIBDIR'), libpl],
libraries=libs + [lib.replace('-l', '') for lib in py_libs],
libraries=libs + py_libs,
extra_compile_args=filter_unsupported_flags(
compiler.compiler[0],
diff --git a/src/pybind/rados/setup.py b/src/pybind/rados/setup.py
index 4e99d267..de24f766 100755
--- a/src/pybind/rados/setup.py
+++ b/src/pybind/rados/setup.py
@@ -66,9 +66,13 @@ def get_python_flags(libs):
distutils.sysconfig.get_config_vars('LIBS', 'SYSLIBS')), [])
Index: ceph-18.2.0/src/pybind/rados/setup.py
===================================================================
--- ceph-18.2.0.orig/src/pybind/rados/setup.py
+++ ceph-18.2.0/src/pybind/rados/setup.py
@@ -62,9 +62,13 @@
filter(lambda lib: lib.startswith('-l'), py_libs)]
compiler = new_compiler()
distutils.sysconfig.customize_compiler(compiler)
+ libpl = distutils.sysconfig.get_config_var('LIBPL')
@ -50,15 +50,15 @@ index 4e99d267..de24f766 100755
include_dirs=[distutils.sysconfig.get_python_inc()],
- library_dirs=distutils.sysconfig.get_config_vars('LIBDIR', 'LIBPL'),
+ library_dirs=[distutils.sysconfig.get_config_var('LIBDIR'), libpl],
libraries=libs + [lib.replace('-l', '') for lib in py_libs],
libraries=libs + py_libs,
extra_compile_args=filter_unsupported_flags(
compiler.compiler[0],
diff --git a/src/pybind/rbd/setup.py b/src/pybind/rbd/setup.py
index f5bbbdab..a1f70e1d 100755
--- a/src/pybind/rbd/setup.py
+++ b/src/pybind/rbd/setup.py
@@ -63,9 +63,13 @@ def get_python_flags(libs):
distutils.sysconfig.get_config_vars('LIBS', 'SYSLIBS')), [])
Index: ceph-18.2.0/src/pybind/rbd/setup.py
===================================================================
--- ceph-18.2.0.orig/src/pybind/rbd/setup.py
+++ ceph-18.2.0/src/pybind/rbd/setup.py
@@ -63,9 +63,13 @@
filter(lambda lib: lib.startswith('-l'), py_libs)]
compiler = new_compiler()
distutils.sysconfig.customize_compiler(compiler)
+ libpl = distutils.sysconfig.get_config_var('LIBPL')
@ -69,15 +69,15 @@ index f5bbbdab..a1f70e1d 100755
include_dirs=[distutils.sysconfig.get_python_inc()],
- library_dirs=distutils.sysconfig.get_config_vars('LIBDIR', 'LIBPL'),
+ library_dirs=[distutils.sysconfig.get_config_var('LIBDIR'), libpl],
libraries=libs + [lib.replace('-l', '') for lib in py_libs],
libraries=libs + py_libs,
extra_compile_args=filter_unsupported_flags(
compiler.compiler[0],
diff --git a/src/pybind/rgw/setup.py b/src/pybind/rgw/setup.py
index b9f2428c..f5119f73 100755
--- a/src/pybind/rgw/setup.py
+++ b/src/pybind/rgw/setup.py
@@ -64,9 +64,13 @@ def get_python_flags(libs):
distutils.sysconfig.get_config_vars('LIBS', 'SYSLIBS')), [])
Index: ceph-18.2.0/src/pybind/rgw/setup.py
===================================================================
--- ceph-18.2.0.orig/src/pybind/rgw/setup.py
+++ ceph-18.2.0/src/pybind/rgw/setup.py
@@ -64,9 +64,13 @@
filter(lambda lib: lib.startswith('-l'), py_libs)]
compiler = new_compiler()
distutils.sysconfig.customize_compiler(compiler)
+ libpl = distutils.sysconfig.get_config_var('LIBPL')
@ -88,9 +88,6 @@ index b9f2428c..f5119f73 100755
include_dirs=[distutils.sysconfig.get_python_inc()],
- library_dirs=distutils.sysconfig.get_config_vars('LIBDIR', 'LIBPL'),
+ library_dirs=[distutils.sysconfig.get_config_var('LIBDIR'), libpl],
libraries=libs + [lib.replace('-l', '') for lib in py_libs],
libraries=libs + py_libs,
extra_compile_args=filter_unsupported_flags(
compiler.compiler[0],
--
2.21.0

View File

@ -1,51 +0,0 @@
From b7b58010fd10b95c681df78cc4322e6586a39099 Mon Sep 17 00:00:00 2001
From: Kefu Chai <kchai@redhat.com>
Date: Tue, 17 Aug 2021 15:20:24 +0800
Subject: [PATCH 1/6] kv/rocksdb_cache: drop ROCKSDB_PRIszt
ROCKSDB_PRIszt is a macro for "zu", which is in turn use for printing an
(unsigned) size_t variable.
there is no point having it in the header file or define a macro for it,
as %zu is standard compliant, and we don't get any advantage by using a
macro for it.
Signed-off-by: Kefu Chai <kchai@redhat.com>
Upstream-Status: Backport [44f5b827eb3c65665373a86908bf5d47e7d02687]
Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com>
---
src/kv/rocksdb_cache/ShardedCache.cc | 2 +-
src/kv/rocksdb_cache/ShardedCache.h | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/kv/rocksdb_cache/ShardedCache.cc b/src/kv/rocksdb_cache/ShardedCache.cc
index 367140a9..8e08deb8 100644
--- a/src/kv/rocksdb_cache/ShardedCache.cc
+++ b/src/kv/rocksdb_cache/ShardedCache.cc
@@ -131,7 +131,7 @@ std::string ShardedCache::GetPrintableOptions() const {
char buffer[kBufferSize];
{
std::lock_guard<std::mutex> l(capacity_mutex_);
- snprintf(buffer, kBufferSize, " capacity : %" ROCKSDB_PRIszt "\n",
+ snprintf(buffer, kBufferSize, " capacity : %zu\n",
capacity_);
ret.append(buffer);
snprintf(buffer, kBufferSize, " num_shard_bits : %d\n", num_shard_bits_);
diff --git a/src/kv/rocksdb_cache/ShardedCache.h b/src/kv/rocksdb_cache/ShardedCache.h
index 4d64893a..8ab2587b 100644
--- a/src/kv/rocksdb_cache/ShardedCache.h
+++ b/src/kv/rocksdb_cache/ShardedCache.h
@@ -22,7 +22,6 @@
#ifndef CACHE_LINE_SIZE
#define CACHE_LINE_SIZE 64 // XXX arch-specific define
#endif
-#define ROCKSDB_PRIszt "zu"
namespace rocksdb_cache {
--
2.33.0

View File

@ -1,42 +0,0 @@
From 841806de212226921eeaeb3eea054bda8ccce616 Mon Sep 17 00:00:00 2001
From: Radoslaw Zarzynski <rzarzyns@redhat.com>
Date: Wed, 19 Jan 2022 15:24:11 +0000
Subject: [PATCH 2/2] common: fix FTBFS due to dout & need_dynamic on GCC-12
For details see:
https://gist.github.com/rzarzynski/d6d2df6888923bef6a3e764f4856853f.
Special thanks to Kaleb Keithley who reported the issue
and tested the fix!
Fixes: https://tracker.ceph.com/issues/53896
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
Upstream-Status: Backport [963d756ded40f5adf2efef53893c917bec1845c1]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
src/common/dout.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/common/dout.h b/src/common/dout.h
index c7c08182..42f49915 100644
--- a/src/common/dout.h
+++ b/src/common/dout.h
@@ -99,11 +99,12 @@ namespace ceph::dout {
template<typename T>
struct dynamic_marker_t {
T value;
- operator T() const { return value; }
+ // constexpr ctor isn't needed as it's an aggregate type
+ constexpr operator T() const { return value; }
};
template<typename T>
-dynamic_marker_t<T> need_dynamic(T&& t) {
+constexpr dynamic_marker_t<T> need_dynamic(T&& t) {
return dynamic_marker_t<T>{ std::forward<T>(t) };
}
--
2.36.0

View File

@ -1,101 +0,0 @@
From cca3144aca7f7c19772065421f9b02205a84e0b8 Mon Sep 17 00:00:00 2001
From: Casey Bodley <cbodley@redhat.com>
Date: Tue, 15 Feb 2022 18:27:10 -0500
Subject: [PATCH] common: replace BitVector::NoInitAllocator with wrapper
struct
in c++20, the deprecated `struct std::allocator<T>::rebind` template was
removed, so `BitVector` no longer compiles. without a `rebind` to
inherit, `std::allocator_traits<NoInitAllocator>::rebind_alloc<U>` was
looking for `NoInitAllocator<U>`, but it isn't a template class
further investigation found that in c++17, `vector<__u32, NoInitAllocator>`
was rebinding this `NoInitAllocator` to `std::allocator<__u32>` and
preventing the no-init optimization from taking effect
instead of messing with the allocator to avoid zero-initialization, wrap
each __u32 in a struct whose constructor does not initialize the value
Fixes: https://tracker.ceph.com/issues/54279
Signed-off-by: Casey Bodley <cbodley@redhat.com>
---
Fixes:
http://errors.yoctoproject.org/Errors/Details/701862/
Upstream-Status: Backport [https://github.com/ceph/ceph/commit/4f0ad8aab6b21a1fd57a7c1630d298e31b5d9bb6]
src/common/bit_vector.hpp | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/src/common/bit_vector.hpp b/src/common/bit_vector.hpp
index 10ee6c3e..9ce3e8b1 100644
--- a/src/common/bit_vector.hpp
+++ b/src/common/bit_vector.hpp
@@ -223,23 +223,18 @@ public:
static void generate_test_instances(std::list<BitVector *> &o);
private:
- struct NoInitAllocator : public std::allocator<__u32> {
- NoInitAllocator() {}
- NoInitAllocator(const std::allocator<__u32>& alloc)
- : std::allocator<__u32>(alloc) {
- }
-
- template <class U, class... Args>
- void construct(U* p, Args&&... args) const {
- }
- };
-
bufferlist m_data;
uint64_t m_size;
bool m_crc_enabled;
mutable __u32 m_header_crc;
- mutable std::vector<__u32, NoInitAllocator> m_data_crcs;
+
+ // inhibit value-initialization when used in std::vector
+ struct u32_struct {
+ u32_struct() {}
+ __u32 val;
+ };
+ mutable std::vector<u32_struct> m_data_crcs;
void resize(uint64_t elements, bool zero);
@@ -351,7 +346,7 @@ void BitVector<_b>::encode_data(bufferlist& bl, uint64_t data_byte_offset,
bufferlist bit;
bit.substr_of(m_data, data_byte_offset, len);
- m_data_crcs[data_byte_offset / BLOCK_SIZE] = bit.crc32c(0);
+ m_data_crcs[data_byte_offset / BLOCK_SIZE].val = bit.crc32c(0);
bl.claim_append(bit);
data_byte_offset += BLOCK_SIZE;
@@ -385,7 +380,7 @@ void BitVector<_b>::decode_data(bufferlist::const_iterator& it,
bufferlist bit;
bit.append(ptr);
if (m_crc_enabled &&
- m_data_crcs[data_byte_offset / BLOCK_SIZE] != bit.crc32c(0)) {
+ m_data_crcs[data_byte_offset / BLOCK_SIZE].val != bit.crc32c(0)) {
throw buffer::malformed_input("invalid data block CRC");
}
data.append(bit);
@@ -499,7 +494,7 @@ void BitVector<_b>::encode_data_crcs(bufferlist& bl, uint64_t offset,
compute_index(offset + length - 1, &index, &shift);
uint64_t end_crc_index = index / BLOCK_SIZE;
while (crc_index <= end_crc_index) {
- __u32 crc = m_data_crcs[crc_index++];
+ __u32 crc = m_data_crcs[crc_index++].val;
ceph::encode(crc, bl);
}
}
@@ -520,7 +515,7 @@ void BitVector<_b>::decode_data_crcs(bufferlist::const_iterator& it,
while (remaining > 0) {
__u32 crc;
ceph::decode(crc, it);
- m_data_crcs[crc_index++] = crc;
+ m_data_crcs[crc_index++].val = crc;
--remaining;
}
}

View File

@ -1,70 +0,0 @@
From 6cdb1387a713fad765b5193d5acf4504f206a66f Mon Sep 17 00:00:00 2001
From: Kefu Chai <kchai@redhat.com>
Date: Tue, 17 Aug 2021 15:39:00 +0800
Subject: [PATCH 2/6] kv/rocksdb_cache: reorder ShardedCache methods
declarations
in the exact order in which rocksdb::Cache declare its public virtual
methods.
Signed-off-by: Kefu Chai <kchai@redhat.com>
Upstream-Status: Backport [633656f8ade2c1d67a66f8b7ca3aa0a2ae82e6b1]
Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com>
---
src/kv/rocksdb_cache/ShardedCache.h | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/kv/rocksdb_cache/ShardedCache.h b/src/kv/rocksdb_cache/ShardedCache.h
index 8ab2587b..a16cf561 100644
--- a/src/kv/rocksdb_cache/ShardedCache.h
+++ b/src/kv/rocksdb_cache/ShardedCache.h
@@ -56,34 +56,33 @@ class ShardedCache : public rocksdb::Cache, public PriorityCache::PriCache {
public:
ShardedCache(size_t capacity, int num_shard_bits, bool strict_capacity_limit);
virtual ~ShardedCache() = default;
+ // rocksdb::Cache
virtual const char* Name() const override = 0;
- virtual CacheShard* GetShard(int shard) = 0;
- virtual const CacheShard* GetShard(int shard) const = 0;
- virtual void* Value(Handle* handle) override = 0;
- virtual size_t GetCharge(Handle* handle) const = 0;
- virtual uint32_t GetHash(Handle* handle) const = 0;
- virtual void DisownData() override = 0;
-
- virtual void SetCapacity(size_t capacity) override;
- virtual void SetStrictCapacityLimit(bool strict_capacity_limit) override;
-
virtual rocksdb::Status Insert(const rocksdb::Slice& key, void* value, size_t charge,
void (*deleter)(const rocksdb::Slice& key, void* value),
rocksdb::Cache::Handle** handle, Priority priority) override;
virtual rocksdb::Cache::Handle* Lookup(const rocksdb::Slice& key, rocksdb::Statistics* stats) override;
virtual bool Ref(rocksdb::Cache::Handle* handle) override;
virtual bool Release(rocksdb::Cache::Handle* handle, bool force_erase = false) override;
+ virtual void* Value(Handle* handle) override = 0;
virtual void Erase(const rocksdb::Slice& key) override;
virtual uint64_t NewId() override;
- virtual size_t GetCapacity() const override;
+ virtual void SetCapacity(size_t capacity) override;
+ virtual void SetStrictCapacityLimit(bool strict_capacity_limit) override;
virtual bool HasStrictCapacityLimit() const override;
+ virtual size_t GetCapacity() const override;
virtual size_t GetUsage() const override;
virtual size_t GetUsage(rocksdb::Cache::Handle* handle) const override;
virtual size_t GetPinnedUsage() const override;
+ virtual size_t GetCharge(Handle* handle) const = 0;
+ virtual void DisownData() override = 0;
virtual void ApplyToAllCacheEntries(void (*callback)(void*, size_t),
bool thread_safe) override;
virtual void EraseUnRefEntries() override;
virtual std::string GetPrintableOptions() const override;
+ virtual CacheShard* GetShard(int shard) = 0;
+ virtual const CacheShard* GetShard(int shard) const = 0;
+ virtual uint32_t GetHash(Handle* handle) const = 0;
int GetNumShardBits() const { return num_shard_bits_; }
--
2.33.0

View File

@ -1,101 +0,0 @@
From 29f1e556c1e7c5ab195983552387e1410e0b5b6c Mon Sep 17 00:00:00 2001
From: Kefu Chai <kchai@redhat.com>
Date: Tue, 17 Aug 2021 16:25:32 +0800
Subject: [PATCH 3/6] kv/rocksdb_cache: define DeleterFn function pointer type
this paves the road to rocksdb v6.22.1 compatible implementation
Signed-off-by: Kefu Chai <kchai@redhat.com>
Upstream-Status: Backport [c7a6c74b62dfcc96f676eb6d8844852c4705b66f]
Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com>
---
src/kv/rocksdb_cache/BinnedLRUCache.cc | 2 +-
src/kv/rocksdb_cache/BinnedLRUCache.h | 4 ++--
src/kv/rocksdb_cache/ShardedCache.cc | 2 +-
src/kv/rocksdb_cache/ShardedCache.h | 6 ++++--
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/kv/rocksdb_cache/BinnedLRUCache.cc b/src/kv/rocksdb_cache/BinnedLRUCache.cc
index 2391a7f6..4e5f4dd4 100644
--- a/src/kv/rocksdb_cache/BinnedLRUCache.cc
+++ b/src/kv/rocksdb_cache/BinnedLRUCache.cc
@@ -344,7 +344,7 @@ bool BinnedLRUCacheShard::Release(rocksdb::Cache::Handle* handle, bool force_era
rocksdb::Status BinnedLRUCacheShard::Insert(const rocksdb::Slice& key, uint32_t hash, void* value,
size_t charge,
- void (*deleter)(const rocksdb::Slice& key, void* value),
+ DeleterFn deleter,
rocksdb::Cache::Handle** handle, rocksdb::Cache::Priority priority) {
auto e = new BinnedLRUHandle();
rocksdb::Status s;
diff --git a/src/kv/rocksdb_cache/BinnedLRUCache.h b/src/kv/rocksdb_cache/BinnedLRUCache.h
index 96023ce2..b0fb7148 100644
--- a/src/kv/rocksdb_cache/BinnedLRUCache.h
+++ b/src/kv/rocksdb_cache/BinnedLRUCache.h
@@ -56,7 +56,7 @@ std::shared_ptr<rocksdb::Cache> NewBinnedLRUCache(
struct BinnedLRUHandle {
void* value;
- void (*deleter)(const rocksdb::Slice&, void* value);
+ DeleterFn deleter;
BinnedLRUHandle* next_hash;
BinnedLRUHandle* next;
BinnedLRUHandle* prev;
@@ -189,7 +189,7 @@ class alignas(CACHE_LINE_SIZE) BinnedLRUCacheShard : public CacheShard {
// Like Cache methods, but with an extra "hash" parameter.
virtual rocksdb::Status Insert(const rocksdb::Slice& key, uint32_t hash, void* value,
size_t charge,
- void (*deleter)(const rocksdb::Slice& key, void* value),
+ DeleterFn deleter,
rocksdb::Cache::Handle** handle,
rocksdb::Cache::Priority priority) override;
virtual rocksdb::Cache::Handle* Lookup(const rocksdb::Slice& key, uint32_t hash) override;
diff --git a/src/kv/rocksdb_cache/ShardedCache.cc b/src/kv/rocksdb_cache/ShardedCache.cc
index 8e08deb8..ef3b3b98 100644
--- a/src/kv/rocksdb_cache/ShardedCache.cc
+++ b/src/kv/rocksdb_cache/ShardedCache.cc
@@ -44,7 +44,7 @@ void ShardedCache::SetStrictCapacityLimit(bool strict_capacity_limit) {
}
rocksdb::Status ShardedCache::Insert(const rocksdb::Slice& key, void* value, size_t charge,
- void (*deleter)(const rocksdb::Slice& key, void* value),
+ DeleterFn deleter,
rocksdb::Cache::Handle** handle, Priority priority) {
uint32_t hash = HashSlice(key);
return GetShard(Shard(hash))
diff --git a/src/kv/rocksdb_cache/ShardedCache.h b/src/kv/rocksdb_cache/ShardedCache.h
index a16cf561..674e5322 100644
--- a/src/kv/rocksdb_cache/ShardedCache.h
+++ b/src/kv/rocksdb_cache/ShardedCache.h
@@ -25,6 +25,8 @@
namespace rocksdb_cache {
+using DeleterFn = void (*)(const rocksdb::Slice& key, void* value);
+
// Single cache shard interface.
class CacheShard {
public:
@@ -33,7 +35,7 @@ class CacheShard {
virtual rocksdb::Status Insert(const rocksdb::Slice& key, uint32_t hash, void* value,
size_t charge,
- void (*deleter)(const rocksdb::Slice& key, void* value),
+ DeleterFn deleter,
rocksdb::Cache::Handle** handle, rocksdb::Cache::Priority priority) = 0;
virtual rocksdb::Cache::Handle* Lookup(const rocksdb::Slice& key, uint32_t hash) = 0;
virtual bool Ref(rocksdb::Cache::Handle* handle) = 0;
@@ -59,7 +61,7 @@ class ShardedCache : public rocksdb::Cache, public PriorityCache::PriCache {
// rocksdb::Cache
virtual const char* Name() const override = 0;
virtual rocksdb::Status Insert(const rocksdb::Slice& key, void* value, size_t charge,
- void (*deleter)(const rocksdb::Slice& key, void* value),
+ DeleterFn,
rocksdb::Cache::Handle** handle, Priority priority) override;
virtual rocksdb::Cache::Handle* Lookup(const rocksdb::Slice& key, rocksdb::Statistics* stats) override;
virtual bool Ref(rocksdb::Cache::Handle* handle) override;
--
2.33.0

View File

@ -1,30 +0,0 @@
From 937231991bd7e2cd578cf8cb6c1bedf611c5faef Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Sat, 29 Apr 2023 13:47:43 +0200
Subject: [PATCH] librdb: fix build with gcc-13
* fixes:
ceph-15.2.15/src/librbd/api/PoolMetadata.h:28:19: error: 'uint64_t' has not bee
n declared
ceph/15.2.15-r0/ceph-15.2.15/src/librbd/api/PoolMetadata.cc:133:5: error: no declaration matche
s 'int librbd::api::PoolMetadata<ImageCtxT>::list(librados::v14_2_0::IoCtx&, const std::string&, uint64_t, std::map<std::__cxx11::basic_string<cha
r>, ceph::buffer::v15_2_0::list>*)'
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Upstream-Status: Pending
---
src/librbd/api/PoolMetadata.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/librbd/api/PoolMetadata.h b/src/librbd/api/PoolMetadata.h
index c0a81735..69ab574a 100644
--- a/src/librbd/api/PoolMetadata.h
+++ b/src/librbd/api/PoolMetadata.h
@@ -7,6 +7,7 @@
#include "include/buffer_fwd.h"
#include "include/rados/librados_fwd.hpp"
+#include <cstdint>
#include <map>
#include <string>

View File

@ -1,207 +0,0 @@
From 90696cb3652eb307c6aadde4af7d9198dc00c15f Mon Sep 17 00:00:00 2001
From: Kefu Chai <kchai@redhat.com>
Date: Tue, 17 Aug 2021 16:27:47 +0800
Subject: [PATCH 4/6] kv/rocksdb_cache: implement methods required by rocksdb
v6.22.1
rocksdb v6.22.1 added couple pure methods, so let's implement them.
Signed-off-by: Kefu Chai <kchai@redhat.com>
Upstream-Status: Backport [2c445598ce5280e85feb1f0e94d1940a444ee421]
Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com>
---
src/kv/rocksdb_cache/BinnedLRUCache.cc | 26 +++++++++++++++++++++++---
src/kv/rocksdb_cache/BinnedLRUCache.h | 14 +++++++++++---
src/kv/rocksdb_cache/ShardedCache.cc | 25 ++++++++++++++++++++++++-
src/kv/rocksdb_cache/ShardedCache.h | 20 ++++++++++++++++++--
4 files changed, 76 insertions(+), 9 deletions(-)
diff --git a/src/kv/rocksdb_cache/BinnedLRUCache.cc b/src/kv/rocksdb_cache/BinnedLRUCache.cc
index 4e5f4dd4..1e6ba7af 100644
--- a/src/kv/rocksdb_cache/BinnedLRUCache.cc
+++ b/src/kv/rocksdb_cache/BinnedLRUCache.cc
@@ -150,13 +150,20 @@ void BinnedLRUCacheShard::EraseUnRefEntries() {
}
}
-void BinnedLRUCacheShard::ApplyToAllCacheEntries(void (*callback)(void*, size_t),
- bool thread_safe) {
+void BinnedLRUCacheShard::ApplyToAllCacheEntries(
+ const std::function<void(const rocksdb::Slice& key,
+ void* value,
+ size_t charge,
+ DeleterFn)>& callback,
+ bool thread_safe)
+{
if (thread_safe) {
mutex_.lock();
}
table_.ApplyToAllCacheEntries(
- [callback](BinnedLRUHandle* h) { callback(h->value, h->charge); });
+ [callback](BinnedLRUHandle* h) {
+ callback(h->key(), h->value, h->charge, h->deleter);
+ });
if (thread_safe) {
mutex_.unlock();
}
@@ -463,6 +470,12 @@ std::string BinnedLRUCacheShard::GetPrintableOptions() const {
return std::string(buffer);
}
+DeleterFn BinnedLRUCacheShard::GetDeleter(rocksdb::Cache::Handle* h) const
+{
+ auto* handle = reinterpret_cast<BinnedLRUHandle*>(h);
+ return handle->deleter;
+}
+
BinnedLRUCache::BinnedLRUCache(CephContext *c,
size_t capacity,
int num_shard_bits,
@@ -518,6 +531,13 @@ void BinnedLRUCache::DisownData() {
#endif // !__SANITIZE_ADDRESS__
}
+#if (ROCKSDB_MAJOR >= 6 && ROCKSDB_MINOR >= 22)
+DeleterFn BinnedLRUCache::GetDeleter(Handle* handle) const
+{
+ return reinterpret_cast<const BinnedLRUHandle*>(handle)->deleter;
+}
+#endif
+
size_t BinnedLRUCache::TEST_GetLRUSize() {
size_t lru_size_of_all_shards = 0;
for (int i = 0; i < num_shards_; i++) {
diff --git a/src/kv/rocksdb_cache/BinnedLRUCache.h b/src/kv/rocksdb_cache/BinnedLRUCache.h
index b0fb7148..ba0c2720 100644
--- a/src/kv/rocksdb_cache/BinnedLRUCache.h
+++ b/src/kv/rocksdb_cache/BinnedLRUCache.h
@@ -205,13 +205,19 @@ class alignas(CACHE_LINE_SIZE) BinnedLRUCacheShard : public CacheShard {
virtual size_t GetUsage() const override;
virtual size_t GetPinnedUsage() const override;
- virtual void ApplyToAllCacheEntries(void (*callback)(void*, size_t),
- bool thread_safe) override;
+ virtual void ApplyToAllCacheEntries(
+ const std::function<void(const rocksdb::Slice& key,
+ void* value,
+ size_t charge,
+ DeleterFn)>& callback,
+ bool thread_safe) override;
virtual void EraseUnRefEntries() override;
virtual std::string GetPrintableOptions() const override;
+ virtual DeleterFn GetDeleter(rocksdb::Cache::Handle* handle) const override;
+
void TEST_GetLRUList(BinnedLRUHandle** lru, BinnedLRUHandle** lru_low_pri);
// Retrieves number of elements in LRU, for unit test purpose only
@@ -303,7 +309,9 @@ class BinnedLRUCache : public ShardedCache {
virtual size_t GetCharge(Handle* handle) const override;
virtual uint32_t GetHash(Handle* handle) const override;
virtual void DisownData() override;
-
+#if (ROCKSDB_MAJOR >= 6 && ROCKSDB_MINOR >= 22)
+ virtual DeleterFn GetDeleter(Handle* handle) const override;
+#endif
// Retrieves number of elements in LRU, for unit test purpose only
size_t TEST_GetLRUSize();
// Sets the high pri pool ratio
diff --git a/src/kv/rocksdb_cache/ShardedCache.cc b/src/kv/rocksdb_cache/ShardedCache.cc
index ef3b3b98..6cbd89ad 100644
--- a/src/kv/rocksdb_cache/ShardedCache.cc
+++ b/src/kv/rocksdb_cache/ShardedCache.cc
@@ -109,13 +109,36 @@ size_t ShardedCache::GetPinnedUsage() const {
return usage;
}
+#if (ROCKSDB_MAJOR >= 6 && ROCKSDB_MINOR >= 22)
+DeleterFn ShardedCache::GetDeleter(Handle* handle) const
+{
+ uint32_t hash = GetHash(handle);
+ return GetShard(Shard(hash))->GetDeleter(handle);
+}
+
+void ShardedCache::ApplyToAllEntries(
+ const std::function<void(const rocksdb::Slice& key, void* value, size_t charge,
+ DeleterFn deleter)>& callback,
+ const ApplyToAllEntriesOptions& opts)
+{
+ int num_shards = 1 << num_shard_bits_;
+ for (int s = 0; s < num_shards; s++) {
+ GetShard(s)->ApplyToAllCacheEntries(callback, true /* thread_safe */);
+ }
+}
+#else
void ShardedCache::ApplyToAllCacheEntries(void (*callback)(void*, size_t),
bool thread_safe) {
int num_shards = 1 << num_shard_bits_;
for (int s = 0; s < num_shards; s++) {
- GetShard(s)->ApplyToAllCacheEntries(callback, thread_safe);
+ GetShard(s)->ApplyToAllCacheEntries(
+ [callback](const rocksdb::Slice&, void* value, size_t charge, DeleterFn) {
+ callback(value, charge);
+ },
+ thread_safe);
}
}
+#endif
void ShardedCache::EraseUnRefEntries() {
int num_shards = 1 << num_shard_bits_;
diff --git a/src/kv/rocksdb_cache/ShardedCache.h b/src/kv/rocksdb_cache/ShardedCache.h
index 674e5322..4d3ca302 100644
--- a/src/kv/rocksdb_cache/ShardedCache.h
+++ b/src/kv/rocksdb_cache/ShardedCache.h
@@ -14,6 +14,7 @@
#include <string>
#include <mutex>
+#include "rocksdb/version.h"
#include "rocksdb/cache.h"
#include "include/ceph_hash.h"
#include "common/PriorityCache.h"
@@ -45,10 +46,15 @@ class CacheShard {
virtual void SetStrictCapacityLimit(bool strict_capacity_limit) = 0;
virtual size_t GetUsage() const = 0;
virtual size_t GetPinnedUsage() const = 0;
- virtual void ApplyToAllCacheEntries(void (*callback)(void*, size_t),
- bool thread_safe) = 0;
+ virtual void ApplyToAllCacheEntries(
+ const std::function<void(const rocksdb::Slice& key,
+ void* value,
+ size_t charge,
+ DeleterFn)>& callback,
+ bool thread_safe) = 0;
virtual void EraseUnRefEntries() = 0;
virtual std::string GetPrintableOptions() const { return ""; }
+ virtual DeleterFn GetDeleter(rocksdb::Cache::Handle* handle) const = 0;
};
// Generic cache interface which shards cache by hash of keys. 2^num_shard_bits
@@ -77,9 +83,19 @@ class ShardedCache : public rocksdb::Cache, public PriorityCache::PriCache {
virtual size_t GetUsage(rocksdb::Cache::Handle* handle) const override;
virtual size_t GetPinnedUsage() const override;
virtual size_t GetCharge(Handle* handle) const = 0;
+#if (ROCKSDB_MAJOR >= 6 && ROCKSDB_MINOR >= 22)
+ virtual DeleterFn GetDeleter(Handle* handle) const override;
+#endif
virtual void DisownData() override = 0;
+#if (ROCKSDB_MAJOR >= 6 && ROCKSDB_MINOR >= 22)
+ virtual void ApplyToAllEntries(
+ const std::function<void(const rocksdb::Slice& key, void* value, size_t charge,
+ DeleterFn deleter)>& callback,
+ const ApplyToAllEntriesOptions& opts) override;
+#else
virtual void ApplyToAllCacheEntries(void (*callback)(void*, size_t),
bool thread_safe) override;
+#endif
virtual void EraseUnRefEntries() override;
virtual std::string GetPrintableOptions() const override;
virtual CacheShard* GetShard(int shard) = 0;
--
2.33.0

View File

@ -1,32 +0,0 @@
From 52c57e25a5e2c617bc797b8ce50060b5894bd7fc Mon Sep 17 00:00:00 2001
From: Kefu Chai <kchai@redhat.com>
Date: Tue, 17 Aug 2021 18:06:31 +0800
Subject: [PATCH 5/6] kv/rocksdb_cache: mark Shard() const
it does not mutate anything, so mark it `const`.
Signed-off-by: Kefu Chai <kchai@redhat.com>
Upstream-Status: Backport [0296ac4458c0be0609f033e15b0fa8c6c9c20049]
Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com>
---
src/kv/rocksdb_cache/ShardedCache.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kv/rocksdb_cache/ShardedCache.h b/src/kv/rocksdb_cache/ShardedCache.h
index 4d3ca302..f98421a0 100644
--- a/src/kv/rocksdb_cache/ShardedCache.h
+++ b/src/kv/rocksdb_cache/ShardedCache.h
@@ -136,7 +136,7 @@ class ShardedCache : public rocksdb::Cache, public PriorityCache::PriCache {
// return Hash(s.data(), s.size(), 0);
}
- uint32_t Shard(uint32_t hash) {
+ uint32_t Shard(uint32_t hash) const {
// Note, hash >> 32 yields hash in gcc, not the zero we expect!
return (num_shard_bits_ > 0) ? (hash >> (32 - num_shard_bits_)) : 0;
}
--
2.33.0

View File

@ -1,158 +0,0 @@
From 47c33179f9a15ae95cc1579a421be89378602656 Mon Sep 17 00:00:00 2001
From: Guillaume Abrioux <gabrioux@redhat.com>
Date: Tue, 25 Jan 2022 10:25:53 +0100
Subject: [PATCH] ceph-volume: honour osd_dmcrypt_key_size option
ceph-volume doesn't honour osd_dmcrypt_key_size.
It means the default size is always applied.
It also changes the default value in `get_key_size_from_conf()`
From cryptsetup manpage:
> For XTS mode you can optionally set a key size of 512 bits with the -s option.
Using more than 512bits will end up with the following error message:
```
Key size in XTS mode must be 256 or 512 bits.
```
Fixes: https://tracker.ceph.com/issues/54006
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
Upstream-Status: Backport
github.com/ceph/ceph.git
equivalent to cherry-pick of commit 47c33179f9a15ae95cc1579a421be89378602656
CVE: CVE-2021-3979
Signed-off-by: Joe Slater <joe.slater@windriver.com>
---
.../ceph_volume/tests/util/test_encryption.py | 41 +++++++++++++------
.../ceph_volume/util/encryption.py | 34 ++++++++++-----
2 files changed, 51 insertions(+), 24 deletions(-)
diff --git a/src/ceph-volume/ceph_volume/tests/util/test_encryption.py b/src/ceph-volume/ceph_volume/tests/util/test_encryption.py
index e1420b440d3..c86dc50b7c7 100644
--- a/src/ceph-volume/ceph_volume/tests/util/test_encryption.py
+++ b/src/ceph-volume/ceph_volume/tests/util/test_encryption.py
@@ -1,5 +1,31 @@
from ceph_volume.util import encryption
+import base64
+class TestGetKeySize(object):
+ def test_get_size_from_conf_default(self, conf_ceph_stub):
+ conf_ceph_stub('''
+ [global]
+ fsid=asdf
+ ''')
+ assert encryption.get_key_size_from_conf() == '512'
+
+ def test_get_size_from_conf_custom(self, conf_ceph_stub):
+ conf_ceph_stub('''
+ [global]
+ fsid=asdf
+ [osd]
+ osd_dmcrypt_key_size=256
+ ''')
+ assert encryption.get_key_size_from_conf() == '256'
+
+ def test_get_size_from_conf_custom_invalid(self, conf_ceph_stub):
+ conf_ceph_stub('''
+ [global]
+ fsid=asdf
+ [osd]
+ osd_dmcrypt_key_size=1024
+ ''')
+ assert encryption.get_key_size_from_conf() == '512'
class TestStatus(object):
@@ -37,17 +63,6 @@ class TestDmcryptClose(object):
class TestDmcryptKey(object):
- def test_dmcrypt_with_default_size(self, conf_ceph_stub):
- conf_ceph_stub('[global]\nfsid=asdf-lkjh')
- result = encryption.create_dmcrypt_key()
- assert len(result) == 172
-
- def test_dmcrypt_with_custom_size(self, conf_ceph_stub):
- conf_ceph_stub('''
- [global]
- fsid=asdf
- [osd]
- osd_dmcrypt_size=8
- ''')
+ def test_dmcrypt(self):
result = encryption.create_dmcrypt_key()
- assert len(result) == 172
+ assert len(base64.b64decode(result)) == 128
diff --git a/src/ceph-volume/ceph_volume/util/encryption.py b/src/ceph-volume/ceph_volume/util/encryption.py
index 72a0ccf121e..2a2c03337b6 100644
--- a/src/ceph-volume/ceph_volume/util/encryption.py
+++ b/src/ceph-volume/ceph_volume/util/encryption.py
@@ -9,21 +9,29 @@ from .disk import lsblk, device_family, get_part_entry_type
logger = logging.getLogger(__name__)
-
-def create_dmcrypt_key():
+def get_key_size_from_conf():
"""
- Create the secret dm-crypt key used to decrypt a device.
+ Return the osd dmcrypt key size from config file.
+ Default is 512.
"""
- # get the customizable dmcrypt key size (in bits) from ceph.conf fallback
- # to the default of 1024
- dmcrypt_key_size = conf.ceph.get_safe(
+ default_key_size = '512'
+ key_size = conf.ceph.get_safe(
'osd',
'osd_dmcrypt_key_size',
- default=1024,
- )
- # The size of the key is defined in bits, so we must transform that
- # value to bytes (dividing by 8) because we read in bytes, not bits
- random_string = os.urandom(int(dmcrypt_key_size / 8))
+ default='512')
+
+ if key_size not in ['256', '512']:
+ logger.warning(("Invalid value set for osd_dmcrypt_key_size ({}). "
+ "Falling back to {}bits".format(key_size, default_key_size)))
+ return default_key_size
+
+ return key_size
+
+def create_dmcrypt_key():
+ """
+ Create the secret dm-crypt key (KEK) used to encrypt/decrypt the Volume Key.
+ """
+ random_string = os.urandom(128)
key = base64.b64encode(random_string).decode('utf-8')
return key
@@ -38,6 +46,8 @@ def luks_format(key, device):
command = [
'cryptsetup',
'--batch-mode', # do not prompt
+ '--key-size',
+ get_key_size_from_conf(),
'--key-file', # misnomer, should be key
'-', # because we indicate stdin for the key here
'luksFormat',
@@ -83,6 +93,8 @@ def luks_open(key, device, mapping):
"""
command = [
'cryptsetup',
+ '--key-size',
+ get_key_size_from_conf(),
'--key-file',
'-',
'--allow-discards', # allow discards (aka TRIM) requests for device
--
2.35.1

View File

@ -2,7 +2,7 @@ SUMMARY = "User space components of the Ceph file system"
LICENSE = "LGPL-2.1-only & GPL-2.0-only & Apache-2.0 & MIT"
LIC_FILES_CHKSUM = "file://COPYING-LGPL2.1;md5=fbc093901857fcd118f065f900982c24 \
file://COPYING-GPL2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
file://COPYING;md5=4eb012c221c5fd4b760029a2981a6754 \
file://COPYING;md5=5351120989d78252e65dc1a2a92e3617 \
"
inherit cmake pkgconfig python3native python3-dir systemd
# Disable python pybind support for ceph temporary, when corss compiling pybind,
@ -13,29 +13,17 @@ SRC_URI = "http://download.ceph.com/tarballs/ceph-${PV}.tar.gz \
file://0001-fix-host-library-paths-were-used.patch \
file://ceph.conf \
file://0001-cmake-add-support-for-python3.11.patch \
file://0001-SnappyCompressor.h-fix-snappy-compiler-error.patch \
file://0001-buffer.h-add-missing-header-file-due-to-gcc-upgrade.patch \
file://0002-common-fix-FTBFS-due-to-dout-need_dynamic-on-GCC-12.patch \
file://CVE-2021-3979.patch \
file://0001-kv-rocksdb_cache-drop-ROCKSDB_PRIszt.patch \
file://0002-kv-rocksdb_cache-reorder-ShardedCache-methods-declar.patch \
file://0003-kv-rocksdb_cache-define-DeleterFn-function-pointer-t.patch \
file://0004-kv-rocksdb_cache-implement-methods-required-by-rocks.patch \
file://0005-kv-rocksdb_cache-mark-Shard-const.patch \
file://0006-rocksdb-build-with-rocksdb-7.y.z.patch \
file://0001-common-fix-build-with-GCC-13-missing-cstdint-include.patch \
file://0002-common-replace-BitVector-NoInitAllocator-with-wrappe.patch \
file://0003-librdb-fix-build-with-gcc-13.patch \
"
SRC_URI[sha256sum] = "5dccdaff2ebe18d435b32bfc06f8b5f474bf6ac0432a6a07d144b7c56700d0bf"
SRC_URI[sha256sum] = "495b63e1146c604018ae0cb29bf769b5d6235e3c95849c43513baf12bba1364d"
DEPENDS = "boost bzip2 curl expat gperf-native \
keyutils libaio libibverbs lz4 \
nspr nss \
DEPENDS = "boost bzip2 curl cryptsetup expat gperf-native \
keyutils libaio libibverbs lua lz4 \
nspr nss ninja-native \
oath openldap openssl \
python3 python3-cython-native rabbitmq-c rocksdb snappy udev \
valgrind xfsprogs zlib \
python3 python3-native python3-cython-native python3-pyyaml-native \
rabbitmq-c rocksdb snappy thrift udev \
valgrind xfsprogs zlib libgcc \
"
SYSTEMD_SERVICE:${PN} = " \
ceph-radosgw@.service \
@ -72,21 +60,48 @@ EXTRA_OECMAKE = "-DWITH_MANPAGE=OFF \
-DWITH_SYSTEM_ROCKSDB=ON \
-DWITH_RDMA=OFF \
-DWITH_RADOSGW_AMQP_ENDPOINT=OFF \
-DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIRED=3 \
-DPython3_EXECUTABLE=${PYTHON} \
-DWITH_RADOSGW_KAFKA_ENDPOINT=OFF \
-DWITH_REENTRANT_STRSIGNAL=ON \
"
-DWITH_PYTHON3=3.12 \
-DPYTHON_DESIRED=3 \
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${WORKDIR}/toolchain.cmake \
"
EXTRA_OECMAKE += "-DThrift_INCLUDE_DIR:PATH=${STAGING_INCDIR} \
-DThrift_LIBRARIES:PATH=${STAGING_LIBDIR} \
"
# retired options:
# -DPython3_VERSION=${PYTHON_BASEVERSION}
# -DPython3_USE_STATIC_LIBS=FALSE
# -DPython3_INCLUDE_DIR:PATH=${PYTHON_INCLUDE_DIR}
# -DPython3_LIBRARY:PATH=${PYTHON_LIBRARY}
# -DPython3_ROOT_DIR:PATH=${PYTHON_SITEPACKAGES_DIR}
# -DPython3_EXECUTABLE:PATH="${PYTHON}"
CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
export STAGING_DIR_HOST
do_compile:prepend() {
cmake_runcmake_build --target legacy-option-headers
}
# do_compile() {
# ninja -v ${PARALLEL_MAKE}
# }
do_compile() {
cmake_runcmake_build --target all
}
do_configure:prepend () {
echo "set( CMAKE_SYSROOT \"${RECIPE_SYSROOT}\" )" >> ${WORKDIR}/toolchain.cmake
echo "set( CMAKE_DESTDIR \"${D}\" )" >> ${WORKDIR}/toolchain.cmake
echo "set( PYTHON_SITEPACKAGES_DIR \"${PYTHON_SITEPACKAGES_DIR}\" )" >> ${WORKDIR}/toolchain.cmake
# echo "set( CMAKE_C_COMPILER_WORKS TRUE)" >> ${WORKDIR}/toolchain.cmake
# echo "set( CMAKE_CXX_COMPILER_FORCED TRUE)" >> ${WORKDIR}/toolchain.cmake
echo "set( CMAKE_C_COMPILER_FORCED TRUE )" >> ${WORKDIR}/toolchain.cmake
}
do_install:append () {