From: Ilya Dryomov Date: Thu, 27 Jan 2022 16:15:01 +0000 (+0100) Subject: qa: krbd rxbounce test X-Git-Tag: v18.0.0~1435^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=95d30b534ef65207168397dd25ca7213c8290568;p=ceph.git qa: krbd rxbounce test Lives in its own directory since ms_mode doesn't need to be permuted here. Signed-off-by: Ilya Dryomov --- diff --git a/qa/suites/krbd/rxbounce/% b/qa/suites/krbd/rxbounce/% new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/qa/suites/krbd/rxbounce/.qa b/qa/suites/krbd/rxbounce/.qa new file mode 120000 index 0000000000000..a602a0353e751 --- /dev/null +++ b/qa/suites/krbd/rxbounce/.qa @@ -0,0 +1 @@ +../.qa/ \ No newline at end of file diff --git a/qa/suites/krbd/rxbounce/bluestore-bitmap.yaml b/qa/suites/krbd/rxbounce/bluestore-bitmap.yaml new file mode 120000 index 0000000000000..a59cf5175069a --- /dev/null +++ b/qa/suites/krbd/rxbounce/bluestore-bitmap.yaml @@ -0,0 +1 @@ +.qa/objectstore/bluestore-bitmap.yaml \ No newline at end of file diff --git a/qa/suites/krbd/rxbounce/ceph/.qa b/qa/suites/krbd/rxbounce/ceph/.qa new file mode 120000 index 0000000000000..a602a0353e751 --- /dev/null +++ b/qa/suites/krbd/rxbounce/ceph/.qa @@ -0,0 +1 @@ +../.qa/ \ No newline at end of file diff --git a/qa/suites/krbd/rxbounce/ceph/ceph.yaml b/qa/suites/krbd/rxbounce/ceph/ceph.yaml new file mode 100644 index 0000000000000..2030acb90836c --- /dev/null +++ b/qa/suites/krbd/rxbounce/ceph/ceph.yaml @@ -0,0 +1,3 @@ +tasks: +- install: +- ceph: diff --git a/qa/suites/krbd/rxbounce/clusters/.qa b/qa/suites/krbd/rxbounce/clusters/.qa new file mode 120000 index 0000000000000..a602a0353e751 --- /dev/null +++ b/qa/suites/krbd/rxbounce/clusters/.qa @@ -0,0 +1 @@ +../.qa/ \ No newline at end of file diff --git a/qa/suites/krbd/rxbounce/clusters/fixed-3.yaml b/qa/suites/krbd/rxbounce/clusters/fixed-3.yaml new file mode 120000 index 0000000000000..f75a848b8e740 --- /dev/null +++ b/qa/suites/krbd/rxbounce/clusters/fixed-3.yaml @@ -0,0 +1 @@ +.qa/clusters/fixed-3.yaml \ No newline at end of file diff --git a/qa/suites/krbd/rxbounce/conf.yaml b/qa/suites/krbd/rxbounce/conf.yaml new file mode 100644 index 0000000000000..30da870b25df9 --- /dev/null +++ b/qa/suites/krbd/rxbounce/conf.yaml @@ -0,0 +1,5 @@ +overrides: + ceph: + conf: + global: + ms die on skipped message: false diff --git a/qa/suites/krbd/rxbounce/tasks/.qa b/qa/suites/krbd/rxbounce/tasks/.qa new file mode 120000 index 0000000000000..a602a0353e751 --- /dev/null +++ b/qa/suites/krbd/rxbounce/tasks/.qa @@ -0,0 +1 @@ +../.qa/ \ No newline at end of file diff --git a/qa/suites/krbd/rxbounce/tasks/krbd_rxbounce.yaml b/qa/suites/krbd/rxbounce/tasks/krbd_rxbounce.yaml new file mode 100644 index 0000000000000..4ecd0e83eab8a --- /dev/null +++ b/qa/suites/krbd/rxbounce/tasks/krbd_rxbounce.yaml @@ -0,0 +1,5 @@ +tasks: +- workunit: + clients: + all: + - rbd/krbd_rxbounce.sh diff --git a/qa/workunits/rbd/krbd_rxbounce.sh b/qa/workunits/rbd/krbd_rxbounce.sh new file mode 100755 index 0000000000000..ad00e3f96be73 --- /dev/null +++ b/qa/workunits/rbd/krbd_rxbounce.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash + +set -ex + +rbd create --size 256 img + +IMAGE_SIZE=$(rbd info --format=json img | python3 -c 'import sys, json; print(json.load(sys.stdin)["size"])') +OBJECT_SIZE=$(rbd info --format=json img | python3 -c 'import sys, json; print(json.load(sys.stdin)["object_size"])') +NUM_OBJECTS=$((IMAGE_SIZE / OBJECT_SIZE)) +[[ $((IMAGE_SIZE % OBJECT_SIZE)) -eq 0 ]] +OP_SIZE=16384 + +DEV=$(sudo rbd map img) +{ + for ((i = 0; i < $NUM_OBJECTS; i++)); do + echo pwrite -b $OP_SIZE -S $i $((i * OBJECT_SIZE)) $OP_SIZE + done + echo fsync + echo quit +} | xfs_io $DEV +sudo rbd unmap $DEV + +g++ -xc++ -o racereads - -lpthread < +#include +#include +#include +#include +#include + +#include +#include + +const int object_size = $OBJECT_SIZE; +const int num_objects = $NUM_OBJECTS; +const int read_len = $OP_SIZE; +const int num_reads = 1024; + +int main() { + int fd = open("$DEV", O_DIRECT | O_RDONLY); + assert(fd >= 0); + + void *buf; + int r = posix_memalign(&buf, 512, read_len); + assert(r == 0); + + std::vector threads; + for (int i = 0; i < num_objects; i++) { + threads.emplace_back( + [fd, buf, read_off = static_cast(i) * object_size]() { + for (int i = 0; i < num_reads; i++) { + auto len = pread(fd, buf, read_len, read_off); + assert(len == read_len); + } + }); + } + + for (auto &t : threads) { + t.join(); + } +} +EOF + +DEV=$(sudo rbd map -o ms_mode=legacy img) +sudo dmesg -C +./racereads +[[ $(dmesg | grep -c 'libceph: osd.* bad crc/signature') -gt 100 ]] +sudo rbd unmap $DEV + +DEV=$(sudo rbd map -o ms_mode=legacy,rxbounce img) +sudo dmesg -C +./racereads +[[ $(dmesg | grep -c 'libceph: osd.* bad crc/signature') -eq 0 ]] +sudo rbd unmap $DEV + +DEV=$(sudo rbd map -o ms_mode=crc img) +sudo dmesg -C +./racereads +[[ $(dmesg | grep -c 'libceph: osd.* integrity error') -gt 100 ]] +sudo rbd unmap $DEV + +DEV=$(sudo rbd map -o ms_mode=crc,rxbounce img) +sudo dmesg -C +./racereads +[[ $(dmesg | grep -c 'libceph: osd.* integrity error') -eq 0 ]] +sudo rbd unmap $DEV + +# rxbounce is a no-op for secure mode +DEV=$(sudo rbd map -o ms_mode=secure img) +sudo dmesg -C +./racereads +[[ $(dmesg | grep -c 'libceph: osd.* integrity error') -eq 0 ]] +sudo rbd unmap $DEV + +DEV=$(sudo rbd map -o ms_mode=secure,rxbounce img) +sudo dmesg -C +./racereads +[[ $(dmesg | grep -c 'libceph: osd.* integrity error') -eq 0 ]] +sudo rbd unmap $DEV + +rbd rm img + +echo OK