Skip to content

Commit

Permalink
test/librbd/fsx: wait for resize to propagate in krbd_resize()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Prasanna Kumar Kalever committed Oct 26, 2023
1 parent dbb4daf commit 5f9aead
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/test/librbd/fsx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -1183,7 +1185,30 @@ 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;

while (count++ < 10) {
ret = krbd_get_size(ctx, &effective_size);
if (ret < 0) {
prt("krbd_get_size failed\n");
return ret;
}

ret = 0;
if (size != effective_size) {
prt("Sizes: expected (0x%llx), effective (0x%llx)\n",
(unsigned long long)size,
(unsigned long long)effective_size);
sleep(count);
ret = -EINVAL;
continue;
}
break;
};

return ret;
}

int
Expand Down

0 comments on commit 5f9aead

Please sign in to comment.