]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa: test file create on damaged directory
authorPatrick Donnelly <pdonnell@ibm.com>
Tue, 28 Jan 2025 17:03:14 +0000 (12:03 -0500)
committerIgor Golikov <igolikov@redhat.com>
Wed, 15 Oct 2025 11:53:51 +0000 (11:53 +0000)
Fixes: https://tracker.ceph.com/issues/69695
Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
(cherry picked from commit c4bd8194ec482db7315c79e1c35f55de2c5457b4)

qa/tasks/cephfs/test_damage.py
src/mds/MDCache.cc

index 26f284ed81f9b07d19df2fcae6490556b9b210b4..7bb51f196d66f3148124d15b8aea747ddfda2388 100644 (file)
@@ -662,3 +662,33 @@ class TestDamage(CephFSTestCase):
         self.mount_a.mount_wait()
         self.mount_a.run_shell_payload("stat a/ && find a/")
         self.fs.flush()
+
+    def test_missing_dirfrag_create(self):
+        """
+        That the MDS won't let you manipulate dentries in a missing dirfrag.
+        """
+
+        self.mount_a.run_shell_payload("mkdir -p dir_x/dir_xx/dir_xxx/")
+        self.mount_a.run_shell_payload("touch dir_x/dir_xx/dir_xxx/file_y")
+        self.mount_a.umount()
+        d = self.fs.read_cache("dir_x/dir_xx", depth=0)
+        self.fs.flush()
+        time.sleep(5)
+        self.fs.flush() # EUpdate scatter_writebehind
+        self.fs.fail()
+        dirfrag_obj = "{0:x}.00000000".format(d[0]['ino'])
+        self.fs.radosm(["rm", dirfrag_obj]),
+        self.fs.set_joinable()
+        self.fs.wait_for_daemons()
+        self.mount_a.mount_wait()
+        try:
+            p = self.mount_a.run_shell_payload("touch dir_x/dir_xx/file_x", wait=False)
+            # CDir.cc: 1438: FAILED ceph_assert(get_version() < pv)
+            wait([p], 20)
+            self.fs.flush()
+        except MaxWhileTries:
+            self.fail("MDS probably crashed")
+        except CommandFailedError:
+            self.assertTrue("Input/output error" in p.stderr.getvalue())
+        else:
+            self.fail("command should fail")
index 810d568ef13f0174363408b4413c31ab201debbf..5050579b38116712d2e73d87431e92578b4fe92e 100644 (file)
@@ -8391,7 +8391,7 @@ int MDCache::path_traverse(MDRequestRef& mdr, MDSContextFactory& cf,
     if (mds->damage_table.is_dirfrag_damaged(curdir)) {
       dout(4) << "traverse: stopped lookup at dirfrag "
               << *curdir << "/" << path[depth] << " snap=" << snapid << dendl;
-      return -CEPHFS_EIO;
+      return -EIO;
     }
 
 #ifdef MDS_VERIFY_FRAGSTAT