]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/bluefs: Fix incorrect file capture in compact_log_async
authorAdam Kupczyk <akupczyk@redhat.com>
Sat, 30 Oct 2021 18:05:35 +0000 (20:05 +0200)
committerIgor Fedotov <igor.fedotov@croit.io>
Tue, 27 Jun 2023 10:56:26 +0000 (13:56 +0300)
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 <akupczyk@redhat.com>
(cherry picked from commit a296989b54083633af733c517f01fe2abf4b73ff)

src/os/bluestore/BlueFS.cc

index 3ea840294e8bbb0344d6a7ad3fd4008704a298ad..bb4f46c9dc24dce16bb4ba5925e39f5eb157ea55 100644 (file)
@@ -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]));