From: Patrick Donnelly Date: Wed, 16 Jun 2021 16:30:41 +0000 (-0700) Subject: mon/MDSMonitor: check fscid exists for legacy case X-Git-Tag: v17.1.0~1608^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F41899%2Fhead;p=ceph.git mon/MDSMonitor: check fscid exists for legacy case If a client does not have permission to see the legacy fs, the monitor will throw an exception when looking up the mdsmap later in the code. We need to check existence for both code paths. Fixes: https://tracker.ceph.com/issues/51077 Signed-off-by: Patrick Donnelly --- diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 4af783ba93f8..07a790fc1790 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -1755,15 +1755,6 @@ void MDSMonitor::check_sub(Subscription *sub) << "'" << dendl; return; } - if (fsmap.filesystems.count(fscid) == 0) { - // Client asked for a non-existent namespace, send them nothing - // TODO: something more graceful for when a client has a filesystem - // mounted, and the fileysstem is deleted. Add a "shut down you fool" - // flag to MMDSMap? - dout(1) << "Client subscribed to non-existent namespace '" << - fscid << "'" << dendl; - return; - } } else { // Unqualified request for "mdsmap": give it the one marked // for use by legacy clients. @@ -1775,6 +1766,15 @@ void MDSMonitor::check_sub(Subscription *sub) return; } } + if (!fsmap.filesystem_exists(fscid)) { + // Client asked for a non-existent namespace, send them nothing + // TODO: something more graceful for when a client has a filesystem + // mounted, and the fileysstem is deleted. Add a "shut down you fool" + // flag to MMDSMap? + dout(1) << "Client subscribed to non-existent namespace '" << + fscid << "'" << dendl; + return; + } } dout(10) << __func__ << ": is_mds=" << is_mds << ", fscid= " << fscid << dendl;