From 63efe94ce9b76280fdc6ba896fb37ad63afac531 Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Sat, 30 Oct 2021 20:05:35 +0200 Subject: [PATCH] os/bluestore/bluefs: Fix incorrect file capture in compact_log_async It was possible to skip capture of file that was recently modified. New procedure under one log.lock flushed pending files and captures state. It is much less interruptible then I had hoped for but I cannot now do it better. Signed-off-by: Adam Kupczyk (cherry picked from commit a296989b54083633af733c517f01fe2abf4b73ff) --- src/os/bluestore/BlueFS.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 3ea840294e8bb..bb4f46c9dc24d 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -2264,11 +2264,11 @@ void BlueFS::compact_log_async_dump_metadata_NF(bluefs_transaction_t *t, std::lock_guard fl(file_ref->lock); if (file_ref->dirty_seq < capture_before_seq) { dout(20) << __func__ << " op_file_update " << file_ref->fnode << dendl; - t->op_file_update(file_ref->fnode); } else { - dout(20) << __func__ << " skipping just modified, dirty_seq=" + dout(20) << __func__ << " op_file_update just modified, dirty_seq=" << file_ref->dirty_seq << " " << file_ref->fnode << dendl; } + t->op_file_update(file_ref->fnode); } for (auto& [path, dir_ref] : nodes.dir_map) { dout(20) << __func__ << " op_dir_create " << path << dendl; @@ -2476,12 +2476,16 @@ void BlueFS::_compact_log_async_LD_NF_D() //also locks FW for new_writer _flush_bdev(); _flush_and_sync_log_jump_D(old_log_jump_to, runway); - log.lock.unlock(); - // out of jump section - now log can be used to write to + // out of jump section // 2. prepare compacted log bluefs_transaction_t t; compact_log_async_dump_metadata_NF(&t, seq_now); + + // now state is captured to bufferlist + // log can be used to write to, ops in log will be continuation of captured state + log.lock.unlock(); + uint64_t max_alloc_size = std::max(alloc_size[BDEV_WAL], std::max(alloc_size[BDEV_DB], alloc_size[BDEV_SLOW])); -- 2.39.5