]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: Add ability to ignore BlueFS zombie files
authorAdam Kupczyk <akupczyk@ibm.com>
Mon, 31 Mar 2025 11:38:08 +0000 (13:38 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 22 Sep 2025 09:48:09 +0000 (09:48 +0000)
Under normal circumstances BlueFS _replay() procedure
does not allow for zombie files to be present.
Zombie files are files that are declared but are not attached to any name+dir.
One exception if special BlueFS Log file (ino 1).

This change introduces configurable 'bluefs_log_replay_remove_zombie_files'.
When set to 'true', instead of refusing to mount, BlueFS logs the error and ignores the file.
This is equivalent of removing it, with the distinction being that until BlueFS log is
compacted, one cannot revert the option back, or the problem will reemerge.

Resolves: rhbz#2354192

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
(cherry picked from commit ea677e0c43e0439e2afd7e8b95c8a1be7f2dba25)
(cherry picked from commit 53d95a2f5949305fa3442a75fb3fb421266fb329)

src/common/options/global.yaml.in
src/os/bluestore/BlueFS.cc

index 9d089ea774cd723346507738a038a005d12bb5c5..7b41733250073cff7675fb939769302844db9d97 100644 (file)
@@ -4284,6 +4284,13 @@ options:
   desc: Enables checks for allocations consistency during log replay
   default: true
   with_legacy: true
+- name: bluefs_log_replay_remove_zombie_files
+  type: bool
+  level: advanced
+  desc: BlueFS refuses to mount if zombie files are present.
+    When option is on (true) detected zombie files are ignored (will be purged on bluefs log compaction).
+  default: false
+  with_legacy: true
 - name: bluefs_replay_recovery
   type: bool
   level: dev
index b27e22abd3379581ec10fb2be091beb3d9fc120a..52fbe6dd10499ab070c98ad7406711b906d6c843 100644 (file)
@@ -1882,12 +1882,24 @@ int BlueFS::_replay(bool noop, bool to_stdout)
 
   if (!noop) {
     // verify file link counts are all >0
-    for (auto& p : nodes.file_map) {
-      if (p.second->refs == 0 &&
-         p.second->fnode.ino > 1) {
-       derr << __func__ << " file with link count 0: " << p.second->fnode
-            << dendl;
-       return -EIO;
+    bool all_ok = true;
+    auto p = nodes.file_map.begin();
+    while (p != nodes.file_map.end()) {
+      if (p->second->refs == 0 &&
+          p->second->fnode.ino > 1) {
+        derr << __func__ << " file with link count 0: " << p->second->fnode
+          << dendl;
+        all_ok = false;
+        p = nodes.file_map.erase(p);
+      } else {
+        ++p;
+      }
+    }
+    if (!all_ok) {
+      if (cct->_conf->bluefs_log_replay_remove_zombie_files) {
+        derr << __func__ << " zombie file(s) ignored = removed" << dendl;
+      } else {
+        return -EIO;
       }
     }
   }