Skip to content

mon/AuthMonitor: add osd w cap for superuser client#67406

Merged
vshankar merged 2 commits intoceph:mainfrom
batrick:i75013
Mar 20, 2026
Merged

mon/AuthMonitor: add osd w cap for superuser client#67406
vshankar merged 2 commits intoceph:mainfrom
batrick:i75013

Conversation

@batrick
Copy link
Member

@batrick batrick commented Feb 18, 2026

Right now only a client with "rw" permissions on an MDS gets "rw" on an OSD.

Reported-by: John Mulligan jmulligan@redhat.com
Fixes: https://tracker.ceph.com/issues/75013

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@batrick
Copy link
Member Author

batrick commented Feb 19, 2026

jenkins test api

@phlogistonjohn
Copy link
Contributor

Hi @batrick
I did a build that includes my branch as well as this PR and ran the smb sub-suite in teuthology. I have some tests that use only the lower level parts of cephadm (as opposed to going through the smb mgr module).

Those tests execute: ceph fs authorize cephfs client.smbdata / rw those tests hit the following error:

ceph.client.admin.keyring --fsid 998b7c2f-1002-11f1-8f98-d404e6e7d460 -- bash -c 'ceph fs authorize cephfs client.smbdata / rw'
2026-02-22T15:26:04.093 INFO:teuthology.orchestra.run.trial017.stderr:Inferring config /var/lib/ceph/998b7c2f-1002-11f1-8f98-d404e6e7d460/mon.a/config
2026-02-22T15:26:04.353 INFO:teuthology.orchestra.run.trial017.stderr:Error EINVAL: osd capability parse failed, stopped at 'w tag cephfs data=cephfs' of 'allow rww tag cephfs data=cephfs'
2026-02-22T15:26:04.487 DEBUG:teuthology.orchestra.run:got remote process result: 22

In case it helps when I merged the commit id of your change was 186f068

@batrick
Copy link
Member Author

batrick commented Feb 23, 2026

Hi @batrick I did a build that includes my branch as well as this PR and ran the smb sub-suite in teuthology. I have some tests that use only the lower level parts of cephadm (as opposed to going through the smb mgr module).

Those tests execute: ceph fs authorize cephfs client.smbdata / rw those tests hit the following error:

ceph.client.admin.keyring --fsid 998b7c2f-1002-11f1-8f98-d404e6e7d460 -- bash -c 'ceph fs authorize cephfs client.smbdata / rw'
2026-02-22T15:26:04.093 INFO:teuthology.orchestra.run.trial017.stderr:Inferring config /var/lib/ceph/998b7c2f-1002-11f1-8f98-d404e6e7d460/mon.a/config
2026-02-22T15:26:04.353 INFO:teuthology.orchestra.run.trial017.stderr:Error EINVAL: osd capability parse failed, stopped at 'w tag cephfs data=cephfs' of 'allow rww tag cephfs data=cephfs'
2026-02-22T15:26:04.487 DEBUG:teuthology.orchestra.run:got remote process result: 22

In case it helps when I merged the commit id of your change was 186f068

Apologies, please try again.

@batrick
Copy link
Member Author

batrick commented Feb 23, 2026

jenkins test make check arm64

Copy link
Contributor

@phlogistonjohn phlogistonjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a C++ expert, so take this review with a grain of salt.
However, I combined this PR with mine and did a teuthology run and it resolved this issues I was seeing.

@phlogistonjohn
Copy link
Contributor

jenkins test make check arm64

1 similar comment
@batrick
Copy link
Member Author

batrick commented Feb 25, 2026

jenkins test make check arm64

@phlogistonjohn
Copy link
Contributor

Hi all, I am waiting on having this get merged before I finally merge #64641 - is this just mainly waiting on teuthology? Anything else?

@vshankar
Copy link
Contributor

vshankar commented Mar 4, 2026

This PR is under test in https://tracker.ceph.com/issues/75334.

@vshankar
Copy link
Contributor

Pushed a fix.

err = -EINVAL;
goto done;
}
if (last == 'r' && c == 'w') {
Copy link
Contributor

@avanthakkar avanthakkar Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think issue was just that * wasn't handled,right? These changes restructures the loop, osd_cap_needs_w boolean, and rw-reset hack are all consequences of starting the loop at index 0 instead of 2. Instead could we just early exit for * and leave the rest untouched?

if (cap == "*") {
    osd_cap_wanted = "rw";
    mds_cap_string += mds_cap_string.empty() ? "" : ", ";
    mds_cap_string += "allow *";
    if (filesystem != "*" && filesystem != "all" && fs != nullptr)
        mds_cap_string += " fsname=" + string(fs->get_mds_map().get_fs_name());
    if (path != "/")
        mds_cap_string += " path=" + path;
    if (root_squash)
        mds_cap_string += " root_squash";
    continue;
}
// rest of existing logic unchanged

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't you duplicating the code that way?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code restructure improved readability. Unfortunately, a bug got introduced and its nice that it was caught in testing :)

}
osd_cap_wanted += 'w';
break;
case 'w':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes malformed OSD caps to be generated for auth string "/ rw root_squash /dir1 rw".

See: /a/vshankar-2026-03-05_08:10:26-fs-wip-vshankar-testing-20260304.135307-testing-default-trial/87189

OSD caps get generated as "rww" which fails the "fs authorize" command.

err = -EINVAL;
goto done;
}
if (last == 'r' && c == 'w') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't you duplicating the code that way?

batrick and others added 2 commits March 16, 2026 10:21
Right now only a client with "rw" permissions on an MDS gets "rw" on an
OSD.

[@vshankar: fixed malformed OSD cap when authorizing multiple paths]

Reported-by: John Mulligan <jmulligan@redhat.com>
Fixes: https://tracker.ceph.com/issues/75013
Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Error string validation is prone to failures when error string
changes. errno (retval) validation suffices for tests.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
@github-actions github-actions bot added cephfs Ceph File System tests labels Mar 16, 2026
vshankar added a commit to vshankar/ceph that referenced this pull request Mar 16, 2026
* refs/pull/67406/head:

Reviewed-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
@vshankar
Copy link
Contributor

Fixing and validating a test case change.

Copy link
Contributor

@vshankar vshankar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vshankar
Copy link
Contributor

jenkins test api

@vshankar vshankar merged commit 713e88e into ceph:main Mar 20, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants