]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/Server.cc: Don't evict a slow client if... 12935/head
authorMichal Jarzabek <stiopa@gmail.com>
Sun, 15 Jan 2017 15:32:04 +0000 (15:32 +0000)
committerMichal Jarzabek <stiopa@gmail.com>
Sun, 23 Apr 2017 12:31:47 +0000 (13:31 +0100)
... it's the only client

Fixes: http://tracker.ceph.com/issues/17855
Signed-off-by: Michal Jarzabek <stiopa@gmail.com>
qa/tasks/cephfs/test_misc.py
src/mds/Server.cc

index 3f98c3719b88c6898ec26461942e3a96da319a98..a48e0a2a63b73c785c5786d0101564b04c4c5e2f 100644 (file)
@@ -4,9 +4,14 @@ from tasks.cephfs.fuse_mount import FuseMount
 from tasks.cephfs.cephfs_test_case import CephFSTestCase
 from teuthology.orchestra.run import CommandFailedError
 import errno
+import time
 
 class TestMisc(CephFSTestCase):
     CLIENTS_REQUIRED = 2
+
+    LOAD_SETTINGS = ["mds_session_autoclose"]
+    mds_session_autoclose = None
+
     def test_getattr_caps(self):
         """
         Check if MDS recognizes the 'mask' parameter of open request.
@@ -89,3 +94,37 @@ class TestMisc(CephFSTestCase):
         self.fs.mon_manager.raw_cluster_cmd('fs', 'new', self.fs.name,
                                             self.fs.metadata_pool_name,
                                             data_pool_name)
+
+    def test_evict_client(self):
+        """
+        Check that a slow client session won't get evicted if it's the
+        only session
+        """
+
+        self.mount_b.umount_wait();
+        ls_data = self.fs.mds_asok(['session', 'ls'])
+        self.assert_session_count(1, ls_data)
+
+        self.mount_a.kill();
+        self.mount_a.kill_cleanup();
+
+        time.sleep(self.mds_session_autoclose * 1.5)
+        ls_data = self.fs.mds_asok(['session', 'ls'])
+        self.assert_session_count(1, ls_data)
+
+        self.mount_a.mount()
+        self.mount_a.wait_until_mounted()
+        self.mount_b.mount()
+        self.mount_b.wait_until_mounted()
+
+        ls_data = self._session_list()
+        self.assert_session_count(2, ls_data)
+
+        self.mount_a.kill()
+        self.mount_a.kill()
+        self.mount_b.kill_cleanup()
+        self.mount_b.kill_cleanup()
+
+        time.sleep(self.mds_session_autoclose * 1.5)
+        ls_data = self.fs.mds_asok(['session', 'ls'])
+        self.assert_session_count(1, ls_data)
index d62720b46096ad6f3559f006c1c02a42d946d546..48e1e5aa03096fae29ec0d6b245dddc32538470c 100644 (file)
@@ -651,6 +651,13 @@ void Server::find_idle_sessions()
     return;
   }
 
+  if (mds->sessionmap.get_sessions().size() == 1 &&
+      mds->mdsmap->get_num_in_mds() == 1) {
+    dout(20) << "not evicting a slow client, because there is only one"
+             << dendl;
+    return;
+  }
+
   while (1) {
     Session *session = mds->sessionmap.get_oldest_session(Session::STATE_STALE);
     if (!session)