]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MDSMonitor: check fscid exists for legacy case 42068/head
authorPatrick Donnelly <pdonnell@redhat.com>
Wed, 16 Jun 2021 16:30:41 +0000 (09:30 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 28 Jun 2021 19:47:47 +0000 (12:47 -0700)
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 <pdonnell@redhat.com>
(cherry picked from commit 75ccd9d49c78bacf73b9e61d99a75fb455a8b85f)

src/mon/MDSMonitor.cc

index 40cb07127ac339fd0885cbc7796d2e28013ffb95..9b07ee1d1a020b12a12e63d0543c190e17c1c3dd 100644 (file)
@@ -1738,15 +1738,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.
@@ -1758,6 +1749,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;