Skip to content

Commit 6f3d0f5

Browse files
author
Prasanna Kumar Kalever
committed
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 <[email protected]>
1 parent dbb4daf commit 6f3d0f5

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/test/librbd/fsx.cc

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,8 @@ int
11621162
krbd_resize(struct rbd_ctx *ctx, uint64_t size)
11631163
{
11641164
int ret;
1165+
int count = 0;
1166+
uint64_t effective_size;
11651167

11661168
ceph_assert(size % truncbdy == 0);
11671169

@@ -1183,7 +1185,29 @@ krbd_resize(struct rbd_ctx *ctx, uint64_t size)
11831185
if (ret < 0)
11841186
return ret;
11851187

1186-
return __librbd_resize(ctx, size);
1188+
ret = __librbd_resize(ctx, size);
1189+
if (ret < 0)
1190+
return ret;
1191+
1192+
for (;;) {
1193+
ret = krbd_get_size(ctx, &effective_size);
1194+
if (ret < 0)
1195+
return ret;
1196+
1197+
if (effective_size == size)
1198+
break;
1199+
1200+
if (count++ >= 15) {
1201+
prt("BLKGETSIZE64 size error: expected 0x%llx, actual 0x%llx\n",
1202+
(unsigned long long)size,
1203+
(unsigned long long)effective_size);
1204+
return -EINVAL;
1205+
}
1206+
1207+
usleep(count * 250 * 1000);
1208+
}
1209+
1210+
return 0;
11871211
}
11881212

11891213
int

0 commit comments

Comments
 (0)