]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tests: test if unresponsive MDS client with no caps is evicted directly 30239/head
authorRishabh Dave <ridave@redhat.com>
Wed, 16 Jan 2019 11:56:13 +0000 (17:26 +0530)
committerNathan Cutler <ncutler@suse.com>
Sat, 7 Sep 2019 09:00:10 +0000 (11:00 +0200)
Test if an unresponsive MDS client session holding no caps is evicted
directly at session_autoclose without being marked as stale at
session_timeout.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit 80152465b565519e7d5d83a9ddbcc96d805470bf)

Conflicts:
qa/tasks/cephfs/test_client_recovery.py
- no "test_abort_conn()" method in mimic, since "client: introduce
  ceph_abort_conn() PR#22543" is not being backported

qa/tasks/cephfs/test_client_recovery.py

index c70e224714eda00ca568e3f5a37975640f7a51db..902dd3caa74477da8f9aef9b7b6dfa28af1d9840 100644 (file)
@@ -519,3 +519,37 @@ class TestClientRecovery(CephFSTestCase):
         self.mount_b.client_remote.run(args=["sudo", "kill", "-CONT", mount_b_pid])
         # Is the new file visible from mount_b? (caps become invalid after session stale)
         self.mount_b.run_shell(["ls", "testdir/file2"])
+
+    def test_dont_mark_unresponsive_client_stale(self):
+        """
+        Test that an unresponsive client holding caps is not marked stale or
+        evicted unless another clients wants its caps.
+        """
+        if not isinstance(self.mount_a, FuseMount):
+            self.skipTest("Require FUSE client to handle signal STOP/CONT")
+
+        # XXX: To conduct this test we need at least two clients since a
+        # single client is never evcited by MDS.
+        SESSION_TIMEOUT = 30
+        SESSION_AUTOCLOSE = 50
+        time_at_beg = time.time()
+        mount_a_gid = self.mount_a.get_global_id()
+        mount_a_pid = self.mount_a.client_pid
+        self.fs.set_var('session_timeout', SESSION_TIMEOUT)
+        self.fs.set_var('session_autoclose', SESSION_AUTOCLOSE)
+        self.assert_session_count(2, self.fs.mds_asok(['session', 'ls']))
+
+        # test that client holding cap not required by any other client is not
+        # marked stale when it becomes unresponsive.
+        self.mount_a.run_shell(['mkdir', 'dir'])
+        self.mount_a.send_signal('sigstop')
+        time.sleep(SESSION_TIMEOUT + 2)
+        self.assert_session_state(mount_a_gid, "open")
+
+        # test that other clients have to wait to get the caps from
+        # unresponsive client until session_autoclose.
+        self.mount_b.run_shell(['stat', 'dir'])
+        self.assert_session_count(1, self.fs.mds_asok(['session', 'ls']))
+        self.assertLess(time.time(), time_at_beg + SESSION_AUTOCLOSE)
+
+        self.mount_a.send_signal('sigcont')