From be99ab3e33df4d33db7b96d0d52a27eba87b4507 Mon Sep 17 00:00:00 2001 From: Christopher Hoffman Date: Mon, 20 Oct 2025 18:33:17 +0000 Subject: [PATCH] test/client: When testing large io, consider fscrypt When testing large io sizes and clamping that io, consider fscrypt max io size. This max io size should be a multiple of 4K (fscrypt block size), but not to exceed INT_MAX. Signed-off-by: Christopher Hoffman --- src/test/client/CMakeLists.txt | 1 + src/test/client/nonblocking.cc | 12 +++++++++--- src/test/client/syncio.cc | 10 ++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/test/client/CMakeLists.txt b/src/test/client/CMakeLists.txt index 00c0681f8b9c1..ed233fb887db5 100644 --- a/src/test/client/CMakeLists.txt +++ b/src/test/client/CMakeLists.txt @@ -26,6 +26,7 @@ if(${WITH_CEPHFS}) ops.cc nonblocking.cc fscrypt_conf.cc + syncio.cc ) target_link_libraries(ceph_test_client_fscrypt client diff --git a/src/test/client/nonblocking.cc b/src/test/client/nonblocking.cc index c232c2ffcc0c8..8a877c6b03b9f 100644 --- a/src/test/client/nonblocking.cc +++ b/src/test/client/nonblocking.cc @@ -777,15 +777,21 @@ TEST_F(TestClient, LlreadvLlwritevLargeBuffers) { nullptr); ASSERT_EQ(rc, 0); bytes_written = writefinish.wait(); + + int maxio_size = INT_MAX; + if (fse.encrypted) { + maxio_size = FSCRYPT_MAXIO_SIZE; + } + // total write length is clamped to INT_MAX in write paths - ASSERT_EQ(bytes_written, INT_MAX); + ASSERT_EQ(bytes_written, maxio_size); rc = client->ll_preadv_pwritev(fh, iov_in, 2, 0, false, &readfinish, &bl); ASSERT_EQ(rc, 0); bytes_read = readfinish.wait(); // total read length is clamped to INT_MAX in read paths - ASSERT_EQ(bytes_read, INT_MAX); + ASSERT_EQ(bytes_read, maxio_size); client->ll_release(fh); ASSERT_EQ(0, client->ll_unlink(root, filename, myperm)); -} \ No newline at end of file +} diff --git a/src/test/client/syncio.cc b/src/test/client/syncio.cc index 0eddc2ddae9ff..a82c7210dddd0 100644 --- a/src/test/client/syncio.cc +++ b/src/test/client/syncio.cc @@ -129,13 +129,19 @@ TEST_F(TestClient, LlreadvLlwritevLargeBuffersSync) { {in_buf_1.get(), BUFSIZE} }; + int maxio_size = INT_MAX; + if (fse.encrypted) { + maxio_size = FSCRYPT_MAXIO_SIZE; + } + + rc = client->ll_writev(fh, iov_out, 2, 0); // total write length is clamped to INT_MAX in write paths - ASSERT_EQ(rc, INT_MAX); + ASSERT_EQ(rc, maxio_size); rc = client->ll_readv(fh, iov_in, 2, 0); // total write length is clamped to INT_MAX in write paths - ASSERT_EQ(rc, INT_MAX); + ASSERT_EQ(rc, maxio_size); client->ll_release(fh); ASSERT_EQ(0, client->ll_unlink(root, filename, myperm)); -- 2.39.5