]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: refactor out fs_name match in MDSAuthCaps
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 2 May 2024 12:55:36 +0000 (08:55 -0400)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 14 May 2024 15:50:05 +0000 (17:50 +0200)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 247b4fed28617c104473d1586b66a8735bff0411)
(cherry picked from commit 1399fafd220453b706af65e3a5b5dba16ea1a37a)

src/mds/MDSAuthCaps.h

index bbb2589b3a8d719a41f6efb87f001a024788dfce..2556127dc22ec8b17f9998f19130371d7664f775 100644 (file)
@@ -146,6 +146,10 @@ struct MDSCapMatch {
    */
   bool match_path(std::string_view target_path) const;
 
+  bool match_fs(std::string_view target_fs) const {
+    return fs_name == target_fs || fs_name.empty() || fs_name == "*";
+  }
+
   void encode(ceph::buffer::list& bl) const {
     ENCODE_START(1, 1, bl);
     encode(uid, bl);
@@ -261,8 +265,7 @@ public:
     }
 
     for (const MDSCapGrant &g : grants) {
-      if (g.match.fs_name == fs_name || g.match.fs_name.empty() ||
-         g.match.fs_name == "*") {
+      if (g.match.match_fs(fs_name)) {
        if (mask & MAY_READ && g.spec.allow_read()) {
          return true;
        }