Skip to content

Commit

Permalink
mds: refactor out fs_name match in MDSAuthCaps
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 247b4fe)
  • Loading branch information
batrick committed May 9, 2024
1 parent 22342c7 commit 1399faf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/mds/MDSAuthCaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -261,8 +265,7 @@ class MDSAuthCaps
}

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;
}
Expand Down

0 comments on commit 1399faf

Please sign in to comment.