Skip to content

mds: Return ceph.dir.subvolume vxattr#65104

Merged
rishabh-d-dave merged 1 commit intoceph:mainfrom
edwinzrodriguez:ceph-wip-72556
Oct 3, 2025
Merged

mds: Return ceph.dir.subvolume vxattr#65104
rishabh-d-dave merged 1 commit intoceph:mainfrom
edwinzrodriguez:ceph-wip-72556

Conversation

@edwinzrodriguez
Copy link
Contributor

This introduces handling for the "ceph.dir.subvolume" virtual xattr on directories.

  • Returns ASCII "1" when the directory is a subvolume root, "0" otherwise.
  • Uses srnode->is_subvolume() for the determination.
  • Returns -ENOTDIR for non-directory targets.
  • Uses a lightweight rdlock on the directory’s snaplock to guard the read-only check.
  • If the rdlock cannot be acquired immediately, returns -EBUSY to avoid blocking; callers can retry.
  • Caches success of rd-only checks within the request via mdr->more()->rdonly_checks to prevent re-acquiring locks in the same op.
  • Drops the rdlock once the check is complete.

QA:

  • Extend CephFS subvolume tests to validate vxattr retrieval and behavior around setting/removal.

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

@github-actions github-actions bot added cephfs Ceph File System tests labels Aug 18, 2025
@edwinzrodriguez
Copy link
Contributor Author

jenkins test make check

