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)
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
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;
}
}
}