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: v19.1.1~326^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=553c23df8c1cac113a6dc5a3e693e6e78122e0a8;p=ceph.git mds: refactor out fs_name match in MDSAuthCaps Signed-off-by: Patrick Donnelly (cherry picked from commit 247b4fed28617c104473d1586b66a8735bff0411) --- diff --git a/src/mds/MDSAuthCaps.h b/src/mds/MDSAuthCaps.h index c1d410eaf76f..9172e266aab6 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); @@ -275,8 +279,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; }