// can retry later.
// - On success, write ASCII "1" if the directory is a subvolume root, or "0"
// otherwise, using the srnode->is_subvolume() call.
if (!cur->is_dir()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC, this is not needed since this xattr is added to is_ceph_dir_vxattr, the check at the top of this function should handle non-dir case.

This section:

ceph/src/mds/Server.cc

Lines 7120 to 7124 in 558e59c

if (is_ceph_dir_vxattr(xattr_name)) {
if (!cur->is_dir()) {
respond_to_request(mdr, -ENODATA);
return;
}

@vshankar vshankar requested a review from a team August 20, 2025 11:00
r = -ENOTDIR;
} else {
// Acquire a lighter weight rdlock
if (!mdr->more()->rdonly_checks) {
Copy link
Contributor

Choose a reason for hiding this comment

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

you can skip checking and acquiring snaplock, the inode should have the snaplock from CInode *cur = rdlock_path_pin_ref(mdr, true, false);

@mchangir
Copy link
Contributor

@vshankar I have a commit for adding ceph.dir.subvolume support here as well 1419a4c


if (mdr->more()->rdonly_checks) {
const auto srnode = cur->get_projected_srnode();
*css << (srnode->is_subvolume() ? "1"sv : "0"sv);
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 just srnode->is_subvolume() should suffice

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good.

@edwinzrodriguez edwinzrodriguez force-pushed the ceph-wip-72556 branch 2 times, most recently from c0b3f6f to 65e31c9 Compare August 25, 2025 13:00
@edwinzrodriguez
Copy link
Contributor Author

jenkins test make check arm64

@edwinzrodriguez
Copy link
Contributor Author

jenkins test make check

@edwinzrodriguez
Copy link
Contributor Author

jenkins test api

@github-actions
Copy link

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

// since we only handle ceph vxattrs here
r = -ENODATA; // no such attribute
}
} else if (xattr_name.substr(0, 18) == "ceph.dir.subvolume"sv) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why substr vs explicitly matching?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied from the other code for example at line 7275

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 xattr_name == "ceph.dir.subvolume"sv should suffice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. It seems this function mixes the 2 styles and I couldn't come up with any rationalization why.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like one uses substr to drop into a set of common xattr names and then matches them one by one. It seems like an organizational thing.

@edwinzrodriguez
Copy link
Contributor Author

jenkins test api

@mchangir
Copy link
Contributor

@vshankar I have a commit for adding ceph.dir.subvolume support here as well 1419a4c

@vshankar do I drop my commit in favor of Edwin's PR ?

@vshankar vshankar requested a review from a team September 16, 2025 07:27
@vshankar
Copy link
Contributor

@vshankar do I drop my commit in favor of Edwin's PR ?

Yes please.

@dparmar18 dparmar18 self-assigned this Sep 16, 2025
@edwinzrodriguez
Copy link
Contributor Author

jenkins test windows

@dparmar18
Copy link
Contributor

LGTM, just one thing - i'm not sure if it's also needed to add a test case in src/test/libcephfs/vxattr.cc? ping @vshankar?

@edwinzrodriguez
Copy link
Contributor Author

A test beyond what I added in qa/tasks/cephfs/test_subvolume.py ?

@edwinzrodriguez
Copy link
Contributor Author

jenkins test api

@edwinzrodriguez
Copy link
Contributor Author

jenkins test make check arm64

@dparmar18
Copy link
Contributor

A test beyond what I added in qa/tasks/cephfs/test_subvolume.py ?

i think it's sufficient, yes but i'm not sure if we're maintaining src/test/libcephfs/vxattr.cc with every vxattr change or is just okay to not have it.

Copy link
Contributor

@chrisphoffman chrisphoffman left a comment

Choose a reason for hiding this comment

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

All of my comments were addressed.

LGTM

@edwinzrodriguez
Copy link
Contributor Author

jenkins test api

@edwinzrodriguez
Copy link
Contributor Author

jenkins test make check arm64

@edwinzrodriguez
Copy link
Contributor Author

jenkins test api

@edwinzrodriguez
Copy link
Contributor Author

jenkins test windows

@edwinzrodriguez
Copy link
Contributor Author

jenkins test make check arm64

@rishabh-d-dave
Copy link
Contributor

@edwinzrodriguez If some many tests are failing you can comment jenkins restest this please to run all CI jobs again.

# cleanup
self.mount_a.run_shell(['rm', '-rf', 'group/subvol3'])


Copy link
Contributor

Choose a reason for hiding this comment

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

I would recommend to remove this newline since in Python we reserve 2 sequential newlines for special purpose.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PEP 8 style guide specifies that top-level function and class definitions should be surrounded by two blank lines.

Copy link
Contributor

@rishabh-d-dave rishabh-d-dave left a comment

Choose a reason for hiding this comment

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

LGTM

This introduces handling for the "ceph.dir.subvolume" virtual xattr on directories.
- Returns ASCII "1" when the directory is a subvolume root, "0" otherwise.

QA:
- Extend CephFS subvolume tests to validate vxattr retrieval and behavior around setting/removal.

Fixes: https://tracker.ceph.com/issues/72556
Signed-off-by: Edwin Rodriguez <edwin.rodriguez1@ibm.com>
@rishabh-d-dave rishabh-d-dave added the wip-rishabh-testing Rishabh's testing label label Sep 29, 2025
@rishabh-d-dave
Copy link
Contributor

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

Copy link
Contributor

@rishabh-d-dave rishabh-d-dave left a comment

Choose a reason for hiding this comment

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

@rishabh-d-dave rishabh-d-dave merged commit fa93d68 into ceph:main Oct 3, 2025
13 checks passed
@github-actions
Copy link

github-actions bot commented Oct 3, 2025

This is an automated message by src/script/redmine-upkeep.py.

I found one or more Fixes: tags in the commit messages in

git log fa93d68191b31c417381fa4cea3f87eb7840be4a^..fa93d68191b31c417381fa4cea3f87eb7840be4a

The referenced tickets are:

Those tickets do not reference this merged Pull Request. If this Pull Request merge resolves any of those tickets, please update the "Pull Request ID" field on each ticket. A future run of this script will appropriately update them.

Update Log: https://github.com/ceph/ceph/actions/runs/18220936287

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cephfs Ceph File System needs-qa tests wip-rishabh-testing Rishabh's testing label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants