]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: referent inode test - link w/ max_mds=1
authorVenky Shankar <vshankar@redhat.com>
Fri, 21 Feb 2025 04:59:12 +0000 (04:59 +0000)
committerKotresh HR <khiremat@redhat.com>
Tue, 4 Mar 2025 11:15:57 +0000 (16:45 +0530)
Add the basic referent inode link test.

Fixes: https://tracker.ceph.com/issues/69339
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Signed-off-by: Kotresh HR <khiremat@redhat.com>
qa/suites/fs/functional/tasks/referent.yaml [new file with mode: 0644]
qa/tasks/cephfs/test_referent.py [new file with mode: 0644]

diff --git a/qa/suites/fs/functional/tasks/referent.yaml b/qa/suites/fs/functional/tasks/referent.yaml
new file mode 100644 (file)
index 0000000..dfaca4a
--- /dev/null
@@ -0,0 +1,4 @@
+tasks:
+  - cephfs_test_runner:
+      modules:
+        - tasks.cephfs.test_referent
diff --git a/qa/tasks/cephfs/test_referent.py b/qa/tasks/cephfs/test_referent.py
new file mode 100644 (file)
index 0000000..c7b49d7
--- /dev/null
@@ -0,0 +1,69 @@
+import logging
+import time
+
+log = logging.getLogger(__name__)
+
+from tasks.cephfs.cephfs_test_case import CephFSTestCase
+from tasks.cephfs.filesystem import ObjectNotFound
+
+class TestReferentInode(CephFSTestCase):
+    MDSS_REQUIRED = 1
+    CLIENTS_REQUIRED = 1
+
+    def test_referent_link(self):
+        """
+        test_referent_link - Test creation of referent inode and backtrace on link
+        """
+
+        self.fs.set_allow_referent_inodes(True);
+        self.mount_a.run_shell(["mkdir", "dir0"])
+        self.mount_a.run_shell(["touch", "dir0/file1"])
+        self.mount_a.run_shell(["ln", "dir0/file1", "dir0/hardlink_file1"])
+        file_ino = self.mount_a.path_to_ino("dir0/file1")
+
+        # write out the backtrace - this would writeout the backrace
+        # of the newly introduced referent inode to the data pool.
+        self.fs.mds_asok(["flush", "journal"])
+
+        # read the primary inode
+        dir_ino = self.mount_a.path_to_ino("dir0")
+        file1_inode = self.fs.read_meta_inode(dir_ino, "file1")
+
+        # read the referent inode from metadata pool
+        referent_inode = self.fs.read_meta_inode(dir_ino, "hardlink_file1")
+
+        self.assertFalse(file1_inode['ino'] == referent_inode['ino'])
+
+        # reverse link - the real inode should track the referent inode number
+        self.assertIn(referent_inode['ino'], file1_inode['referent_inodes'])
+        # link - the referent inode should point to real inode
+        self.assertEqual(referent_inode['remote_ino'], file_ino)
+
+        # backtrace of referent inode from data pool
+        backtrace = self.fs.read_backtrace(referent_inode['ino'])
+        # path validation
+        self.assertEqual(['hardlink_file1', 'dir0'], [a['dname'] for a in backtrace['ancestors']])
+        # inode validation
+        self.assertEqual(referent_inode['ino'], backtrace['ino'])
+        self.assertEqual([dir_ino, 1], [a['dirino'] for a in backtrace['ancestors']])
+
+    def test_hardlink_reintegration_with_referent(self):
+        pass
+
+    def test_multiple_referent_post_reintegration(self):
+        pass
+
+    def test_rename_a_referent_dentry(self):
+        pass
+
+    def test_referent_with_mds_killpoints(self):
+        pass
+
+    def test_referent_with_snapshot(self):
+        pass
+
+    def test_referent_with_mdlog_replay(self):
+        pass
+
+    def test_referent_no_caps(self):
+        pass