]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/librbd/fsx: wait for resize to propagate in krbd_resize()
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Fri, 20 Oct 2023 10:11:05 +0000 (15:41 +0530)
committerPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Fri, 27 Oct 2023 06:32:01 +0000 (12:02 +0530)
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 <prasanna.kalever@redhat.com>
src/test/librbd/fsx.cc

index acea8ede270876b3cb041ec0dcbc3549c9810c4c..cbf7111a457bec184d2a26eb70f8842894c7a539 100644 (file)
@@ -1162,6 +1162,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);
 
@@ -1183,7 +1185,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