Compare commits

...

No commits in common. 'c9' and 'c10-beta' have entirely different histories.
c9 ... c10-beta

@ -1 +1 @@
3f715e71b2a6d0cd9fbdc390b50f95a1303a1026 SOURCES/ceph-16.2.4.tar.gz d37575123f86e93f877d433d5266a39173429aa6 SOURCES/ceph-18.2.1.tar.gz

2
.gitignore vendored

@ -1 +1 @@
SOURCES/ceph-16.2.4.tar.gz SOURCES/ceph-18.2.1.tar.gz

@ -1,13 +0,0 @@
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 65ba10b0f1..eeedc29c37 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -165,7 +165,7 @@ elseif(HAVE_ARMV8_CRC)
crc32c_aarch64.c)
endif(HAVE_INTEL)
-add_library(crc32 ${crc32_srcs})
+add_library(crc32 STATIC ${crc32_srcs})
if(HAVE_ARMV8_CRC)
set_target_properties(crc32 PROPERTIES
COMPILE_FLAGS "${CMAKE_C_FLAGS} ${ARMV8_CRC_COMPILE_FLAGS}")

@ -8,14 +8,3 @@
namespace ceph { namespace ceph {
class Formatter; class Formatter;
--- ceph-15.2.4/src/global/signal_handler.h.orig 2020-07-17 12:57:54.763628429 -0400
+++ ceph-15.2.4/src/global/signal_handler.h 2020-07-17 12:58:10.610628429 -0400
@@ -16,6 +16,8 @@
#define CEPH_GLOBAL_SIGNAL_HANDLER_H
#include <signal.h>
+#include <string>
+
#include "acconfig.h"
typedef void (*signal_handler_t)(int);

@ -1,11 +0,0 @@
--- ceph-16.1.0-43-g6b74fb5c/src/blk/CMakeLists.txt.orig 2021-02-01 08:16:26.719517641 -0500
+++ ceph-16.1.0-43-g6b74fb5c/src/blk/CMakeLists.txt 2021-02-01 08:16:47.810092341 -0500
@@ -25,7 +25,7 @@
zoned/HMSMRDevice.cc)
endif()
-add_library(blk ${libblk_srcs})
+add_library(blk STATIC ${libblk_srcs})
target_include_directories(blk PRIVATE "./")
if(HAVE_LIBAIO)

@ -1,11 +0,0 @@
--- ceph-16.1.0-43-g6b74fb5c/src/test/neorados/CMakeLists.txt.orig 2021-02-01 08:25:18.006965821 -0500
+++ ceph-16.1.0-43-g6b74fb5c/src/test/neorados/CMakeLists.txt 2021-02-01 08:25:34.244407147 -0500
@@ -19,7 +19,7 @@
target_link_libraries(ceph_test_neorados_op_speed
libneorados fmt::fmt ${unittest_libs})
-add_library(neoradostest-support common_tests.cc)
+add_library(neoradostest-support STATIC common_tests.cc)
target_link_libraries(neoradostest-support
libneorados fmt::fmt)

@ -1,63 +0,0 @@
From 178f6bdac97b57300bbe0956633cf686a7e3ccee Mon Sep 17 00:00:00 2001
From: Yuval Lifshitz <ylifshit@redhat.com>
Date: Fri, 12 Mar 2021 08:56:45 +0200
Subject: [PATCH] librgw/notifications: initialize kafka and amqp
Fixes: https://tracker.ceph.com/issues/49738
Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
---
src/rgw/librgw.cc | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/rgw/librgw.cc b/src/rgw/librgw.cc
index 012cc54c3b..a5351dbe7c 100644
--- a/src/rgw/librgw.cc
+++ b/src/rgw/librgw.cc
@@ -53,6 +53,12 @@
#include "rgw_http_client.h"
#include "rgw_http_client_curl.h"
#include "rgw_perf_counters.h"
+#ifdef WITH_RADOSGW_AMQP_ENDPOINT
+#include "rgw_amqp.h"
+#endif
+#ifdef WITH_RADOSGW_KAFKA_ENDPOINT
+#include "rgw_kafka.h"
+#endif
#include "services/svc_zone.h"
@@ -617,6 +623,17 @@ namespace rgw {
/* ignore error */
}
+#ifdef WITH_RADOSGW_AMQP_ENDPOINT
+ if (!rgw::amqp::init(cct.get())) {
+ derr << "ERROR: failed to initialize AMQP manager" << dendl;
+ }
+#endif
+#ifdef WITH_RADOSGW_KAFKA_ENDPOINT
+ if (!rgw::kafka::init(cct.get())) {
+ derr << "ERROR: failed to initialize Kafka manager" << dendl;
+ }
+#endif
+
return 0;
} /* RGWLib::init() */
@@ -645,6 +662,12 @@ namespace rgw {
rgw_shutdown_resolver();
rgw_http_client_cleanup();
rgw::curl::cleanup_curl();
+#ifdef WITH_RADOSGW_AMQP_ENDPOINT
+ rgw::amqp::shutdown();
+#endif
+#ifdef WITH_RADOSGW_KAFKA_ENDPOINT
+ rgw::kafka::shutdown();
+#endif
rgw_perf_stop(g_ceph_context);
--
2.26.2

@ -0,0 +1,27 @@
From 1999108aeb1f6f93a19ea7bb64c6ae8b87d1b264 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 20 Jan 2022 05:33:13 -0800
Subject: [PATCH] CET: Add CET marker to crc32c_intel_fast_zero_asm.s
Add .note.gnu.property section to crc32c_intel_fast_zero_asm.s to mark
for IBT and SHSTK compatibility.
---
src/common/crc32c_intel_fast_zero_asm.s | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/common/crc32c_intel_fast_zero_asm.s b/src/common/crc32c_intel_fast_zero_asm.s
index 216ecf639f3..2e291d858f3 100644
--- a/src/common/crc32c_intel_fast_zero_asm.s
+++ b/src/common/crc32c_intel_fast_zero_asm.s
@@ -654,4 +654,8 @@ slversion crc32_iscsi_zero_00, 00, 02, 0014
%ifidn __OUTPUT_FORMAT__, elf64
; inform linker that this doesn't require executable stack
section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
%endif
--
2.34.1

@ -1,57 +0,0 @@
From 3aa31813980d22719277a04797df48310acdff66 Mon Sep 17 00:00:00 2001
From: Jonas Jelten <jj@sft.lol>
Date: Mon, 15 Mar 2021 23:21:07 +0100
Subject: [PATCH] os/bluestore: strip trailing slash for directory listings
Calls to BlueRocksEnv::GetChildren may contain a trailing / in the
queried directory, which is stripped away with this patch.
If it's not stripped, the directory entry is not found in BlueFS:
```
10 bluefs readdir db/
20 bluefs readdir dir db/ not found
3 rocksdb: [db/db_impl/db_impl_open.cc:1785] Persisting Option File error: OK
```
Fixes: https://tracker.ceph.com/issues/49815
Signed-off-by: Jonas Jelten <jj@sft.lol>
---
src/os/bluestore/BlueFS.cc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc
index ea39626aef..62b9d27f58 100644
--- a/src/os/bluestore/BlueFS.cc
+++ b/src/os/bluestore/BlueFS.cc
@@ -3493,9 +3493,14 @@
int BlueFS::readdir(const string& dirname, vector<string> *ls)
{
+ std::string dname = dirname;
+ // dirname may contain a trailing /
+ if (!dname.empty() && dname.back() == '/') {
+ dname.pop_back();
+ }
std::lock_guard l(lock);
- dout(10) << __func__ << " " << dirname << dendl;
- if (dirname.empty()) {
+ dout(10) << __func__ << " " << dname << dendl;
+ if (dname.empty()) {
// list dirs
ls->reserve(dir_map.size() + 2);
for (auto& q : dir_map) {
@@ -3503,9 +3508,9 @@
}
} else {
// list files in dir
- map<string,DirRef>::iterator p = dir_map.find(dirname);
+ map<string,DirRef>::iterator p = dir_map.find(dname);
if (p == dir_map.end()) {
- dout(20) << __func__ << " dir " << dirname << " not found" << dendl;
+ dout(20) << __func__ << " dir " << dname << " not found" << dendl;
return -ENOENT;
}
DirRef dir = p->second;
--
2.26.2

@ -0,0 +1,172 @@
From bbcc1a69f787881f16156f3c789052942a564103 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 20 Jan 2022 05:35:49 -0800
Subject: [PATCH] isa-l/CET: Add CET marker to x86-64 crc32 assembly codes
Add .note.gnu.property section to x86-64 crc32 assembly codes to mark
for IBT and SHSTK compatibility.
---
crc/crc32_gzip_refl_by16_10.asm | 9 +++++++++
crc/crc32_gzip_refl_by8.asm | 9 +++++++++
crc/crc32_gzip_refl_by8_02.asm | 9 +++++++++
crc/crc32_ieee_01.asm | 8 ++++++++
crc/crc32_ieee_02.asm | 9 +++++++++
crc/crc32_ieee_by16_10.asm | 9 +++++++++
crc/crc32_ieee_by4.asm | 9 +++++++++
crc/crc32_iscsi_00.asm | 8 ++++++++
crc/crc32_iscsi_01.asm | 8 ++++++++
9 files changed, 78 insertions(+)
diff --git a/src/isa-l/crc/crc32_gzip_refl_by16_10.asm b/src/isa-l/crc/crc32_gzip_refl_by16_10.asm
index 40236f6..b16874d 100644
--- a/src/isa-l/crc/crc32_gzip_refl_by16_10.asm
+++ b/src/isa-l/crc/crc32_gzip_refl_by16_10.asm
@@ -566,3 +566,12 @@ global no_ %+ FUNCTION_NAME
no_ %+ FUNCTION_NAME %+ :
%endif
%endif ; (AS_FEATURE_LEVEL) >= 10
+
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
diff --git a/src/isa-l/crc/crc32_gzip_refl_by8.asm b/src/isa-l/crc/crc32_gzip_refl_by8.asm
index 62f7e7d..97b0c4a 100644
--- a/src/isa-l/crc/crc32_gzip_refl_by8.asm
+++ b/src/isa-l/crc/crc32_gzip_refl_by8.asm
@@ -622,3 +622,12 @@ dq 0x0706050403020100, 0x000e0d0c0b0a0908
;;; func core, ver, snum
slversion crc32_gzip_refl_by8, 01, 00, 002c
+
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
diff --git a/src/isa-l/crc/crc32_gzip_refl_by8_02.asm b/src/isa-l/crc/crc32_gzip_refl_by8_02.asm
index 80d849e..1d5a75f 100644
--- a/src/isa-l/crc/crc32_gzip_refl_by8_02.asm
+++ b/src/isa-l/crc/crc32_gzip_refl_by8_02.asm
@@ -553,3 +553,12 @@ pshufb_shf_table:
; dq 0x060504030201008f, 0x0e0d0c0b0a090807 ; shl 1 (16-15) / shr15
dq 0x8786858483828100, 0x8f8e8d8c8b8a8988
dq 0x0706050403020100, 0x000e0d0c0b0a0908
+
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
diff --git a/src/isa-l/crc/crc32_ieee_01.asm b/src/isa-l/crc/crc32_ieee_01.asm
index 32495ed..cfc443b 100644
--- a/src/isa-l/crc/crc32_ieee_01.asm
+++ b/src/isa-l/crc/crc32_ieee_01.asm
@@ -653,3 +653,11 @@ dq 0x0706050403020100, 0x000e0d0c0b0a0908
;;; func core, ver, snum
slversion crc32_ieee_01, 01, 06, 0011
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
diff --git a/src/isa-l/crc/crc32_ieee_02.asm b/src/isa-l/crc/crc32_ieee_02.asm
index 8a472b0..dd7096a 100644
--- a/src/isa-l/crc/crc32_ieee_02.asm
+++ b/src/isa-l/crc/crc32_ieee_02.asm
@@ -649,3 +649,12 @@ pshufb_shf_table:
; dq 0x060504030201008f, 0x0e0d0c0b0a090807 ; shl 1 (16-15) / shr15
dq 0x8786858483828100, 0x8f8e8d8c8b8a8988
dq 0x0706050403020100, 0x000e0d0c0b0a0908
+
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
diff --git a/src/isa-l/crc/crc32_ieee_by16_10.asm b/src/isa-l/crc/crc32_ieee_by16_10.asm
index 200fd93..2afd597 100644
--- a/src/isa-l/crc/crc32_ieee_by16_10.asm
+++ b/src/isa-l/crc/crc32_ieee_by16_10.asm
@@ -582,3 +582,12 @@ global no_ %+ FUNCTION_NAME
no_ %+ FUNCTION_NAME %+ :
%endif
%endif ; (AS_FEATURE_LEVEL) >= 10
+
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
diff --git a/src/isa-l/crc/crc32_ieee_by4.asm b/src/isa-l/crc/crc32_ieee_by4.asm
index 39bed5a..847d0bd 100644
--- a/src/isa-l/crc/crc32_ieee_by4.asm
+++ b/src/isa-l/crc/crc32_ieee_by4.asm
@@ -563,3 +563,12 @@ SHUF_MASK dq 0x08090A0B0C0D0E0F, 0x0001020304050607
;;; func core, ver, snum
slversion crc32_ieee_by4, 05, 02, 0017
+
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
diff --git a/src/isa-l/crc/crc32_iscsi_00.asm b/src/isa-l/crc/crc32_iscsi_00.asm
index 4f81e3a..3d6b2d1 100644
--- a/src/isa-l/crc/crc32_iscsi_00.asm
+++ b/src/isa-l/crc/crc32_iscsi_00.asm
@@ -669,3 +669,11 @@ DD 0x54851c7f,0x89e3d7c4,0xeba4fdf8,0x36c23643
;;; func core, ver, snum
slversion crc32_iscsi_00, 00, 04, 0014
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
diff --git a/src/isa-l/crc/crc32_iscsi_01.asm b/src/isa-l/crc/crc32_iscsi_01.asm
index 2a81517..c048413 100644
--- a/src/isa-l/crc/crc32_iscsi_01.asm
+++ b/src/isa-l/crc/crc32_iscsi_01.asm
@@ -588,3 +588,11 @@ K_table:
;;; func core, ver, snum
slversion crc32_iscsi_01, 01, 04, 0015
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
--
2.34.1

@ -1,23 +0,0 @@
--- a/src/test/rgw/amqp_mock.cc
+++ b/src/test/rgw/amqp_mock.cc
@@ -291,7 +291,11 @@ amqp_confirm_select_ok_t* amqp_confirm_select(amqp_connection_state_t state, amq
return state->confirm;
}
-int amqp_simple_wait_frame_noblock(amqp_connection_state_t state, amqp_frame_t *decoded_frame, struct timeval* tv) {
+extern "C" {
+
+int amqp_simple_wait_frame_noblock(amqp_connection_state_t state,
+ amqp_frame_t *decoded_frame,
+ const struct timeval* tv) {
if (state->socket && state->socket->open_called &&
state->login_called && state->channel1 && state->channel2 && state->exchange &&
state->queue && state->consume && state->confirm && !FAIL_NEXT_READ) {
@@ -345,6 +349,7 @@ int amqp_simple_wait_frame_noblock(amqp_connection_state_t state, amqp_frame_t *
}
return AMQP_STATUS_CONNECTION_CLOSED;
}
+} // extern "C"
amqp_basic_consume_ok_t* amqp_basic_consume(
amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t queue,

@ -0,0 +1,100 @@
From 72e6d27e08c86c16e8931739a5e6ecbc06b102d5 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 20 Jan 2022 05:40:56 -0800
Subject: [PATCH] spdk/isa-l/CET: Add CET marker to x86-64 crc32 assembly codes
Add .note.gnu.property section to x86-64 crc32 assembly codes to mark
for IBT and SHSTK compatibility.
---
crc/crc32_gzip_refl_by8.asm | 9 +++++++++
crc/crc32_ieee_01.asm | 8 ++++++++
crc/crc32_ieee_by4.asm | 9 +++++++++
crc/crc32_iscsi_00.asm | 8 ++++++++
crc/crc32_iscsi_01.asm | 8 ++++++++
5 files changed, 42 insertions(+)
diff --git a/src/spdk/isa-l/crc/crc32_gzip_refl_by8.asm b/src/spdk/isa-l/crc/crc32_gzip_refl_by8.asm
index 62f7e7d..97b0c4a 100644
--- a/src/spdk/isa-l/crc/crc32_gzip_refl_by8.asm
+++ b/src/spdk/isa-l/crc/crc32_gzip_refl_by8.asm
@@ -622,3 +622,12 @@ dq 0x0706050403020100, 0x000e0d0c0b0a0908
;;; func core, ver, snum
slversion crc32_gzip_refl_by8, 01, 00, 002c
+
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
diff --git a/src/spdk/isa-l/crc/crc32_ieee_01.asm b/src/spdk/isa-l/crc/crc32_ieee_01.asm
index 32495ed..cfc443b 100644
--- a/src/spdk/isa-l/crc/crc32_ieee_01.asm
+++ b/src/spdk/isa-l/crc/crc32_ieee_01.asm
@@ -653,3 +653,11 @@ dq 0x0706050403020100, 0x000e0d0c0b0a0908
;;; func core, ver, snum
slversion crc32_ieee_01, 01, 06, 0011
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
diff --git a/src/spdk/isa-l/crc/crc32_ieee_by4.asm b/src/spdk/isa-l/crc/crc32_ieee_by4.asm
index 39bed5a..847d0bd 100644
--- a/src/spdk/isa-l/crc/crc32_ieee_by4.asm
+++ b/src/spdk/isa-l/crc/crc32_ieee_by4.asm
@@ -563,3 +563,12 @@ SHUF_MASK dq 0x08090A0B0C0D0E0F, 0x0001020304050607
;;; func core, ver, snum
slversion crc32_ieee_by4, 05, 02, 0017
+
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
diff --git a/src/spdk/isa-l/crc/crc32_iscsi_00.asm b/src/spdk/isa-l/crc/crc32_iscsi_00.asm
index 4f81e3a..3d6b2d1 100644
--- a/src/spdk/isa-l/crc/crc32_iscsi_00.asm
+++ b/src/spdk/isa-l/crc/crc32_iscsi_00.asm
@@ -669,3 +669,11 @@ DD 0x54851c7f,0x89e3d7c4,0xeba4fdf8,0x36c23643
;;; func core, ver, snum
slversion crc32_iscsi_00, 00, 04, 0014
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
diff --git a/src/spdk/isa-l/crc/crc32_iscsi_01.asm b/src/spdk/isa-l/crc/crc32_iscsi_01.asm
index 2a81517..c048413 100644
--- a/src/spdk/isa-l/crc/crc32_iscsi_01.asm
+++ b/src/spdk/isa-l/crc/crc32_iscsi_01.asm
@@ -588,3 +588,11 @@ K_table:
;;; func core, ver, snum
slversion crc32_iscsi_01, 01, 04, 0015
+%ifidn __OUTPUT_FORMAT__, elf64
+; inform linker that this doesn't require executable stack
+section .note.GNU-stack noalloc noexec nowrite progbits
+; inform linker that this is compatible with IBT and SHSTK
+section .note.gnu.property note alloc noexec align=8
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
+%endif
--
2.34.1

@ -1,11 +0,0 @@
--- ceph-16.2.4/src/compressor/snappy/SnappyCompressor.h.orig 2021-05-26 08:30:26.205447315 -0400
+++ ceph-16.2.4/src/compressor/snappy/SnappyCompressor.h 2021-05-26 08:31:22.570443033 -0400
@@ -97,7 +97,7 @@
if (qat_enabled)
return qat_accel.decompress(p, compressed_len, dst, compressor_message);
#endif
- snappy::uint32 res_len = 0;
+ std::uint32_t res_len = 0;
BufferlistSource source_1(p, compressed_len);
if (!snappy::GetUncompressedLength(&source_1, &res_len)) {
return -1;

@ -1,52 +0,0 @@
From 00e90946e6ffc0bb5bf11f02d6fd8993974e8159 Mon Sep 17 00:00:00 2001
From: Kefu Chai <kchai@redhat.com>
Date: Sat, 24 Jul 2021 00:09:58 +0800
Subject: [PATCH 1/3] osdc/Objecter: move LingerOp's ctor to .cc
so the linkage of fmt::fmt does not spill out to other compilation
units.
Signed-off-by: Kefu Chai <kchai@redhat.com>
---
src/osdc/Objecter.cc | 7 +++++++
src/osdc/Objecter.h | 6 +-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc
index d935b73adb9..da25c584f79 100644
--- a/src/osdc/Objecter.cc
+++ b/src/osdc/Objecter.cc
@@ -4722,6 +4722,13 @@ void Objecter::handle_command_reply(MCommandReply *m)
m->put();
}
+Objecter::LingerOp::LingerOp(Objecter *o, uint64_t linger_id)
+ : objecter(o),
+ linger_id(linger_id),
+ watch_lock(ceph::make_shared_mutex(
+ fmt::format("LingerOp::watch_lock #{}", linger_id)))
+{}
+
void Objecter::submit_command(CommandOp *c, ceph_tid_t *ptid)
{
shunique_lock sul(rwlock, ceph::acquire_unique);
diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h
index 5af605913c0..163a3359de7 100644
--- a/src/osdc/Objecter.h
+++ b/src/osdc/Objecter.h
@@ -2304,11 +2304,7 @@ public:
watch_pending_async.pop_front();
}
- explicit LingerOp(Objecter *o, uint64_t linger_id)
- : objecter(o), linger_id(linger_id),
- watch_lock(ceph::make_shared_mutex(
- fmt::format("LingerOp::watch_lock #{}", linger_id))) {}
-
+ LingerOp(Objecter *o, uint64_t linger_id);
const LingerOp& operator=(const LingerOp& r) = delete;
LingerOp(const LingerOp& o) = delete;
--
2.31.1

@ -1,185 +0,0 @@
From d8aa71fe943d379590e5d029357a12f667ad2a73 Mon Sep 17 00:00:00 2001
From: Kefu Chai <kchai@redhat.com>
Date: Fri, 23 Jul 2021 17:52:12 +0800
Subject: [PATCH 2/3] cmake: add an option "WITH_FMT_HEADER_ONLY"
in this change:
* an interface library named "fmt-header-only" is introduced. it brings
the support to the header only fmt library.
* fmt::fmt is renamed to fmt
* an option named "WITH_FMT_HEADER_ONLY" is introduced
* fmt::fmt is an alias of "fmt-header-only" if "WITH_FMT_HEADER_ONLY"
is "ON", and an alias of "fmt" otherwise.
because fmt is packaged in EPEL, while librados is packaged
in RHEL, so we cannot have fmt as a runtime dependency of librados.
to address this issue an option "WITH_FMT_HEADER_ONLY" is introduced, so
that we can enable it when building Ceph with the header version of fmt.
and the built packages won't have runtime dependency of fmt.
Signed-off-by: Kefu Chai <kchai@redhat.com>
---
cmake/modules/Findfmt.cmake | 22 ++++++++++++++++++++--
src/CMakeLists.txt | 11 +++++++++++
src/common/CMakeLists.txt | 1 +
src/mon/CMakeLists.txt | 5 ++++-
src/msg/CMakeLists.txt | 1 +
src/neorados/CMakeLists.txt | 2 ++
src/osd/CMakeLists.txt | 2 +-
src/tools/CMakeLists.txt | 2 +-
8 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/cmake/modules/Findfmt.cmake b/cmake/modules/Findfmt.cmake
index 747d924e901..734c2b0571c 100644
--- a/cmake/modules/Findfmt.cmake
+++ b/cmake/modules/Findfmt.cmake
@@ -35,9 +35,27 @@ mark_as_advanced(
fmt_VERSION_STRING)
if(fmt_FOUND AND NOT (TARGET fmt::fmt))
- add_library(fmt::fmt UNKNOWN IMPORTED)
- set_target_properties(fmt::fmt PROPERTIES
+ add_library(fmt-header-only INTERFACE)
+ set_target_properties(fmt-header-only PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${fmt_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS FMT_HEADER_ONLY=1
+ INTERFACE_COMPILE_FEATURES cxx_std_11)
+
+ add_library(fmt UNKNOWN IMPORTED GLOBAL)
+ set_target_properties(fmt PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${fmt_INCLUDE_DIR}"
+ INTERFACE_COMPILE_FEATURES cxx_std_11
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${fmt_LIBRARY}")
+
+ if(WITH_FMT_HEADER_ONLY)
+ # please note, this is different from how upstream defines fmt::fmt.
+ # in order to force 3rd party libraries to link against fmt-header-only if
+ # WITH_FMT_HEADER_ONLY is ON, we have to point fmt::fmt to fmt-header-only
+ # in this case.
+ add_library(fmt::fmt ALIAS fmt-header-only)
+ else()
+ add_library(fmt::fmt ALIAS fmt)
+ endif()
+
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2a80566150c..c4d73633ed8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -304,6 +304,7 @@ add_subdirectory(json_spirit)
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/src/xxHash")
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/src/rapidjson/include")
+option(WITH_FMT_HEADER_ONLY "use header-only version of fmt library" OFF)
find_package(fmt 6.0.0 QUIET)
if(fmt_FOUND)
include_directories(SYSTEM "${fmt_INCLUDE_DIR}")
@@ -360,6 +361,15 @@ if(WITH_SEASTAR)
add_subdirectory(crimson)
endif()
+function(compile_with_fmt target)
+ get_target_property(fmt_compile_definitions
+ fmt::fmt INTERFACE_COMPILE_DEFINITIONS)
+ if(fmt_compile_definitions)
+ target_compile_definitions(${target} PUBLIC
+ ${fmt_compile_definitions})
+ endif()
+endfunction()
+
set(libcommon_files
${CMAKE_BINARY_DIR}/src/include/ceph_ver.h
ceph_ver.c
@@ -396,6 +406,7 @@ endif()
set_source_files_properties(ceph_ver.c
APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h)
add_library(common-objs OBJECT ${libcommon_files})
+compile_with_fmt(common-objs)
if(WITH_JAEGER)
find_package(yaml-cpp 0.6.0)
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 6f29dfef350..7482b3d072a 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -177,6 +177,7 @@ target_compile_definitions(common-common-objs PRIVATE
"CEPH_LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\""
"CEPH_PKGLIBDIR=\"${CEPH_INSTALL_FULL_PKGLIBDIR}\""
"CEPH_DATADIR=\"${CEPH_INSTALL_DATADIR}\"")
+compile_with_fmt(common-common-objs)
set(common_mountcephfs_srcs
armor.c
diff --git a/src/mon/CMakeLists.txt b/src/mon/CMakeLists.txt
index 088fa6a0cdd..b4056fdb1ec 100644
--- a/src/mon/CMakeLists.txt
+++ b/src/mon/CMakeLists.txt
@@ -33,7 +33,10 @@ endif()
add_library(mon STATIC
${lib_mon_srcs})
-target_link_libraries(mon kv heap_profiler)
+target_link_libraries(mon
+ kv
+ heap_profiler
+ fmt::fmt)
if(WITH_JAEGER)
target_link_libraries(mon jaeger-base)
endif()
diff --git a/src/msg/CMakeLists.txt b/src/msg/CMakeLists.txt
index e6d0b589b42..9cca15c8155 100644
--- a/src/msg/CMakeLists.txt
+++ b/src/msg/CMakeLists.txt
@@ -38,6 +38,7 @@ if(HAVE_RDMA)
endif()
add_library(common-msg-objs OBJECT ${msg_srcs})
+compile_with_fmt(common-msg-objs)
target_include_directories(common-msg-objs PRIVATE ${OPENSSL_INCLUDE_DIR})
if(WITH_DPDK)
diff --git a/src/neorados/CMakeLists.txt b/src/neorados/CMakeLists.txt
index 50272374d2b..8695b48f0f9 100644
--- a/src/neorados/CMakeLists.txt
+++ b/src/neorados/CMakeLists.txt
@@ -1,7 +1,9 @@
add_library(neorados_objs OBJECT
RADOSImpl.cc)
+compile_with_fmt(neorados_objs)
add_library(neorados_api_obj OBJECT
RADOS.cc)
+compile_with_fmt(neorados_api_obj)
add_library(libneorados STATIC
$<TARGET_OBJECTS:neorados_api_obj>
diff --git a/src/osd/CMakeLists.txt b/src/osd/CMakeLists.txt
index 0d0ca63b347..373456fc65d 100644
--- a/src/osd/CMakeLists.txt
+++ b/src/osd/CMakeLists.txt
@@ -50,7 +50,7 @@ endif()
add_library(osd STATIC ${osd_srcs})
target_link_libraries(osd
PUBLIC dmclock::dmclock Boost::MPL
- PRIVATE os heap_profiler cpu_profiler ${CMAKE_DL_LIBS})
+ PRIVATE os heap_profiler cpu_profiler fmt::fmt ${CMAKE_DL_LIBS})
if(WITH_LTTNG)
add_dependencies(osd osd-tp pg-tp)
endif()
diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt
index 1a92898c571..fdfde4f34ef 100644
--- a/src/tools/CMakeLists.txt
+++ b/src/tools/CMakeLists.txt
@@ -20,7 +20,7 @@ if(NOT WIN32)
set(neorados_srcs
neorados.cc)
add_executable(neorados ${neorados_srcs})
- target_link_libraries(neorados libneorados spawn ${CMAKE_DL_LIBS})
+ target_link_libraries(neorados libneorados spawn fmt::fmt ${CMAKE_DL_LIBS})
#install(TARGETS neorados DESTINATION bin)
endif()
--
2.31.1

@ -1,40 +0,0 @@
From 84b4c8fbff60f534ce14db050b321b8c7c62f7dd Mon Sep 17 00:00:00 2001
From: Kefu Chai <kchai@redhat.com>
Date: Fri, 23 Jul 2021 18:02:36 +0800
Subject: [PATCH 3/3] ceph.spec.in: build with header only fmt on RHEL
because fmt is packaged in EPEL, while librados is packaged
in RHEL, so we cannot have fmt as a runtime dependency of librados.
to address this issue, we should compile librados either with static library
or with header-only library of fmt. but because the fedora packaging
guideline does no encourage us to package static libraries, and it would
be complicated to package both static and dynamic library for fmt.
the simpler solution would be to compile Ceph with the header-only
version of fmt.
in this change, we compile ceph with the header-only version of fmt
on RHEL to address the runtime dependency issue.
Signed-off-by: Kefu Chai <kchai@redhat.com>
---
ceph.spec.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ceph.spec.in b/ceph.spec.in
index 718421ca901..fd7ebe92d8b 100644
--- a/ceph.spec.in
+++ b/ceph.spec.in
@@ -1335,6 +1335,9 @@ ${CMAKE} .. \
-DWITH_SYSTEM_PMDK:BOOL=ON \
%endif
-DBOOST_J=$CEPH_SMP_NCPUS \
+%if 0%{?rhel}
+ -DWITH_FMT_HEADER_ONLY:BOOL=ON \
+%endif
-DWITH_GRAFANA=ON
%if %{with cmake_verbose_logging}
--
2.31.1

@ -1,32 +0,0 @@
From 1207906fcf005812f1d861e7bf577a1dc2d1e053 Mon Sep 17 00:00:00 2001
From: Boris Ranto <branto@redhat.com>
Date: Thu, 5 Aug 2021 15:59:39 +0200
Subject: [PATCH] cmake: link bundled fmt statically
instead of building the bundled fmt library as shared library, built
static library. otherwise we'd have to link against libfmt.so.
Signed-off-by: Kefu Chai <kchai@redhat.com>
---
src/CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c4d73633ed8..b1a9001e744 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -310,7 +310,11 @@ if(fmt_FOUND)
include_directories(SYSTEM "${fmt_INCLUDE_DIR}")
else()
message(STATUS "Could not find fmt, will build it")
+ set(old_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
+ set(BUILD_SHARED_LIBS FALSE)
add_subdirectory(fmt)
+ set(BUILD_SHARED_LIBS ${old_BUILD_SHARED_LIBS})
+ unset(old_BUILD_SHARED_LIBS)
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/src/fmt/include")
endif()
--
2.31.1

@ -0,0 +1,23 @@
--- ceph-16.2.6-681-gfdc003bc/src/tracing/bluestore.tp.orig 2021-12-07 08:02:04.682972474 -0500
+++ ceph-16.2.6-681-gfdc003bc/src/tracing/bluestore.tp 2021-12-07 08:03:13.840771852 -0500
@@ -1,3 +1,9 @@
+
+#ifdef __x86_64__
+#undef STAP_SDT_ARG_CONSTRAINT
+#define STAP_SDT_ARG_CONSTRAINT norx
+#endif
+
#include "include/int_types.h"
TRACEPOINT_EVENT(bluestore, transaction_state_duration,
--- ceph-16.2.6-681-gfdc003bc/src/tracing/librbd.tp.orig 2021-12-07 09:50:16.467579483 -0500
+++ ceph-16.2.6-681-gfdc003bc/src/tracing/librbd.tp 2021-12-07 09:50:47.620026940 -0500
@@ -1,3 +1,8 @@
+#ifdef __x86_64__
+#undef STAP_SDT_ARG_CONSTRAINT
+#define STAP_SDT_ARG_CONSTRAINT norx
+#endif
+
#include "tracing/tracing-common.h"
#include "include/rbd/librbd.h"
#include "include/int_types.h"

@ -0,0 +1,42 @@
--- ceph-16.2.7/src/common/LogEntry.cc.orig 2022-01-17 13:52:10.799134159 -0500
+++ ceph-16.2.7/src/common/LogEntry.cc 2022-01-17 13:52:47.244469274 -0500
@@ -183,7 +183,7 @@
return "crit";
default:
ceph_abort();
- return 0;
+ return "";
}
}
--- ceph-16.2.7/src/test/librados/tier_cxx.cc.orig 2022-01-19 09:30:47.209459506 -0500
+++ ceph-16.2.7/src/test/librados/tier_cxx.cc 2022-01-19 10:02:47.783240298 -0500
@@ -120,7 +120,7 @@
}
void check_fp_oid_refcount(librados::IoCtx& ioctx, std::string foid, uint64_t count,
- std::string fp_algo = NULL)
+ std::string fp_algo = "")
{
bufferlist t;
int size = foid.length();
@@ -148,7 +148,7 @@
ASSERT_LE(count, refs.count());
}
-string get_fp_oid(string oid, std::string fp_algo = NULL)
+string get_fp_oid(string oid, std::string fp_algo = "")
{
if (fp_algo == "sha1") {
unsigned char fingerprint[CEPH_CRYPTO_SHA1_DIGESTSIZE + 1];
--- ceph-17.0.0-10335-gfd206722/src/s3select/include/s3select_functions.h.orig 2022-02-11 17:21:40.268627997 -0500
+++ ceph-17.0.0-10335-gfd206722/src/s3select/include/s3select_functions.h 2022-02-11 17:21:57.155325437 -0500
@@ -466,7 +466,7 @@
std::string print(int ident) override
{
- return std::string(0);
+ return std::string("");
}
void push_argument(base_statement* arg)

@ -0,0 +1,19 @@
--- ceph-18.0.0-3078-gc4847bf8/src/rgw/driver/dbstore/CMakeLists.txt.orig 2023-05-10 08:23:50.000000000 -0400
+++ ceph-18.0.0-3078-gc4847bf8/src/rgw/driver/dbstore/CMakeLists.txt 2023-05-11 08:21:13.794152904 -0400
@@ -24,7 +24,7 @@
dbstore_mgr.cc
)
-add_library(dbstore_lib ${dbstore_srcs})
+add_library(dbstore_lib STATIC ${dbstore_srcs})
target_include_directories(dbstore_lib
PUBLIC "${CMAKE_SOURCE_DIR}/src/rgw"
PUBLIC "${CMAKE_SOURCE_DIR}/src/rgw/store/rados"
@@ -49,6 +49,7 @@
# add pthread library
set (CMAKE_LINK_LIBRARIES ${CMAKE_LINK_LIBRARIES} pthread)
+set (CMAKE_LINK_LIBRARIES ${CMAKE_LINK_LIBRARIES} global)
find_package(gtest QUIET)
if(WITH_TESTS)

@ -0,0 +1,11 @@
--- ceph-17.1.0-175-g086c8f84/src/arrow/cpp/cmake_modules/ThirdpartyToolchain.cmake.orig 2022-04-08 11:27:53.593570634 -0400
+++ ceph-17.1.0-175-g086c8f84/src/arrow/cpp/cmake_modules/ThirdpartyToolchain.cmake 2022-04-08 11:28:20.778087653 -0400
@@ -1991,7 +1991,7 @@
if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE") OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE"
))
- set(xsimd_SOURCE "BUNDLED")
+ set(xsimd_SOURCE "SYSTEM")
resolve_dependency(xsimd)
# TODO: Don't use global includes but rather target_include_directories
include_directories(SYSTEM ${XSIMD_INCLUDE_DIR})

@ -0,0 +1,42 @@
--- ceph-18.1.2/src/common/subsys_types.h.orig 2023-06-27 15:59:59.000000000 -0400
+++ ceph-18.1.2/src/common/subsys_types.h 2023-07-04 19:36:55.941238973 -0400
@@ -54,7 +54,7 @@
#undef DEFAULT_SUBSYS
}
-constexpr static std::uint8_t
+constexpr static uint8_t
ceph_subsys_get_max_default_level(const std::size_t subidx) {
const auto item = ceph_subsys_get_as_array()[subidx];
return std::max(item.log_level, item.gather_level);
--- ceph-18.1.2/src/msg/async/crypto_onwire.h.orig 2023-06-27 15:59:59.000000000 -0400
+++ ceph-18.1.2/src/msg/async/crypto_onwire.h 2023-07-04 19:36:55.957238704 -0400
@@ -95,7 +95,7 @@
// Transmitter can append extra bytes of ciphertext at the -final step.
// This method return how much was added, and thus let client translate
// plaintext size into ciphertext size to grab from wire.
- virtual std::uint32_t get_extra_size_at_final() = 0;
+ virtual uint32_t get_extra_size_at_final() = 0;
// Instance of RxHandler must be reset before doing any decrypt-update
// step. This applies also to situation when decrypt-final was already
--- ceph-18.1.2/src/rocksdb/table/block_based/data_block_hash_index.h.orig 2023-05-24 15:55:23.000000000 -0400
+++ ceph-18.1.2/src/rocksdb/table/block_based/data_block_hash_index.h 2023-07-04 19:36:55.971238469 -0400
@@ -8,6 +8,7 @@
#include <cstdint>
#include <string>
#include <vector>
+#include <cstdint>
#include "rocksdb/slice.h"
--- ceph-18.1.2/src/rocksdb/util/string_util.h.orig 2023-05-24 15:55:23.000000000 -0400
+++ ceph-18.1.2/src/rocksdb/util/string_util.h 2023-07-04 19:36:55.991238133 -0400
@@ -11,6 +11,7 @@
#include <string>
#include <unordered_map>
#include <vector>
+#include <cstdint>
#include "rocksdb/rocksdb_namespace.h"

@ -0,0 +1,17 @@
--- ceph-18.0.0-2726-g7cea3740/src/rgw/rgw_amqp.cc.orig 2023-03-14 18:22:35.636864260 -0400
+++ ceph-18.0.0-2726-g7cea3740/src/rgw/rgw_amqp.cc 2023-03-14 18:24:36.362756771 -0400
@@ -2,10 +2,10 @@
// vim: ts=8 sw=2 smarttab ft=cpp
#include "rgw_amqp.h"
-#include <amqp.h>
-#include <amqp_ssl_socket.h>
-#include <amqp_tcp_socket.h>
-#include <amqp_framing.h>
+#include <rabbitmq-c/amqp.h>
+#include <rabbitmq-c/ssl_socket.h>
+#include <rabbitmq-c/tcp_socket.h>
+#include <rabbitmq-c/framing.h>
#include "include/ceph_assert.h"
#include <sstream>
#include <cstring>

@ -0,0 +1,61 @@
--- ceph-18.0.0-2726-g7cea3740/src/rgw/rgw_asio_client.cc.orig 2023-03-14 18:46:02.037195570 -0400
+++ ceph-18.0.0-2726-g7cea3740/src/rgw/rgw_asio_client.cc 2023-03-14 18:55:14.446438244 -0400
@@ -39,11 +39,13 @@
const auto& value = header->value();
if (field == beast::http::field::content_length) {
- env.set("CONTENT_LENGTH", value.to_string());
+ std::string scratch{value.data(), value.size()};
+ env.set("CONTENT_LENGTH", scratch.c_str());
continue;
}
if (field == beast::http::field::content_type) {
- env.set("CONTENT_TYPE", value.to_string());
+ std::string scratch{value.data(), value.size()};
+ env.set("CONTENT_TYPE", scratch.c_str());
continue;
}
@@ -62,26 +64,37 @@
}
*dest = '\0';
- env.set(buf, value.to_string());
+ std::string scratch{value.data(), value.size()};
+ env.set(buf, scratch.c_str());
}
int major = request.version() / 10;
int minor = request.version() % 10;
env.set("HTTP_VERSION", std::to_string(major) + '.' + std::to_string(minor));
- env.set("REQUEST_METHOD", request.method_string().to_string());
+ {
+ std::string scratch {request.method_string().data(),request.method_string().size()};
+ env.set("REQUEST_METHOD", scratch.c_str());
+ }
// split uri from query
auto uri = request.target();
auto pos = uri.find('?');
if (pos != uri.npos) {
auto query = uri.substr(pos + 1);
- env.set("QUERY_STRING", query.to_string());
+ std::string scratch{query.data(), query.size()};
+ env.set("QUERY_STRING", scratch.c_str());
uri = uri.substr(0, pos);
}
- env.set("SCRIPT_URI", uri.to_string());
+ {
+ std::string scratch {uri.data(), uri.size()};
+ env.set("SCRIPT_URI", scratch.c_str());
+ }
- env.set("REQUEST_URI", request.target().to_string());
+ {
+ std::string scratch {request.target().data(), request.target().size()};
+ env.set("REQUEST_URI", scratch.c_str());
+ }
char port_buf[16];
snprintf(port_buf, sizeof(port_buf), "%d", local_endpoint.port());

@ -0,0 +1,24 @@
--- ceph-18.0.0-2950-g1c931bc4/cmake/modules/BuildBoost.cmake.orig 2023-04-28 18:30:19.133064577 -0400
+++ ceph-18.0.0-2950-g1c931bc4/cmake/modules/BuildBoost.cmake 2023-04-28 18:31:55.290354383 -0400
@@ -104,12 +104,21 @@
set(user_config ${CMAKE_BINARY_DIR}/user-config.jam)
# edit the user-config.jam so b2 will be able to use the specified
# toolset and python
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+ file(WRITE ${user_config}
+ "using ${toolset}"
+ " : "
+ " : ${CMAKE_CXX_COMPILER}"
+ " : <compileflags>-fPIC <compileflags>-w <compileflags>-fcf-protection <compileflags>-Wno-everything"
+ " ;\n")
+else()
file(WRITE ${user_config}
"using ${toolset}"
" : "
" : ${CMAKE_CXX_COMPILER}"
" : <compileflags>-fPIC <compileflags>-w <compileflags>-Wno-everything"
" ;\n")
+endif()
if(with_python_version)
find_package(Python3 ${with_python_version} QUIET REQUIRED
COMPONENTS Development)

@ -0,0 +1,61 @@
--- ceph-17.2.6/src/boost/libs/context/src/asm/make_x86_64_sysv_elf_gas.S.orig 2023-04-30 14:25:35.009605033 -0400
+++ ceph-17.2.6/src/boost/libs/context/src/asm/make_x86_64_sysv_elf_gas.S 2023-04-30 14:28:32.239465067 -0400
@@ -80,3 +80,18 @@
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
+
+.section .note.gnu.property
+.align=8
+
+ .byte 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00
+ .byte 0x05, 0x00, 0x00, 0x00, 0x47, 0x4E, 0x55, 0x00
+ .byte 0x00, 0x00, 0x00, 0xC0, 0x04, 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ .byte 0x01, 0x00, 0x00, 0xC0, 0x04, 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ .byte 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00
+ .byte 0x05, 0x00, 0x00, 0x00, 0x47, 0x4E, 0x55, 0x00
+ .byte 0x02, 0x00, 0x00, 0xC0, 0x04, 0x00, 0x00, 0x00
+ .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+
--- ceph-17.2.6/src/boost/libs/context/src/asm/jump_x86_64_sysv_elf_gas.S.orig 2023-04-30 14:25:35.008605050 -0400
+++ ceph-17.2.6/src/boost/libs/context/src/asm/jump_x86_64_sysv_elf_gas.S 2023-04-30 14:27:50.145210847 -0400
@@ -89,3 +89,17 @@
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
+
+.section .note.gnu.property
+.align=8
+
+ .byte 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00
+ .byte 0x05, 0x00, 0x00, 0x00, 0x47, 0x4E, 0x55, 0x00
+ .byte 0x00, 0x00, 0x00, 0xC0, 0x04, 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ .byte 0x01, 0x00, 0x00, 0xC0, 0x04, 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ .byte 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00
+ .byte 0x05, 0x00, 0x00, 0x00, 0x47, 0x4E, 0x55, 0x00
+ .byte 0x02, 0x00, 0x00, 0xC0, 0x04, 0x00, 0x00, 0x00
+ .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
--- ceph-17.2.6/src/boost/libs/context/src/asm/ontop_x86_64_sysv_elf_gas.S.orig 2023-04-30 14:25:35.009605033 -0400
+++ ceph-17.2.6/src/boost/libs/context/src/asm/ontop_x86_64_sysv_elf_gas.S 2023-04-30 14:29:30.402434597 -0400
@@ -92,3 +92,17 @@
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
+
+.section .note.gnu.property
+.align=8
+
+ .byte 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00
+ .byte 0x05, 0x00, 0x00, 0x00, 0x47, 0x4E, 0x55, 0x00
+ .byte 0x00, 0x00, 0x00, 0xC0, 0x04, 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ .byte 0x01, 0x00, 0x00, 0xC0, 0x04, 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ .byte 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00
+ .byte 0x05, 0x00, 0x00, 0x00, 0x47, 0x4E, 0x55, 0x00
+ .byte 0x02, 0x00, 0x00, 0xC0, 0x04, 0x00, 0x00, 0x00
+ .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

@ -0,0 +1,24 @@
--- ceph-18.1.2/src/pybind/rbd/rbd.pyx.orig 2023-07-21 13:30:08.156825317 -0400
+++ ceph-18.1.2/src/pybind/rbd/rbd.pyx 2023-07-24 09:09:27.930137117 -0400
@@ -371,10 +371,10 @@
cdef rados_ioctx_t convert_ioctx(rados.Ioctx ioctx) except? NULL:
return <rados_ioctx_t>ioctx.io
-cdef int progress_callback(uint64_t offset, uint64_t total, void* ptr) with gil:
+cdef int progress_callback(uint64_t offset, uint64_t total, void* ptr) noexcept with gil:
return (<object>ptr)(offset, total)
-cdef int no_op_progress_callback(uint64_t offset, uint64_t total, void* ptr):
+cdef int no_op_progress_callback(uint64_t offset, uint64_t total, void* ptr) noexcept:
return 0
def cstr(val, name, encoding="utf-8", opt=False):
@@ -426,7 +426,7 @@
cdef class Completion
-cdef void __aio_complete_cb(rbd_completion_t completion, void *args) with gil:
+cdef void __aio_complete_cb(rbd_completion_t completion, void *args) noexcept with gil:
"""
Callback to oncomplete() for asynchronous operations
"""

@ -0,0 +1,18 @@
--- ceph/src/CMakeLists.txt.orig 2023-11-01 11:53:53.618167190 -0400
+++ ceph/src/CMakeLists.txt 2023-11-01 13:52:51.292643490 -0400
@@ -625,6 +625,7 @@
add_subdirectory(perfglue)
add_library(rados_snap_set_diff_obj OBJECT librados/snap_set_diff.cc)
+add_dependencies(rados_snap_set_diff_obj legacy-option-headers)
option(WITH_LIBRADOSSTRIPER "build with libradosstriper support" ON)
@@ -881,6 +882,7 @@
add_library(krbd STATIC krbd.cc
$<TARGET_OBJECTS:parse_secret_objs>)
target_link_libraries(krbd keyutils::keyutils)
+ add_dependencies(krbd legacy-option-headers)
endif()
add_subdirectory(librbd)
if(WITH_FUSE)

@ -0,0 +1,986 @@
diff -ur ceph-18.2.1~/debian/changelog ceph-18.2.1/debian/changelog
--- ceph-18.2.1~/debian/changelog 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/debian/changelog 2023-12-11 16:55:38.000000000 -0500
@@ -2,7 +2,7 @@
* New upstream release
- -- Ceph Release Team <ceph-maintainers@ceph.io> Tue, 14 Nov 2023 19:36:16 +0000
+ -- Ceph Release Team <ceph-maintainers@ceph.io> Mon, 11 Dec 2023 21:55:36 +0000
ceph (18.2.0-1) stable; urgency=medium
diff -ur ceph-18.2.1~/doc/architecture.rst ceph-18.2.1/doc/architecture.rst
--- ceph-18.2.1~/doc/architecture.rst 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/doc/architecture.rst 2023-12-11 16:55:38.000000000 -0500
@@ -30,6 +30,8 @@
- :term:`Ceph Manager`
- :term:`Ceph Metadata Server`
+.. _arch_monitor:
+
Ceph Monitors maintain the master copy of the cluster map, which they provide
to Ceph clients. Provisioning multiple monitors within the Ceph cluster ensures
availability in the event that one of the monitor daemons or its host fails.
diff -ur ceph-18.2.1~/doc/glossary.rst ceph-18.2.1/doc/glossary.rst
--- ceph-18.2.1~/doc/glossary.rst 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/doc/glossary.rst 2023-12-11 16:55:38.000000000 -0500
@@ -271,7 +271,7 @@
The Ceph manager software, which collects all the state from
the whole cluster in one place.
- MON
+ :ref:`MON<arch_monitor>`
The Ceph monitor software.
Node
@@ -337,6 +337,12 @@
Firefly (v. 0.80). See :ref:`Primary Affinity
<rados_ops_primary_affinity>`.
+ Quorum
+ Quorum is the state that exists when a majority of the
+ :ref:`Monitors<arch_monitor>` in the cluster are ``up``. A
+ minimum of three :ref:`Monitors<arch_monitor>` must exist in
+ the cluster in order for Quorum to be possible.
+
RADOS
**R**\eliable **A**\utonomic **D**\istributed **O**\bject
**S**\tore. RADOS is the object store that provides a scalable
diff -ur ceph-18.2.1~/doc/rados/troubleshooting/troubleshooting-mon.rst ceph-18.2.1/doc/rados/troubleshooting/troubleshooting-mon.rst
--- ceph-18.2.1~/doc/rados/troubleshooting/troubleshooting-mon.rst 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/doc/rados/troubleshooting/troubleshooting-mon.rst 2023-12-11 16:55:38.000000000 -0500
@@ -17,59 +17,66 @@
Initial Troubleshooting
=======================
-#. **Make sure that the monitors are running.**
+The first steps in the process of troubleshooting Ceph Monitors involve making
+sure that the Monitors are running and that they are able to communicate with
+the network and on the network. Follow the steps in this section to rule out
+the simplest causes of Monitor malfunction.
+
+#. **Make sure that the Monitors are running.**
+
+ Make sure that the Monitor (*mon*) daemon processes (``ceph-mon``) are
+ running. It might be the case that the mons have not be restarted after an
+ upgrade. Checking for this simple oversight can save hours of painstaking
+ troubleshooting.
+
+ It is also important to make sure that the manager daemons (``ceph-mgr``)
+ are running. Remember that typical cluster configurations provide one
+ Manager (``ceph-mgr``) for each Monitor (``ceph-mon``).
- First, make sure that the monitor (*mon*) daemon processes (``ceph-mon``)
- are running. Sometimes Ceph admins either forget to start the mons or
- forget to restart the mons after an upgrade. Checking for this simple
- oversight can save hours of painstaking troubleshooting. It is also
- important to make sure that the manager daemons (``ceph-mgr``) are running.
- Remember that typical cluster configurations provide one ``ceph-mgr`` for
- each ``ceph-mon``.
+ .. note:: In releases prior to v1.12.5, Rook will not run more than two
+ managers.
- .. note:: Rook will not run more than two managers.
+#. **Make sure that you can reach the Monitor nodes.**
-#. **Make sure that you can reach the monitor nodes.**
-
- In certain rare cases, there may be ``iptables`` rules that block access to
- monitor nodes or TCP ports. These rules might be left over from earlier
+ In certain rare cases, ``iptables`` rules might be blocking access to
+ Monitor nodes or TCP ports. These rules might be left over from earlier
stress testing or rule development. To check for the presence of such
- rules, SSH into the server and then try to connect to the monitor's ports
- (``tcp/3300`` and ``tcp/6789``) using ``telnet``, ``nc``, or a similar
- tool.
-
-#. **Make sure that the ``ceph status`` command runs and receives a reply from the cluster.**
-
- If the ``ceph status`` command does receive a reply from the cluster, then
- the cluster is up and running. The monitors will answer to a ``status``
- request only if there is a formed quorum. Confirm that one or more ``mgr``
- daemons are reported as running. Under ideal conditions, all ``mgr``
- daemons will be reported as running.
-
+ rules, SSH into each Monitor node and use ``telnet`` or ``nc`` or a similar
+ tool to attempt to connect to each of the other Monitor nodes on ports
+ ``tcp/3300`` and ``tcp/6789``.
+
+#. **Make sure that the "ceph status" command runs and receives a reply from the cluster.**
+
+ If the ``ceph status`` command receives a reply from the cluster, then the
+ cluster is up and running. Monitors answer to a ``status`` request only if
+ there is a formed quorum. Confirm that one or more ``mgr`` daemons are
+ reported as running. In a cluster with no deficiencies, ``ceph status``
+ will report that all ``mgr`` daemons are running.
If the ``ceph status`` command does not receive a reply from the cluster,
- then there are probably not enough monitors ``up`` to form a quorum. The
- ``ceph -s`` command with no further options specified connects to an
- arbitrarily selected monitor. In certain cases, however, it might be
- helpful to connect to a specific monitor (or to several specific monitors
+ then there are probably not enough Monitors ``up`` to form a quorum. If the
+ ``ceph -s`` command is run with no further options specified, it connects
+ to an arbitrarily selected Monitor. In certain cases, however, it might be
+ helpful to connect to a specific Monitor (or to several specific Monitors
in sequence) by adding the ``-m`` flag to the command: for example, ``ceph
status -m mymon1``.
#. **None of this worked. What now?**
If the above solutions have not resolved your problems, you might find it
- helpful to examine each individual monitor in turn. Whether or not a quorum
- has been formed, it is possible to contact each monitor individually and
+ helpful to examine each individual Monitor in turn. Even if no quorum has
+ been formed, it is possible to contact each Monitor individually and
request its status by using the ``ceph tell mon.ID mon_status`` command
- (here ``ID`` is the monitor's identifier).
+ (here ``ID`` is the Monitor's identifier).
- Run the ``ceph tell mon.ID mon_status`` command for each monitor in the
+ Run the ``ceph tell mon.ID mon_status`` command for each Monitor in the
cluster. For more on this command's output, see :ref:`Understanding
mon_status
<rados_troubleshoting_troubleshooting_mon_understanding_mon_status>`.
- There is also an alternative method: SSH into each monitor node and query
- the daemon's admin socket. See :ref:`Using the Monitor's Admin
+ There is also an alternative method for contacting each individual Monitor:
+ SSH into each Monitor node and query the daemon's admin socket. See
+ :ref:`Using the Monitor's Admin
Socket<rados_troubleshoting_troubleshooting_mon_using_admin_socket>`.
.. _rados_troubleshoting_troubleshooting_mon_using_admin_socket:
diff -ur ceph-18.2.1~/qa/tasks/cephfs/kernel_mount.py ceph-18.2.1/qa/tasks/cephfs/kernel_mount.py
--- ceph-18.2.1~/qa/tasks/cephfs/kernel_mount.py 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/qa/tasks/cephfs/kernel_mount.py 2023-12-11 16:55:38.000000000 -0500
@@ -68,7 +68,10 @@
self.enable_dynamic_debug()
self.ctx[f'kmount_count.{self.client_remote.hostname}'] = kmount_count + 1
- self.gather_mount_info()
+ try:
+ self.gather_mount_info()
+ except:
+ log.warn('failed to fetch mount info - tests depending on mount addr/inst may fail!')
def gather_mount_info(self):
self.id = self._get_global_id()
diff -ur ceph-18.2.1~/qa/tasks/cephfs/mount.py ceph-18.2.1/qa/tasks/cephfs/mount.py
--- ceph-18.2.1~/qa/tasks/cephfs/mount.py 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/qa/tasks/cephfs/mount.py 2023-12-11 16:55:38.000000000 -0500
@@ -186,6 +186,12 @@
sudo=True).decode())
def is_blocked(self):
+ if not self.addr:
+ # can't infer if our addr is blocklisted - let the caller try to
+ # umount without lazy/force. If the client was blocklisted, then
+ # the umount would be stuck and the test would fail on timeout.
+ # happens only with Ubuntu 20.04 (missing kclient patches :/).
+ return False
self.fs = Filesystem(self.ctx, name=self.cephfs_name)
try:
diff -ur ceph-18.2.1~/src/ceph-volume/ceph_volume/devices/raw/list.py ceph-18.2.1/src/ceph-volume/ceph_volume/devices/raw/list.py
--- ceph-18.2.1~/src/ceph-volume/ceph_volume/devices/raw/list.py 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/src/ceph-volume/ceph_volume/devices/raw/list.py 2023-12-11 16:55:38.000000000 -0500
@@ -5,7 +5,7 @@
from textwrap import dedent
from ceph_volume import decorators, process
from ceph_volume.util import disk
-
+from typing import Any, Dict, List
logger = logging.getLogger(__name__)
@@ -66,50 +66,57 @@
def __init__(self, argv):
self.argv = argv
+ def is_atari_partitions(self, _lsblk: Dict[str, Any]) -> bool:
+ dev = _lsblk['NAME']
+ if _lsblk.get('PKNAME'):
+ parent = _lsblk['PKNAME']
+ try:
+ if disk.has_bluestore_label(parent):
+ logger.warning(('ignoring child device {} whose parent {} is a BlueStore OSD.'.format(dev, parent),
+ 'device is likely a phantom Atari partition. device info: {}'.format(_lsblk)))
+ return True
+ except OSError as e:
+ logger.error(('ignoring child device {} to avoid reporting invalid BlueStore data from phantom Atari partitions.'.format(dev),
+ 'failed to determine if parent device {} is BlueStore. err: {}'.format(parent, e)))
+ return True
+ return False
+
+ def exclude_atari_partitions(self, _lsblk_all: Dict[str, Any]) -> List[Dict[str, Any]]:
+ return [_lsblk for _lsblk in _lsblk_all if not self.is_atari_partitions(_lsblk)]
+
def generate(self, devs=None):
logger.debug('Listing block devices via lsblk...')
- info_devices = disk.lsblk_all(abspath=True)
+ info_devices = []
if not devs or not any(devs):
# If no devs are given initially, we want to list ALL devices including children and
# parents. Parent disks with child partitions may be the appropriate device to return if
# the parent disk has a bluestore header, but children may be the most appropriate
# devices to return if the parent disk does not have a bluestore header.
+ info_devices = disk.lsblk_all(abspath=True)
devs = [device['NAME'] for device in info_devices if device.get('NAME',)]
+ else:
+ for dev in devs:
+ info_devices.append(disk.lsblk(dev, abspath=True))
+
+ # Linux kernels built with CONFIG_ATARI_PARTITION enabled can falsely interpret
+ # bluestore's on-disk format as an Atari partition table. These false Atari partitions
+ # can be interpreted as real OSDs if a bluestore OSD was previously created on the false
+ # partition. See https://tracker.ceph.com/issues/52060 for more info. If a device has a
+ # parent, it is a child. If the parent is a valid bluestore OSD, the child will only
+ # exist if it is a phantom Atari partition, and the child should be ignored. If the
+ # parent isn't bluestore, then the child could be a valid bluestore OSD. If we fail to
+ # determine whether a parent is bluestore, we should err on the side of not reporting
+ # the child so as not to give a false negative.
+ info_devices = self.exclude_atari_partitions(info_devices)
result = {}
logger.debug('inspecting devices: {}'.format(devs))
- for dev in devs:
- # Linux kernels built with CONFIG_ATARI_PARTITION enabled can falsely interpret
- # bluestore's on-disk format as an Atari partition table. These false Atari partitions
- # can be interpreted as real OSDs if a bluestore OSD was previously created on the false
- # partition. See https://tracker.ceph.com/issues/52060 for more info. If a device has a
- # parent, it is a child. If the parent is a valid bluestore OSD, the child will only
- # exist if it is a phantom Atari partition, and the child should be ignored. If the
- # parent isn't bluestore, then the child could be a valid bluestore OSD. If we fail to
- # determine whether a parent is bluestore, we should err on the side of not reporting
- # the child so as not to give a false negative.
- matched_info_devices = [info for info in info_devices if info['NAME'] == dev]
- if not matched_info_devices:
- logger.warning('device {} does not exist'.format(dev))
- continue
- info_device = matched_info_devices[0]
- if 'PKNAME' in info_device and info_device['PKNAME'] != "":
- parent = info_device['PKNAME']
- try:
- if disk.has_bluestore_label(parent):
- logger.warning(('ignoring child device {} whose parent {} is a BlueStore OSD.'.format(dev, parent),
- 'device is likely a phantom Atari partition. device info: {}'.format(info_device)))
- continue
- except OSError as e:
- logger.error(('ignoring child device {} to avoid reporting invalid BlueStore data from phantom Atari partitions.'.format(dev),
- 'failed to determine if parent device {} is BlueStore. err: {}'.format(parent, e)))
- continue
-
- bs_info = _get_bluestore_info(dev)
+ for info_device in info_devices:
+ bs_info = _get_bluestore_info(info_device['NAME'])
if bs_info is None:
# None is also returned in the rare event that there is an issue reading info from
# a BlueStore disk, so be sure to log our assumption that it isn't bluestore
- logger.info('device {} does not have BlueStore information'.format(dev))
+ logger.info('device {} does not have BlueStore information'.format(info_device['NAME']))
continue
uuid = bs_info['osd_uuid']
if uuid not in result:
diff -ur ceph-18.2.1~/src/ceph-volume/ceph_volume/tests/util/test_disk.py ceph-18.2.1/src/ceph-volume/ceph_volume/tests/util/test_disk.py
--- ceph-18.2.1~/src/ceph-volume/ceph_volume/tests/util/test_disk.py 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/src/ceph-volume/ceph_volume/tests/util/test_disk.py 2023-12-11 16:55:38.000000000 -0500
@@ -1,7 +1,37 @@
import os
import pytest
from ceph_volume.util import disk
-from mock.mock import patch
+from mock.mock import patch, MagicMock
+
+
+class TestFunctions:
+ @patch('ceph_volume.util.disk.os.path.exists', MagicMock(return_value=False))
+ def test_is_device_path_does_not_exist(self):
+ assert not disk.is_device('/dev/foo')
+
+ @patch('ceph_volume.util.disk.os.path.exists', MagicMock(return_value=True))
+ def test_is_device_dev_doesnt_startswith_dev(self):
+ assert not disk.is_device('/foo')
+
+ @patch('ceph_volume.util.disk.allow_loop_devices', MagicMock(return_value=False))
+ @patch('ceph_volume.util.disk.os.path.exists', MagicMock(return_value=True))
+ def test_is_device_loop_not_allowed(self):
+ assert not disk.is_device('/dev/loop123')
+
+ @patch('ceph_volume.util.disk.lsblk', MagicMock(return_value={'NAME': 'foo', 'TYPE': 'disk'}))
+ @patch('ceph_volume.util.disk.os.path.exists', MagicMock(return_value=True))
+ def test_is_device_type_disk(self):
+ assert disk.is_device('/dev/foo')
+
+ @patch('ceph_volume.util.disk.lsblk', MagicMock(return_value={'NAME': 'foo', 'TYPE': 'mpath'}))
+ @patch('ceph_volume.util.disk.os.path.exists', MagicMock(return_value=True))
+ def test_is_device_type_mpath(self):
+ assert disk.is_device('/dev/foo')
+
+ @patch('ceph_volume.util.disk.lsblk', MagicMock(return_value={'NAME': 'foo1', 'TYPE': 'part'}))
+ @patch('ceph_volume.util.disk.os.path.exists', MagicMock(return_value=True))
+ def test_is_device_type_part(self):
+ assert not disk.is_device('/dev/foo1')
class TestLsblkParser(object):
diff -ur ceph-18.2.1~/src/ceph-volume/ceph_volume/util/disk.py ceph-18.2.1/src/ceph-volume/ceph_volume/util/disk.py
--- ceph-18.2.1~/src/ceph-volume/ceph_volume/util/disk.py 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/src/ceph-volume/ceph_volume/util/disk.py 2023-12-11 16:55:38.000000000 -0500
@@ -359,6 +359,10 @@
if not allow_loop_devices():
return False
+ TYPE = lsblk(dev).get('TYPE')
+ if TYPE:
+ return TYPE in ['disk', 'mpath']
+
# fallback to stat
return _stat_is_device(os.lstat(dev).st_mode)
diff -ur ceph-18.2.1~/src/.git_version ceph-18.2.1/src/.git_version
--- ceph-18.2.1~/src/.git_version 2023-11-14 14:37:51.000000000 -0500
+++ ceph-18.2.1/src/.git_version 2023-12-11 16:57:17.000000000 -0500
@@ -1,2 +1,2 @@
-e3fce6809130d78ac0058fc87e537ecd926cd213
+7fe91d5d5842e04be3b4f514d6dd990c54b29c76
18.2.1
diff -ur ceph-18.2.1~/src/messages/MClientRequest.h ceph-18.2.1/src/messages/MClientRequest.h
--- ceph-18.2.1~/src/messages/MClientRequest.h 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/src/messages/MClientRequest.h 2023-12-11 16:55:38.000000000 -0500
@@ -234,6 +234,12 @@
copy_from_legacy_head(&head, &old_mds_head);
head.version = 0;
+ head.ext_num_retry = head.num_retry;
+ head.ext_num_fwd = head.num_fwd;
+
+ head.owner_uid = head.caller_uid;
+ head.owner_gid = head.caller_gid;
+
/* Can't set the btime from legacy struct */
if (head.op == CEPH_MDS_OP_SETATTR) {
int localmask = head.args.setattr.mask;
diff -ur ceph-18.2.1~/src/os/bluestore/AvlAllocator.cc ceph-18.2.1/src/os/bluestore/AvlAllocator.cc
--- ceph-18.2.1~/src/os/bluestore/AvlAllocator.cc 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/src/os/bluestore/AvlAllocator.cc 2023-12-11 16:55:38.000000000 -0500
@@ -39,7 +39,7 @@
uint64_t search_bytes = 0;
auto rs_start = range_tree.lower_bound(range_t{*cursor, size}, compare);
for (auto rs = rs_start; rs != range_tree.end(); ++rs) {
- uint64_t offset = p2roundup(rs->start, align);
+ uint64_t offset = rs->start;
*cursor = offset + size;
if (offset + size <= rs->end) {
return offset;
@@ -59,7 +59,7 @@
}
// If we reached end, start from beginning till cursor.
for (auto rs = range_tree.begin(); rs != rs_start; ++rs) {
- uint64_t offset = p2roundup(rs->start, align);
+ uint64_t offset = rs->start;
*cursor = offset + size;
if (offset + size <= rs->end) {
return offset;
@@ -82,7 +82,7 @@
const auto compare = range_size_tree.key_comp();
auto rs_start = range_size_tree.lower_bound(range_t{0, size}, compare);
for (auto rs = rs_start; rs != range_size_tree.end(); ++rs) {
- uint64_t offset = p2roundup(rs->start, align);
+ uint64_t offset = rs->start;
if (offset + size <= rs->end) {
return offset;
}
diff -ur ceph-18.2.1~/src/os/bluestore/BlueFS.cc ceph-18.2.1/src/os/bluestore/BlueFS.cc
--- ceph-18.2.1~/src/os/bluestore/BlueFS.cc 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/src/os/bluestore/BlueFS.cc 2023-12-11 16:55:38.000000000 -0500
@@ -658,16 +658,24 @@
}
logger->set(l_bluefs_wal_alloc_unit, wal_alloc_size);
+
+ uint64_t shared_alloc_size = cct->_conf->bluefs_shared_alloc_size;
+ if (shared_alloc && shared_alloc->a) {
+ uint64_t unit = shared_alloc->a->get_block_size();
+ shared_alloc_size = std::max(
+ unit,
+ shared_alloc_size);
+ ceph_assert(0 == p2phase(shared_alloc_size, unit));
+ }
if (bdev[BDEV_SLOW]) {
alloc_size[BDEV_DB] = cct->_conf->bluefs_alloc_size;
- alloc_size[BDEV_SLOW] = cct->_conf->bluefs_shared_alloc_size;
- logger->set(l_bluefs_db_alloc_unit, cct->_conf->bluefs_alloc_size);
- logger->set(l_bluefs_main_alloc_unit, cct->_conf->bluefs_shared_alloc_size);
+ alloc_size[BDEV_SLOW] = shared_alloc_size;
} else {
- alloc_size[BDEV_DB] = cct->_conf->bluefs_shared_alloc_size;
- logger->set(l_bluefs_main_alloc_unit, 0);
- logger->set(l_bluefs_db_alloc_unit, cct->_conf->bluefs_shared_alloc_size);
+ alloc_size[BDEV_DB] = shared_alloc_size;
+ alloc_size[BDEV_SLOW] = 0;
}
+ logger->set(l_bluefs_db_alloc_unit, alloc_size[BDEV_DB]);
+ logger->set(l_bluefs_main_alloc_unit, alloc_size[BDEV_SLOW]);
// new wal and db devices are never shared
if (bdev[BDEV_NEWWAL]) {
alloc_size[BDEV_NEWWAL] = cct->_conf->bluefs_alloc_size;
@@ -681,13 +689,13 @@
continue;
}
ceph_assert(bdev[id]->get_size());
- ceph_assert(alloc_size[id]);
if (is_shared_alloc(id)) {
dout(1) << __func__ << " shared, id " << id << std::hex
<< ", capacity 0x" << bdev[id]->get_size()
<< ", block size 0x" << alloc_size[id]
<< std::dec << dendl;
} else {
+ ceph_assert(alloc_size[id]);
std::string name = "bluefs-";
const char* devnames[] = { "wal","db","slow" };
if (id <= BDEV_SLOW)
diff -ur ceph-18.2.1~/src/os/bluestore/BtreeAllocator.cc ceph-18.2.1/src/os/bluestore/BtreeAllocator.cc
--- ceph-18.2.1~/src/os/bluestore/BtreeAllocator.cc 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/src/os/bluestore/BtreeAllocator.cc 2023-12-11 16:55:38.000000000 -0500
@@ -25,7 +25,7 @@
{
auto rs_start = range_tree.lower_bound(*cursor);
for (auto rs = rs_start; rs != range_tree.end(); ++rs) {
- uint64_t offset = p2roundup(rs->first, align);
+ uint64_t offset = rs->first;
if (offset + size <= rs->second) {
*cursor = offset + size;
return offset;
@@ -37,7 +37,7 @@
}
// If we reached end, start from beginning till cursor.
for (auto rs = range_tree.begin(); rs != rs_start; ++rs) {
- uint64_t offset = p2roundup(rs->first, align);
+ uint64_t offset = rs->first;
if (offset + size <= rs->second) {
*cursor = offset + size;
return offset;
@@ -53,7 +53,7 @@
// the needs
auto rs_start = range_size_tree.lower_bound(range_value_t{0,size});
for (auto rs = rs_start; rs != range_size_tree.end(); ++rs) {
- uint64_t offset = p2roundup(rs->start, align);
+ uint64_t offset = rs->start;
if (offset + size <= rs->start + rs->size) {
return offset;
}
diff -ur ceph-18.2.1~/src/os/bluestore/fastbmap_allocator_impl.cc ceph-18.2.1/src/os/bluestore/fastbmap_allocator_impl.cc
--- ceph-18.2.1~/src/os/bluestore/fastbmap_allocator_impl.cc 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/src/os/bluestore/fastbmap_allocator_impl.cc 2023-12-11 16:55:38.000000000 -0500
@@ -17,19 +17,9 @@
inline interval_t _align2units(uint64_t offset, uint64_t len, uint64_t min_length)
{
- interval_t res;
- if (len >= min_length) {
- res.offset = p2roundup(offset, min_length);
- auto delta_off = res.offset - offset;
- if (len > delta_off) {
- res.length = len - delta_off;
- res.length = p2align<uint64_t>(res.length, min_length);
- if (res.length) {
- return res;
- }
- }
- }
- return interval_t();
+ return len >= min_length ?
+ interval_t(offset, p2align<uint64_t>(len, min_length)) :
+ interval_t();
}
interval_t AllocatorLevel01Loose::_get_longest_from_l0(uint64_t pos0,
diff -ur ceph-18.2.1~/src/os/bluestore/StupidAllocator.cc ceph-18.2.1/src/os/bluestore/StupidAllocator.cc
--- ceph-18.2.1~/src/os/bluestore/StupidAllocator.cc 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/src/os/bluestore/StupidAllocator.cc 2023-12-11 16:55:38.000000000 -0500
@@ -52,20 +52,6 @@
}
}
-/// return the effective length of the extent if we align to alloc_unit
-uint64_t StupidAllocator::_aligned_len(
- StupidAllocator::interval_set_t::iterator p,
- uint64_t alloc_unit)
-{
- uint64_t skew = p.get_start() % alloc_unit;
- if (skew)
- skew = alloc_unit - skew;
- if (skew > p.get_len())
- return 0;
- else
- return p.get_len() - skew;
-}
-
int64_t StupidAllocator::allocate_int(
uint64_t want_size, uint64_t alloc_unit, int64_t hint,
uint64_t *offset, uint32_t *length)
@@ -89,7 +75,7 @@
for (bin = orig_bin; bin < (int)free.size(); ++bin) {
p = free[bin].lower_bound(hint);
while (p != free[bin].end()) {
- if (_aligned_len(p, alloc_unit) >= want_size) {
+ if (p.get_len() >= want_size) {
goto found;
}
++p;
@@ -102,7 +88,7 @@
p = free[bin].begin();
auto end = hint ? free[bin].lower_bound(hint) : free[bin].end();
while (p != end) {
- if (_aligned_len(p, alloc_unit) >= want_size) {
+ if (p.get_len() >= want_size) {
goto found;
}
++p;
@@ -114,7 +100,7 @@
for (bin = orig_bin; bin >= 0; --bin) {
p = free[bin].lower_bound(hint);
while (p != free[bin].end()) {
- if (_aligned_len(p, alloc_unit) >= alloc_unit) {
+ if (p.get_len() >= alloc_unit) {
goto found;
}
++p;
@@ -127,7 +113,7 @@
p = free[bin].begin();
auto end = hint ? free[bin].lower_bound(hint) : free[bin].end();
while (p != end) {
- if (_aligned_len(p, alloc_unit) >= alloc_unit) {
+ if (p.get_len() >= alloc_unit) {
goto found;
}
++p;
@@ -137,11 +123,9 @@
return -ENOSPC;
found:
- uint64_t skew = p.get_start() % alloc_unit;
- if (skew)
- skew = alloc_unit - skew;
- *offset = p.get_start() + skew;
- *length = std::min(std::max(alloc_unit, want_size), p2align((p.get_len() - skew), alloc_unit));
+ *offset = p.get_start();
+ *length = std::min(std::max(alloc_unit, want_size), p2align(p.get_len(), alloc_unit));
+
if (cct->_conf->bluestore_debug_small_allocations) {
uint64_t max =
alloc_unit * (rand() % cct->_conf->bluestore_debug_small_allocations);
@@ -158,7 +142,7 @@
free[bin].erase(*offset, *length);
uint64_t off, len;
- if (*offset && free[bin].contains(*offset - skew - 1, &off, &len)) {
+ if (*offset && free[bin].contains(*offset - 1, &off, &len)) {
int newbin = _choose_bin(len);
if (newbin != bin) {
ldout(cct, 30) << __func__ << " demoting 0x" << std::hex << off << "~" << len
diff -ur ceph-18.2.1~/src/os/bluestore/StupidAllocator.h ceph-18.2.1/src/os/bluestore/StupidAllocator.h
--- ceph-18.2.1~/src/os/bluestore/StupidAllocator.h 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/src/os/bluestore/StupidAllocator.h 2023-12-11 16:55:38.000000000 -0500
@@ -31,10 +31,6 @@
unsigned _choose_bin(uint64_t len);
void _insert_free(uint64_t offset, uint64_t len);
- uint64_t _aligned_len(
- interval_set_t::iterator p,
- uint64_t alloc_unit);
-
public:
StupidAllocator(CephContext* cct,
int64_t size,
diff -ur ceph-18.2.1~/src/test/objectstore/Allocator_test.cc ceph-18.2.1/src/test/objectstore/Allocator_test.cc
--- ceph-18.2.1~/src/test/objectstore/Allocator_test.cc 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/src/test/objectstore/Allocator_test.cc 2023-12-11 16:55:38.000000000 -0500
@@ -516,8 +516,7 @@
PExtentVector extents;
auto need = 0x3f980000;
auto got = alloc->allocate(need, 0x10000, 0, (int64_t)0, &extents);
- EXPECT_GT(got, 0);
- EXPECT_EQ(got, 0x630000);
+ EXPECT_GE(got, 0x630000);
}
TEST_P(AllocTest, test_alloc_50656_best_fit)
diff -ur ceph-18.2.1~/src/test/objectstore/fastbmap_allocator_test.cc ceph-18.2.1/src/test/objectstore/fastbmap_allocator_test.cc
--- ceph-18.2.1~/src/test/objectstore/fastbmap_allocator_test.cc 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/src/test/objectstore/fastbmap_allocator_test.cc 2023-12-11 16:55:38.000000000 -0500
@@ -625,6 +625,8 @@
ASSERT_EQ(bins_overall[cbits(num_chunks / 2) - 1], 1u);
{
+ // Original free space disposition (start chunk, count):
+ // <NC/2, NC/2>
size_t to_release = 2 * _1m + 0x1000;
// release 2M + 4K at the beginning
interval_vector_t r;
@@ -637,6 +639,8 @@
ASSERT_EQ(bins_overall[cbits(num_chunks / 2) - 1], 1u);
}
{
+ // Original free space disposition (start chunk, count):
+ // <0, 513>, <NC / 2, NC / 2>
// allocate 4K within the deallocated range
uint64_t allocated4 = 0;
interval_vector_t a4;
@@ -652,79 +656,91 @@
ASSERT_EQ(bins_overall[cbits(num_chunks / 2) - 1], 1u);
}
{
- // allocate 1M - should go to the second 1M chunk
+ // Original free space disposition (start chunk, count):
+ // <1, 512>, <NC / 2, NC / 2>
+ // allocate 1M - should go to offset 4096
uint64_t allocated4 = 0;
interval_vector_t a4;
al2.allocate_l2(_1m, _1m, &allocated4, &a4);
ASSERT_EQ(a4.size(), 1u);
ASSERT_EQ(allocated4, _1m);
- ASSERT_EQ(a4[0].offset, _1m);
+ ASSERT_EQ(a4[0].offset, 4096);
ASSERT_EQ(a4[0].length, _1m);
bins_overall.clear();
al2.collect_stats(bins_overall);
- ASSERT_EQ(bins_overall.size(), 3u);
- ASSERT_EQ(bins_overall[0], 1u);
- ASSERT_EQ(bins_overall[cbits((_1m - 0x1000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall.size(), 2u);
+ ASSERT_EQ(bins_overall[cbits(_1m / 0x1000) - 1], 1u);
ASSERT_EQ(bins_overall[cbits(num_chunks / 2) - 1], 1u);
}
{
+ // Original free space disposition (start chunk, count):
+ // <257, 256>, <NC / 2, NC / 2>
// and allocate yet another 8K within the deallocated range
uint64_t allocated4 = 0;
interval_vector_t a4;
al2.allocate_l2(0x2000, 0x1000, &allocated4, &a4);
ASSERT_EQ(a4.size(), 1u);
ASSERT_EQ(allocated4, 0x2000u);
- ASSERT_EQ(a4[0].offset, 0x1000u);
+ ASSERT_EQ(a4[0].offset, _1m + 0x1000u);
ASSERT_EQ(a4[0].length, 0x2000u);
bins_overall.clear();
al2.collect_stats(bins_overall);
- ASSERT_EQ(bins_overall[0], 1u);
- ASSERT_EQ(bins_overall[cbits((_1m - 0x3000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall.size(), 2u);
+ ASSERT_EQ(bins_overall[cbits((_1m - 0x2000) / 0x1000) - 1], 1u);
ASSERT_EQ(bins_overall[cbits(num_chunks / 2) - 1], 1u);
}
{
- // release just allocated 1M
+ // Original free space disposition (start chunk, count):
+ // <259, 254>, <NC / 2, NC / 2>
+ // release 4K~1M
interval_vector_t r;
- r.emplace_back(_1m, _1m);
+ r.emplace_back(0x1000, _1m);
al2.free_l2(r);
bins_overall.clear();
al2.collect_stats(bins_overall);
- ASSERT_EQ(bins_overall.size(), 2u);
- ASSERT_EQ(bins_overall[cbits((2 * _1m - 0x3000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall.size(), 3u);
+ //ASSERT_EQ(bins_overall[cbits((2 * _1m - 0x3000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits(_1m / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits((_1m - 0x2000) / 0x1000) - 1], 1u);
ASSERT_EQ(bins_overall[cbits(num_chunks / 2) - 1], 1u);
}
{
- // allocate 3M - should go to the second 1M chunk and @capacity/2
+ // Original free space disposition (start chunk, count):
+ // <1, 257>, <259, 254>, <NC / 2, NC / 2>
+ // allocate 3M - should go to the first 1M chunk and @capacity/2
uint64_t allocated4 = 0;
interval_vector_t a4;
al2.allocate_l2(3 * _1m, _1m, &allocated4, &a4);
ASSERT_EQ(a4.size(), 2u);
ASSERT_EQ(allocated4, 3 * _1m);
- ASSERT_EQ(a4[0].offset, _1m);
+ ASSERT_EQ(a4[0].offset, 0x1000);
ASSERT_EQ(a4[0].length, _1m);
ASSERT_EQ(a4[1].offset, capacity / 2);
ASSERT_EQ(a4[1].length, 2 * _1m);
bins_overall.clear();
al2.collect_stats(bins_overall);
- ASSERT_EQ(bins_overall.size(), 3u);
- ASSERT_EQ(bins_overall[0], 1u);
- ASSERT_EQ(bins_overall[cbits((_1m - 0x3000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall.size(), 2u);
+ ASSERT_EQ(bins_overall[cbits((_1m - 0x2000) / 0x1000) - 1], 1u);
ASSERT_EQ(bins_overall[cbits((num_chunks - 512) / 2) - 1], 1u);
}
{
- // release allocated 1M in the second meg chunk except
+ // Original free space disposition (start chunk, count):
+ // <259, 254>, <NC / 2 - 512, NC / 2 - 512>
+ // release allocated 1M in the first meg chunk except
// the first 4K chunk
interval_vector_t r;
- r.emplace_back(_1m + 0x1000, _1m);
+ r.emplace_back(0x1000, _1m);
al2.free_l2(r);
bins_overall.clear();
al2.collect_stats(bins_overall);
ASSERT_EQ(bins_overall.size(), 3u);
ASSERT_EQ(bins_overall[cbits(_1m / 0x1000) - 1], 1u);
- ASSERT_EQ(bins_overall[cbits((_1m - 0x3000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits((_1m - 0x2000) / 0x1000) - 1], 1u);
ASSERT_EQ(bins_overall[cbits((num_chunks - 512) / 2) - 1], 1u);
}
{
+ // Original free space disposition (start chunk, count):
+ // <1, 256>, <259, 254>, <NC / 2 - 512, NC / 2 - 512>
// release 2M @(capacity / 2)
interval_vector_t r;
r.emplace_back(capacity / 2, 2 * _1m);
@@ -733,10 +749,12 @@
al2.collect_stats(bins_overall);
ASSERT_EQ(bins_overall.size(), 3u);
ASSERT_EQ(bins_overall[cbits(_1m / 0x1000) - 1], 1u);
- ASSERT_EQ(bins_overall[cbits((_1m - 0x3000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits((_1m - 0x2000) / 0x1000) - 1], 1u);
ASSERT_EQ(bins_overall[cbits((num_chunks) / 2) - 1], 1u);
}
{
+ // Original free space disposition (start chunk, count):
+ // <1, 256>, <259, 254>, <NC / 2, NC / 2>
// allocate 4x512K - should go to the second halves of
// the first and second 1M chunks and @(capacity / 2)
uint64_t allocated4 = 0;
@@ -744,51 +762,54 @@
al2.allocate_l2(2 * _1m, _1m / 2, &allocated4, &a4);
ASSERT_EQ(a4.size(), 3u);
ASSERT_EQ(allocated4, 2 * _1m);
- ASSERT_EQ(a4[0].offset, _1m / 2);
+ ASSERT_EQ(a4[1].offset, 0x1000);
+ ASSERT_EQ(a4[1].length, _1m);
+ ASSERT_EQ(a4[0].offset, _1m + 0x3000);
ASSERT_EQ(a4[0].length, _1m / 2);
- ASSERT_EQ(a4[1].offset, _1m + _1m / 2);
- ASSERT_EQ(a4[1].length, _1m / 2);
ASSERT_EQ(a4[2].offset, capacity / 2);
- ASSERT_EQ(a4[2].length, _1m);
+ ASSERT_EQ(a4[2].length, _1m / 2);
bins_overall.clear();
al2.collect_stats(bins_overall);
- ASSERT_EQ(bins_overall.size(), 3u);
- ASSERT_EQ(bins_overall[0], 1u);
- // below we have 512K - 4K & 512K - 12K chunks which both fit into
- // the same bin = 6
- ASSERT_EQ(bins_overall[6], 2u);
+ ASSERT_EQ(bins_overall.size(), 2u);
+ ASSERT_EQ(bins_overall[cbits((_1m - 0x2000 - 0x80000) / 0x1000) - 1], 1u);
ASSERT_EQ(bins_overall[cbits((num_chunks - 256) / 2) - 1], 1u);
}
{
- // cleanup first 2M except except the last 4K chunk
+ // Original free space disposition (start chunk, count):
+ // <387, 126>, <NC / 2 + 128, NC / 2 - 128>
+ // cleanup first 1536K except the last 4K chunk
interval_vector_t r;
- r.emplace_back(0, 2 * _1m - 0x1000);
+ r.emplace_back(0, _1m + _1m / 2 - 0x1000);
al2.free_l2(r);
bins_overall.clear();
al2.collect_stats(bins_overall);
ASSERT_EQ(bins_overall.size(), 3u);
- ASSERT_EQ(bins_overall[0], 1u);
- ASSERT_EQ(bins_overall[cbits((_2m - 0x1000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits((_1m + _1m / 2 - 0x1000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits((_1m - 0x2000 - 0x80000) / 0x1000) - 1], 1u);
ASSERT_EQ(bins_overall[cbits((num_chunks - 256) / 2) - 1], 1u);
}
{
- // release 2M @(capacity / 2)
+ // Original free space disposition (start chunk, count):
+ // <0, 383> <387, 126>, <NC / 2 + 128, NC / 2 - 128>
+ // release 512K @(capacity / 2)
interval_vector_t r;
- r.emplace_back(capacity / 2, 2 * _1m);
+ r.emplace_back(capacity / 2, _1m / 2);
al2.free_l2(r);
bins_overall.clear();
al2.collect_stats(bins_overall);
ASSERT_EQ(bins_overall.size(), 3u);
- ASSERT_EQ(bins_overall[0], 1u);
- ASSERT_EQ(bins_overall[cbits((_2m - 0x1000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits((_1m + _1m / 2 - 0x1000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits((_1m - 0x2000 - 0x80000) / 0x1000) - 1], 1u);
ASSERT_EQ(bins_overall[cbits(num_chunks / 2) - 1], 1u);
}
{
- // allocate 132M using 4M granularity should go to (capacity / 2)
+ // Original free space disposition (start chunk, count):
+ // <0, 383> <387, 126>, <NC / 2, NC / 2>
+ // allocate 132M (=33792*4096) = using 4M granularity should go to (capacity / 2)
uint64_t allocated4 = 0;
interval_vector_t a4;
al2.allocate_l2(132 * _1m, 4 * _1m , &allocated4, &a4);
@@ -799,24 +820,40 @@
bins_overall.clear();
al2.collect_stats(bins_overall);
ASSERT_EQ(bins_overall.size(), 3u);
+ ASSERT_EQ(bins_overall[cbits((_1m + _1m / 2 - 0x1000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits((_1m - 0x2000 - 0x80000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits(num_chunks / 2 - 33792) - 1], 1u);
}
{
- // cleanup left 4K chunk in the first 2M
+ // Original free space disposition (start chunk, count):
+ // <0, 383> <387, 126>, <NC / 2 + 33792, NC / 2 - 33792>
+ // cleanup remaining 4*4K chunks in the first 2M
interval_vector_t r;
- r.emplace_back(2 * _1m - 0x1000, 0x1000);
+ r.emplace_back(383 * 4096, 4 * 0x1000);
al2.free_l2(r);
bins_overall.clear();
al2.collect_stats(bins_overall);
ASSERT_EQ(bins_overall.size(), 2u);
+ ASSERT_EQ(bins_overall[cbits((2 * _1m + 0x1000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits(num_chunks / 2 - 33792) - 1], 1u);
}
{
+ // Original free space disposition (start chunk, count):
+ // <0, 513>, <NC / 2 + 33792, NC / 2 - 33792>
// release 132M @(capacity / 2)
interval_vector_t r;
r.emplace_back(capacity / 2, 132 * _1m);
al2.free_l2(r);
+ bins_overall.clear();
+ al2.collect_stats(bins_overall);
+ ASSERT_EQ(bins_overall.size(), 2u);
+ ASSERT_EQ(bins_overall[cbits((2 * _1m + 0x1000) / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits(num_chunks / 2) - 1], 1u);
}
{
+ // Original free space disposition (start chunk, count):
+ // <0, 513>, <NC / 2, NC / 2>
// allocate 132M using 2M granularity should go to the first chunk and to
// (capacity / 2)
uint64_t allocated4 = 0;
@@ -827,14 +864,31 @@
ASSERT_EQ(a4[0].length, 2 * _1m);
ASSERT_EQ(a4[1].offset, capacity / 2);
ASSERT_EQ(a4[1].length, 130 * _1m);
+
+ bins_overall.clear();
+ al2.collect_stats(bins_overall);
+
+ ASSERT_EQ(bins_overall.size(), 2u);
+ ASSERT_EQ(bins_overall[cbits(0)], 1u);
+ ASSERT_EQ(bins_overall[cbits(num_chunks / 2 - 33792) - 1], 1u);
}
{
+ // Original free space disposition (start chunk, count):
+ // <512, 1>, <NC / 2 + 33792, NC / 2 - 33792>
// release 130M @(capacity / 2)
interval_vector_t r;
r.emplace_back(capacity / 2, 132 * _1m);
al2.free_l2(r);
+ bins_overall.clear();
+ al2.collect_stats(bins_overall);
+
+ ASSERT_EQ(bins_overall.size(), 2u);
+ ASSERT_EQ(bins_overall[cbits(0)], 1u);
+ ASSERT_EQ(bins_overall[cbits(num_chunks / 2) - 1], 1u);
}
{
+ // Original free space disposition (start chunk, count):
+ // <512,1>, <NC / 2, NC / 2>
// release 4K~16K
// release 28K~32K
// release 68K~24K
@@ -843,21 +897,46 @@
r.emplace_back(0x7000, 0x8000);
r.emplace_back(0x11000, 0x6000);
al2.free_l2(r);
+
+ bins_overall.clear();
+ al2.collect_stats(bins_overall);
+
+ ASSERT_EQ(bins_overall.size(), 4u);
+ ASSERT_EQ(bins_overall[cbits(0)], 1u);
+ ASSERT_EQ(bins_overall[cbits(0x4000 / 0x1000) - 1], 2u); // accounts both 0x4000 & 0x6000
+ ASSERT_EQ(bins_overall[cbits(0x8000 / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits(num_chunks / 2) - 1], 1u);
}
{
- // allocate 32K using 16K granularity - should bypass the first
- // unaligned extent, use the second free extent partially given
- // the 16K alignment and then fallback to capacity / 2
+ // Original free space disposition (start chunk, count):
+ // <1, 4>, <7, 8>, <17, 6> <512,1>, <NC / 2, NC / 2>
+ // allocate 80K using 16K granularity
uint64_t allocated4 = 0;
interval_vector_t a4;
- al2.allocate_l2(0x8000, 0x4000, &allocated4, &a4);
- ASSERT_EQ(a4.size(), 2u);
- ASSERT_EQ(a4[0].offset, 0x8000u);
- ASSERT_EQ(a4[0].length, 0x4000u);
- ASSERT_EQ(a4[1].offset, capacity / 2);
+ al2.allocate_l2(0x14000, 0x4000, &allocated4, &a4);
+
+ ASSERT_EQ(a4.size(), 4);
+ ASSERT_EQ(a4[1].offset, 0x1000u);
ASSERT_EQ(a4[1].length, 0x4000u);
- }
+ ASSERT_EQ(a4[0].offset, 0x7000u);
+ ASSERT_EQ(a4[0].length, 0x8000u);
+ ASSERT_EQ(a4[2].offset, 0x11000u);
+ ASSERT_EQ(a4[2].length, 0x4000u);
+ ASSERT_EQ(a4[3].offset, capacity / 2);
+ ASSERT_EQ(a4[3].length, 0x4000u);
+
+ bins_overall.clear();
+ al2.collect_stats(bins_overall);
+ ASSERT_EQ(bins_overall.size(), 3u);
+ ASSERT_EQ(bins_overall[cbits(0)], 1u);
+ ASSERT_EQ(bins_overall[cbits(0x2000 / 0x1000) - 1], 1u);
+ ASSERT_EQ(bins_overall[cbits(num_chunks / 2 - 1) - 1], 1u);
+ }
+ {
+ // Original free space disposition (start chunk, count):
+ // <21, 2> <512,1>, <NC / 2 + 1, NC / 2 - 1>
+ }
}
std::cout << "Done L2 cont aligned" << std::endl;
}
@@ -913,7 +992,7 @@
al2.allocate_l2(0x3e000000, _1m, &allocated4, &a4);
ASSERT_EQ(a4.size(), 2u);
ASSERT_EQ(allocated4, 0x3e000000u);
- ASSERT_EQ(a4[0].offset, 0x5fed00000u);
+ ASSERT_EQ(a4[0].offset, 0x5fec30000u);
ASSERT_EQ(a4[0].length, 0x1300000u);
ASSERT_EQ(a4[1].offset, 0x628000000u);
ASSERT_EQ(a4[1].length, 0x3cd00000u);
diff -ur ceph-18.2.1~/src/test/objectstore/store_test.cc ceph-18.2.1/src/test/objectstore/store_test.cc
--- ceph-18.2.1~/src/test/objectstore/store_test.cc 2023-11-14 14:36:19.000000000 -0500
+++ ceph-18.2.1/src/test/objectstore/store_test.cc 2023-12-11 16:55:38.000000000 -0500
@@ -9524,9 +9524,9 @@
string key;
_key_encode_u64(1, &key);
bluestore_shared_blob_t sb(1);
- sb.ref_map.get(0x2000, block_size);
- sb.ref_map.get(0x4000, block_size);
- sb.ref_map.get(0x4000, block_size);
+ sb.ref_map.get(0x822000, block_size);
+ sb.ref_map.get(0x824000, block_size);
+ sb.ref_map.get(0x824000, block_size);
bufferlist bl;
encode(sb, bl);
bstore->inject_broken_shared_blob_key(key, bl);

@ -0,0 +1,37 @@
diff --git a/src/common/dout.h b/src/common/dout.h
index 4cd60efff8fef..db68a042a7f1b 100644
--- a/src/common/dout.h
+++ b/src/common/dout.h
@@ -144,17 +144,24 @@ struct is_dynamic<dynamic_marker_t<T>> : public std::true_type {};
#else
#define dout_impl(cct, sub, v) \
do { \
- const bool should_gather = [&](const auto cctX) { \
- if constexpr (ceph::dout::is_dynamic<decltype(sub)>::value || \
- ceph::dout::is_dynamic<decltype(v)>::value) { \
+ const bool should_gather = [&](const auto cctX, auto sub_, auto v_) { \
+ /* The check is performed on `sub_` and `v_` to leverage the C++'s \
+ * guarantee on _discarding_ one of blocks of `if constexpr`, which \
+ * includes also the checks for ill-formed code (`should_gather<>` \
+ * must not be feed with non-const expresions), BUT ONLY within \
+ * a template (thus the generic lambda) and under the restriction \
+ * it's dependant on a parameter of this template). \
+ * GCC prior to v14 was not enforcing these restrictions. */ \
+ if constexpr (ceph::dout::is_dynamic<decltype(sub_)>::value || \
+ ceph::dout::is_dynamic<decltype(v_)>::value) { \
return cctX->_conf->subsys.should_gather(sub, v); \
} else { \
- /* The parentheses are **essential** because commas in angle \
- * brackets are NOT ignored on macro expansion! A language's \
- * limitation, sorry. */ \
- return (cctX->_conf->subsys.template should_gather<sub, v>()); \
+ constexpr auto sub_helper = static_cast<decltype(sub_)>(sub); \
+ constexpr auto v_helper = static_cast<decltype(v_)>(v); \
+ return cctX->_conf->subsys.template should_gather<sub_helper, \
+ v_helper>(); \
} \
- }(cct); \
+ }(cct, sub, v); \
\
if (should_gather) { \
ceph::logging::MutableEntry _dout_e(v, sub); \

@ -0,0 +1,178 @@
commit a49d154f4a8e493baf2296a15c7b5c56cd25e993
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Dec 20 14:59:19 2023 +0100
pybind: Fix C type errors in Cython-generated Python bindings
Several Ceph APIs use bool * types, which correspond to
libcpp.bool * types in Cython. The bint type has an incorrect
size 4 and cannot be used as a replacement.
This prevents a compilation failure with future compilers:
…-build/src/pybind/rbd/rbd.c: In function __pyx_pf_3rbd_3RBD_104namespace_exists:
…-build/src/pybind/rbd/rbd.c:42165:76: error: passing argument 3 of rbd_namespace_exists from incompatible pointer type
42165 | __pyx_v_ret = rbd_namespace_exists(__pyx_v__ioctx, __pyx_v__name, (&__pyx_v__exists));
| ~^~~~~~~~~~~~~~~~~
| |
| int *
In file included from …-build/src/pybind/rbd/rbd.c:1268:
…/src/include/rbd/librbd.h:1496:45: note: expected _Bool * but argument is of type int *
1496 | bool *exists);
| ^
Signed-off-by: Florian Weimer <fweimer@redhat.com>
diff --git a/src/pybind/rbd/c_rbd.pxd b/src/pybind/rbd/c_rbd.pxd
index 885f7bd46a..bda23bbc47 100644
--- a/src/pybind/rbd/c_rbd.pxd
+++ b/src/pybind/rbd/c_rbd.pxd
@@ -2,6 +2,7 @@
from libc.stdint cimport *
from ctime cimport time_t, timespec
+cimport libcpp
cdef extern from "rados/librados.h":
enum:
@@ -525,7 +526,7 @@ cdef extern from "rbd/librbd.h" nogil:
int rbd_snap_unprotect(rbd_image_t image, const char *snap_name)
int rbd_snap_is_protected(rbd_image_t image, const char *snap_name,
int *is_protected)
- int rbd_snap_exists(rbd_image_t image, const char *snapname, bint *exists)
+ int rbd_snap_exists(rbd_image_t image, const char *snapname, libcpp.bool *exists)
int rbd_snap_get_limit(rbd_image_t image, uint64_t *limit)
int rbd_snap_set_limit(rbd_image_t image, uint64_t limit)
int rbd_snap_get_timestamp(rbd_image_t image, uint64_t snap_id, timespec *timestamp)
@@ -711,7 +712,7 @@ cdef extern from "rbd/librbd.h" nogil:
int rbd_namespace_list(rados_ioctx_t io, char *namespace_names,
size_t *size)
int rbd_namespace_exists(rados_ioctx_t io, const char *namespace_name,
- bint *exists)
+ libcpp.bool *exists)
int rbd_pool_init(rados_ioctx_t, bint force)
diff --git a/src/pybind/rbd/mock_rbd.pxi b/src/pybind/rbd/mock_rbd.pxi
index 11872bd814..364f965fba 100644
--- a/src/pybind/rbd/mock_rbd.pxi
+++ b/src/pybind/rbd/mock_rbd.pxi
@@ -3,6 +3,11 @@
from libc.stdint cimport *
from ctime cimport time_t, timespec
+# Make the bool type available as libcpp.bool, for both C and C++.
+cimport libcpp
+cdef extern from "<stdbool.h>":
+ pass
+
cdef nogil:
enum:
_LIBRADOS_SNAP_HEAD "LIBRADOS_SNAP_HEAD"
@@ -637,7 +642,7 @@ cdef nogil:
int rbd_snap_is_protected(rbd_image_t image, const char *snap_name,
int *is_protected):
pass
- int rbd_snap_exists(rbd_image_t image, const char *snapname, bint *exists):
+ int rbd_snap_exists(rbd_image_t image, const char *snapname, libcpp.bool *exists):
pass
int rbd_snap_get_limit(rbd_image_t image, uint64_t *limit):
pass
@@ -896,7 +901,7 @@ cdef nogil:
size_t *size):
pass
int rbd_namespace_exists(rados_ioctx_t io, const char *namespace_name,
- bint *exists):
+ libcpp.bool *exists):
pass
int rbd_pool_init(rados_ioctx_t io, bint force):
pass
diff --git a/src/pybind/rbd/rbd.pyx b/src/pybind/rbd/rbd.pyx
index fcb2fb3470..f59ba23f0f 100644
--- a/src/pybind/rbd/rbd.pyx
+++ b/src/pybind/rbd/rbd.pyx
@@ -23,6 +23,7 @@ from libc cimport errno
from libc.stdint cimport *
from libc.stdlib cimport malloc, realloc, free
from libc.string cimport strdup, memset
+cimport libcpp
try:
from collections.abc import Iterable
@@ -1935,12 +1936,12 @@ class RBD(object):
cdef:
rados_ioctx_t _ioctx = convert_ioctx(ioctx)
const char *_name = name
- bint _exists = False
+ libcpp.bool _exists = False
with nogil:
ret = rbd_namespace_exists(_ioctx, _name, &_exists)
if ret != 0:
raise make_ex(ret, 'error verifying namespace')
- return bool(_exists != 0)
+ return _exists
def namespace_list(self, ioctx):
"""
@@ -3679,12 +3680,12 @@ cdef class Image(object):
name = cstr(name, 'name')
cdef:
char *_name = name
- bint _exists = False
+ libcpp.bool _exists = False
with nogil:
ret = rbd_snap_exists(self.image, _name, &_exists)
if ret != 0:
raise make_ex(ret, 'error getting snapshot exists for %s' % self.name)
- return bool(_exists != 0)
+ return _exists
@requires_not_closed
def get_snap_limit(self):
diff --git a/src/pybind/rgw/mock_rgw.pxi b/src/pybind/rgw/mock_rgw.pxi
index ca893a5bb8..806d4df75d 100644
--- a/src/pybind/rgw/mock_rgw.pxi
+++ b/src/pybind/rgw/mock_rgw.pxi
@@ -1,5 +1,10 @@
# cython: embedsignature=True
+# Make the bool type available as libcpp.bool, for both C and C++.
+cimport libcpp
+cdef extern from "<stdbool.h>":
+ pass
+
cdef nogil:
ctypedef void* librgw_t
@@ -111,8 +116,8 @@ cdef nogil:
int rgw_readdir(rgw_fs *fs,
rgw_file_handle *parent_fh, uint64_t *offset,
- bint (*cb)(const char *name, void *arg, uint64_t offset, stat *st, uint32_t st_mask, uint32_t flags) nogil except? -9000,
- void *cb_arg, bint *eof, uint32_t flags) except? -9000:
+ libcpp.bool (*cb)(const char *name, void *arg, uint64_t offset, stat *st, uint32_t st_mask, uint32_t flags) nogil except? -9000,
+ void *cb_arg, libcpp.bool *eof, uint32_t flags) except? -9000:
pass
int rgw_getattr(rgw_fs *fs,
diff --git a/src/pybind/rgw/rgw.pyx b/src/pybind/rgw/rgw.pyx
index 9bbcdfff58..d210a70bbb 100644
--- a/src/pybind/rgw/rgw.pyx
+++ b/src/pybind/rgw/rgw.pyx
@@ -7,6 +7,7 @@ from cpython cimport PyObject, ref, exc, array
from libc.stdint cimport *
from libc.stdlib cimport malloc, realloc, free
from cstat cimport stat
+cimport libcpp
IF BUILD_DOC:
include "mock_rgw.pxi"
@@ -373,7 +374,7 @@ cdef class LibRGWFS(object):
cdef:
rgw_file_handle *_dir_handler = <rgw_file_handle*>dir_handler.handler
uint64_t _offset = offset
- bint _eof
+ libcpp.bool _eof
uint32_t _flags = flags
with nogil:
ret = rgw_readdir(self.fs, _dir_handler, &_offset, &readdir_cb,

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save