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: v20.0.0~1998^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=247b4fed28617c104473d1586b66a8735bff0411;p=ceph.git mds: refactor out fs_name match in MDSAuthCaps Signed-off-by: Patrick Donnelly --- diff --git a/src/mds/MDSAuthCaps.h b/src/mds/MDSAuthCaps.h index 26958b49acd3..bca063ecb33f 100644 --- a/src/mds/MDSAuthCaps.h +++ b/src/mds/MDSAuthCaps.h @@ -158,6 +158,10 @@ struct MDSCapMatch { bool match_path(std::string_view target_path) const; std::string to_string(); + 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); @@ -276,8 +280,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; }