diff options
author | dparmar18 <dparmar@redhat.com> | 2022-11-07 13:09:55 +0100 |
---|---|---|
committer | dparmar18 <dparmar@redhat.com> | 2022-12-22 16:05:54 +0100 |
commit | 59b26bad1667956e92d59f610afb6a1f9976df7c (patch) | |
tree | d0a75a346506923ed74b2a6e3f6704070ac437d2 /src/mon/FSCommands.cc | |
parent | Merge PR #49423 into main (diff) | |
download | ceph-59b26bad1667956e92d59f610afb6a1f9976df7c.tar.xz ceph-59b26bad1667956e92d59f610afb6a1f9976df7c.zip |
mds: add new feature to block clients from establishing sessions
Fixes: https://tracker.ceph.com/issues/57090
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
Diffstat (limited to 'src/mon/FSCommands.cc')
-rw-r--r-- | src/mon/FSCommands.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/mon/FSCommands.cc b/src/mon/FSCommands.cc index 5fd1f4a21de..0d9948fe151 100644 --- a/src/mon/FSCommands.cc +++ b/src/mon/FSCommands.cc @@ -681,6 +681,38 @@ public: fs->mds_map.set_min_compat_client(vno); }; fsmap.modify_filesystem(fs->fscid, std::move(f)); + } else if (var == "refuse_client_session") { + bool refuse_session = false; + int r = parse_bool(val, &refuse_session, ss); + if (r != 0) { + return r; + } + + if (refuse_session) { + if (!(fs->mds_map.test_flag(CEPH_MDSMAP_REFUSE_CLIENT_SESSION))) { + fsmap.modify_filesystem( + fs->fscid, + [](std::shared_ptr<Filesystem> fs) + { + fs->mds_map.set_flag(CEPH_MDSMAP_REFUSE_CLIENT_SESSION); + }); + ss << "client(s) blocked from establishing new session(s)"; + } else { + ss << "client(s) already blocked from establishing new session(s)"; + } + } else { + if (fs->mds_map.test_flag(CEPH_MDSMAP_REFUSE_CLIENT_SESSION)) { + fsmap.modify_filesystem( + fs->fscid, + [](std::shared_ptr<Filesystem> fs) + { + fs->mds_map.clear_flag(CEPH_MDSMAP_REFUSE_CLIENT_SESSION); + }); + ss << "client(s) allowed to establish new session(s)"; + } else { + ss << "client(s) already allowed to establish new session(s)"; + } + } } else { ss << "unknown variable " << var; return -EINVAL; |