]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs: Add option to load invalid metadata from disk
authorDouglas Fuller <dfuller@redhat.com>
Wed, 24 Jan 2018 16:09:45 +0000 (11:09 -0500)
committerDouglas Fuller <dfuller@redhat.com>
Thu, 25 Jan 2018 17:51:54 +0000 (12:51 -0500)
Add an option, mds_allow_loading_invalid_metadata, for testing
to bypass sanity checks on metadata loaded from RAODS. This permits
testing cases in which metadata damage causes issuses in a running
MDS.

Signed-off-by: Douglas Fuller <dfuller@redhat.com>
src/common/options.cc
src/mds/CDir.cc
src/mds/CInode.h

index 71d97704c2e7cf6d7900fdb95cd0088c7592c5a4..6314fce8dbd7ea453f6ebeef5e909b62a5ad0f95 100644 (file)
@@ -6560,9 +6560,12 @@ std::vector<Option> get_mds_options() {
     .set_default(100)
     .set_description("minimum number of capabilities a client may hold"),
 
-    Option("mds_max_ratio_caps_per_client", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
+    Option("mds_max_ratio_caps_per_client", Option::TYPE_FLOAT, Option::LEVEL_DEV)
     .set_default(.8)
     .set_description("maximum ratio of current caps that may be recalled during MDS cache pressure"),
+    Option("mds_hack_allow_loading_invalid_metadata", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+     .set_default(0)
+     .set_description("INTENTIONALLY CAUSE DATA LOSS by bypasing checks for invalid metadata on disk. Allows testing repair tools."),
   });
 }
 
index 5d530603fdb25c3d6833fe50833aaf328bd6f500..54f23702685f74635d281bfec746c34cd98586e6 100644 (file)
@@ -1791,6 +1791,9 @@ CDentry *CDir::_load_dentry(
         //in->hack_accessed = false;
         //in->hack_load_stamp = ceph_clock_now();
         //num_new_inodes_loaded++;
+      } else if (g_conf->get_val<bool>("mds_hack_allow_loading_invalid_metadata")) {
+       dout(20) << "hack: adding duplicate dentry for " << *in << dendl;
+       dn = add_primary_dentry(dname, in, first, last);
       } else {
         dout(0) << "_fetched  badness: got (but i already had) " << *in
                 << " mode " << in->inode.mode
index 732bd390ae81b0fa18ba46e49533bc423accaabf..2090aa4e90c46ffaaf9144f9162d8ca48b57eb2f 100644 (file)
@@ -1071,7 +1071,8 @@ public:
   // -- hierarchy stuff --
 public:
   void set_primary_parent(CDentry *p) {
-    assert(parent == 0);
+    assert(parent == 0 ||
+          g_conf->get_val<bool>("mds_hack_allow_loading_invalid_metadata"));
     parent = p;
   }
   void remove_primary_parent(CDentry *dn) {