From 0267d021dc5c30a8153cf2cb0588cc50bc73c421 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Fri, 20 Oct 2023 15:41:05 +0530 Subject: [PATCH] test/librbd/fsx: wait for resize to propagate in krbd_resize() With this changes resize request will not be blocked until the resize is completed. Because of this the fsx test fails as it assumes that the request to resize immediately implies changes on the device size. Hence we have to add a wait in resize handler of fsx for the device to actually get resized. Signed-off-by: Prasanna Kumar Kalever (cherry picked from commit 6f3d0f570f1a262b06d4c661582091d8ddb11bfa) --- src/test/librbd/fsx.cc | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/test/librbd/fsx.cc b/src/test/librbd/fsx.cc index b8be4708e2d..94c454bf3c1 100644 --- a/src/test/librbd/fsx.cc +++ b/src/test/librbd/fsx.cc @@ -1149,6 +1149,8 @@ int krbd_resize(struct rbd_ctx *ctx, uint64_t size) { int ret; + int count = 0; + uint64_t effective_size; ceph_assert(size % truncbdy == 0); @@ -1170,7 +1172,29 @@ krbd_resize(struct rbd_ctx *ctx, uint64_t size) if (ret < 0) return ret; - return __librbd_resize(ctx, size); + ret = __librbd_resize(ctx, size); + if (ret < 0) + return ret; + + for (;;) { + ret = krbd_get_size(ctx, &effective_size); + if (ret < 0) + return ret; + + if (effective_size == size) + break; + + if (count++ >= 15) { + prt("BLKGETSIZE64 size error: expected 0x%llx, actual 0x%llx\n", + (unsigned long long)size, + (unsigned long long)effective_size); + return -EINVAL; + } + + usleep(count * 250 * 1000); + } + + return 0; } int -- 2.47.3