Merge pull request #12935 from stiopaa1/17855_evictClient

mds/Server.cc: Don't evict a slow client if...

Reviewed-by: John Spray <john.spray@redhat.com>
This commit is contained in:
John Spray 2017-04-24 22:10:01 +01:00 committed by GitHub
commit d0d3a4a02e
2 changed files with 46 additions and 0 deletions

View 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)

View 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)