From: Patrick Donnelly Date: Thu, 2 May 2024 12:55:36 +0000 (-0400) Subject: mds: refactor out fs_name match in MDSAuthCaps X-Git-Tag: v18.2.4~45 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e039328c7db325824c84a61084365d12d5939615;p=ceph.git mds: refactor out fs_name match in MDSAuthCaps Signed-off-by: Patrick Donnelly (cherry picked from commit 247b4fed28617c104473d1586b66a8735bff0411) (cherry picked from commit 1399fafd220453b706af65e3a5b5dba16ea1a37a) --- diff --git a/src/mds/MDSAuthCaps.h b/src/mds/MDSAuthCaps.h index bbb2589b3a8d7..2556127dc22ec 100644 --- a/src/mds/MDSAuthCaps.h +++ b/src/mds/MDSAuthCaps.h @@ -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; }