]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: scrub repair does not clear earlier damage health status
authorNeeraj Pratap Singh <neesingh@redhat.com>
Thu, 17 Nov 2022 18:03:15 +0000 (23:33 +0530)
committerNeeraj Pratap Singh <Neeraj.Pratap.Singh1@ibm.com>
Thu, 2 Mar 2023 12:36:53 +0000 (18:06 +0530)
Fixes: https://tracker.ceph.com/issues/54557
Signed-off-by: Neeraj Pratap Singh <neesingh@redhat.com>
src/mds/CDir.cc
src/mds/CInode.cc
src/mds/DamageTable.cc
src/mds/DamageTable.h

index e6844cb7a4bdcbe33bd85af5210ffc830e93c073..f9aed746051f7e3f6eec0087a01f7521cb70f576 100644 (file)
@@ -3750,6 +3750,7 @@ bool CDir::scrub_local()
     mdcache->repair_dirfrag_stats(this);
     scrub_infop->header->set_repaired();
     good = true;
+    mdcache->mds->damage_table.remove_dentry_damage_entry(this);
   }
   return good;
 }
index 4ac963166e98d2fcbfb5c4c98f11616c54df057c..9aa3a8c67a8966009d2fba1fd602196096451dcb 100644 (file)
@@ -4783,6 +4783,7 @@ next:
                            false);
         // Flag that we repaired this BT so that it won't go into damagetable
         results->backtrace.repaired = true;
+        in->mdcache->mds->damage_table.remove_backtrace_damage_entry(in->ino());
         if (in->mdcache->mds->logger)
           in->mdcache->mds->logger->inc(l_mds_scrub_backtrace_repaired);
       }
@@ -4921,6 +4922,9 @@ next:
            << "freshly-calculated rstats don't match existing ones (will be fixed)";
          in->mdcache->repair_inode_stats(in);
           results->raw_stats.repaired = true;
+          for (const auto &p : in->dirfrags){
+            in->mdcache->mds->damage_table.remove_dirfrag_damage_entry(p.second);
+          }
        } else {
          results->raw_stats.error_str
            << "freshly-calculated rstats don't match existing ones";
index 22802079d85d4879b64bfdf71d3cbc4167b9cf69..2079d23333a835915d355a00953594549f4a9b44 100644 (file)
@@ -15,6 +15,7 @@
 #include "common/debug.h"
 
 #include "mds/CDir.h"
+#include "mds/CInode.h"
 
 #include "DamageTable.h"
 
@@ -200,6 +201,33 @@ bool DamageTable::notify_remote_damaged(inodeno_t ino, std::string_view path)
   return false;
 }
 
+void DamageTable::remove_dentry_damage_entry(CDir *dir)
+{
+  if (dentries.count(
+        DirFragIdent(dir->inode->ino(), dir->frag)
+        ) > 0){
+          const auto frag_dentries =
+            dentries.at(DirFragIdent(dir->inode->ino(), dir->frag));
+          for(const auto &i : frag_dentries) {
+            erase(i.second->id);
+          }
+        }
+}
+
+void DamageTable::remove_dirfrag_damage_entry(CDir *dir)
+{
+  if (is_dirfrag_damaged(dir)){
+    erase(dirfrags.find(DirFragIdent(dir->inode->ino(), dir->frag))->second->id);
+  }
+}
+
+void DamageTable::remove_backtrace_damage_entry(inodeno_t ino)
+{  
+  if (is_remote_damaged(ino)){
+    erase(remotes.find(ino)->second->id);
+  }  
+}
+
 bool DamageTable::oversized() const
 {
   return by_id.size() > (size_t)(g_conf()->mds_damage_table_max_entries);
index 18a61e08b1225fbfc2695703dda95d766615965b..a1b96fe2218642934b68e8fccdd45a6b33708188 100644 (file)
@@ -22,6 +22,7 @@
 #include "include/random.h"
 
 class CDir;
+class CInode;
 
 typedef uint64_t damage_entry_id_t;
 
@@ -155,6 +156,12 @@ class DamageTable
      */
     bool notify_remote_damaged(inodeno_t ino, std::string_view path);
 
+    void remove_dentry_damage_entry(CDir *dir);
+
+    void remove_dirfrag_damage_entry(CDir *dir);
+
+    void remove_backtrace_damage_entry(inodeno_t ino);
+
     bool is_dentry_damaged(
       const CDir *dir_frag,
       std::string_view dname,