Browse Source

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 4 months ago
parent
commit
efb3678606
  1. 16
      src/cluster_client.cpp
  2. 1
      src/cluster_client.h
  3. 10
      tests/test_write.sh

16
src/cluster_client.cpp

@ -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)

1
src/cluster_client.h

@ -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;

10
tests/test_write.sh

@ -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
Loading…
Cancel
Save