From 0af077701ce92155cd373f1cc20672bc3dd9c2cf Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Thu, 15 Apr 2021 01:58:25 +0300 Subject: [PATCH] Fix a possible crash during SYNC when journal fsyncs are enabled --- src/blockstore_sync.cpp | 1 + tests/test_write.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/blockstore_sync.cpp b/src/blockstore_sync.cpp index 2ee01a44..5c939b08 100644 --- a/src/blockstore_sync.cpp +++ b/src/blockstore_sync.cpp @@ -146,6 +146,7 @@ int blockstore_impl_t::continue_sync(blockstore_op_t *op, bool queue_has_in_prog my_uring_prep_fsync(sqe, journal.fd, IORING_FSYNC_DATASYNC); data->iov = { 0 }; data->callback = [this, op](ring_data_t *data) { handle_sync_event(data, op); }; + PRIV(op)->min_flushed_journal_sector = PRIV(op)->max_flushed_journal_sector = 0; PRIV(op)->pending_ops = 1; PRIV(op)->op_state = SYNC_JOURNAL_SYNC_SENT; return 1; diff --git a/tests/test_write.sh b/tests/test_write.sh index 1f0e4d9f..c8553e6b 100755 --- a/tests/test_write.sh +++ b/tests/test_write.sh @@ -39,6 +39,12 @@ if ! cmp build/src/block-vitastor.so /usr/lib/x86_64-linux-gnu/qemu/block-vitast sudo ln -s "$(realpath .)/build/src/block-vitastor.so" /usr/lib/x86_64-linux-gnu/qemu/block-vitastor.so fi +# A lot of parallel syncs was crashing the primary OSD at some point + +LD_PRELOAD=libasan.so.5 \ + fio -thread -name=test -ioengine=build/src/libfio_vitastor.so -bs=4k -direct=1 -numjobs=64 -iodepth=1 -fsync=1 \ + -rw=randwrite -etcd=$ETCD_URL -pool=1 -inode=1 -size=128M -number_ios=100 + 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=128M -cluster_log_level=10