From 844cacd3570e00948b429193a9ec4eada4062159 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Fri, 6 Mar 2020 02:02:39 +0300 Subject: [PATCH] Allow incorrectly forbidden BS_OP_LIST in readonly mode --- blockstore_impl.cpp | 2 +- blockstore_init.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/blockstore_impl.cpp b/blockstore_impl.cpp index 3ce4893b..96a4052d 100644 --- a/blockstore_impl.cpp +++ b/blockstore_impl.cpp @@ -304,7 +304,7 @@ void blockstore_impl_t::enqueue_op(blockstore_op_t *op, bool first) op->len > block_size-op->offset || (op->len % disk_alignment) )) || - readonly && op->opcode != BS_OP_READ || + readonly && op->opcode != BS_OP_READ && op->opcode != BS_OP_LIST || first && op->opcode == BS_OP_WRITE) { // Basic verification not passed diff --git a/blockstore_init.cpp b/blockstore_init.cpp index 284d1567..201e99b0 100644 --- a/blockstore_init.cpp +++ b/blockstore_init.cpp @@ -509,7 +509,9 @@ int blockstore_init_journal::handle_journal_part(void *buf, uint64_t done_pos, u if (data_crc32 != je->small_write.crc32_data) { // journal entry is corrupt, stop here - // interesting thing is that we must clear the corrupt entry if we're not readonly + // interesting thing is that we must clear the corrupt entry if we're not readonly, + // because we don't write next entries in the same journal block + printf("Journal entry data is corrupt (data crc32 %x != %x)\n", data_crc32, je->small_write.crc32_data); memset(buf + proc_pos - done_pos + pos, 0, bs->journal.block_size - pos); bs->journal.next_free = prev_free; init_write_buf = buf + proc_pos - done_pos;