Fix qemu-img broken in 0.5.11

Caused by the lack of reenterability of the main cluster_client function
rel-0.5
Vitaliy Filippov 2021-04-08 10:52:21 +03:00
parent 462650134e
commit efb3678606
3 changed files with 26 additions and 1 deletions

View File

@ -95,6 +95,14 @@ void cluster_client_t::continue_ops(bool up_retry)
// We're offline
return;
}
if (continuing_ops)
{
// Attempt to reenter the function
continuing_ops = 2;
return;
}
restart:
continuing_ops = 1;
bool has_flushes = false, has_writes = false;
int j = 0;
for (int i = 0; i < op_queue.size(); i++)
@ -141,6 +149,14 @@ void cluster_client_t::continue_ops(bool up_retry)
}
}
op_queue.resize(j);
if (continuing_ops == 2)
{
goto restart;
}
else
{
continuing_ops = 0;
}
}
static uint32_t is_power_of_two(uint64_t value)

View File

@ -82,6 +82,7 @@ class cluster_client_t
bool pgs_loaded = false;
ring_consumer_t consumer;
std::vector<std::function<void(void)>> on_ready_hooks;
int continuing_ops = 0;
public:
etcd_state_client_t st_cli;

View File

@ -35,6 +35,14 @@ fi
# fio -thread -name=test -ioengine=build/src/libfio_vitastor_sec.so -bs=4k -fsync=128 `$ETCDCTL get /vitastor/osd/state/1 --print-value-only | jq -r '"-host="+.addresses[0]+" -port="+(.port|tostring)'` -rw=write -size=32M
LD_PRELOAD=libasan.so.5 \
fio -thread -name=test -ioengine=build/src/libfio_vitastor.so -bs=4M -direct=1 -iodepth=1 -fsync=1 -rw=write -etcd=$ETCD_URL -pool=1 -inode=1 -size=1G -cluster_log_level=10
fio -thread -name=test -ioengine=build/src/libfio_vitastor.so -bs=4M -direct=1 -iodepth=1 -fsync=1 -rw=write -etcd=$ETCD_URL -pool=1 -inode=1 -size=128M -cluster_log_level=10
qemu-img convert -S 4096 -p \
-f raw "vitastor:etcd_host=127.0.0.1\:$ETCD_PORT/v3:pool=1:inode=1:size=$((128*1024*1024))" \
-O raw ./testdata/read.bin
qemu-img convert -S 4096 -p \
-f raw ./testdata/read.bin \
-O raw "vitastor:etcd_host=127.0.0.1\:$ETCD_PORT/v3:pool=1:inode=1:size=$((128*1024*1024))"
format_green OK