mds: Implement remove for ceph vxattrs #53755
Conversation
|
In some kernels on test machines, vxattrs getxattr isn't supported. I've added a TODO, to uncomment getfattrs for failing xattrs when they are supported. Here's the failure: Here's a working run with latest version (failure unrelated to test): |
|
@chrisphoffman just a quick question, what about not providing any values with |
Yes in that case, it will set to default value. I provided a value because I wanted to test the value changing from something back to default. Are you suggesting something different? |
So something like What i'm thinking is to only accept no values as valid arg only in case for removal of vxattr. So check if the client req is to set or remove the vxattr by looking at request's head op. Something like this So now we have the expected behaviour: |
src/mds/Server.cc
Outdated
| || name == "ceph.dir.pin.distributed" | ||
| || name == "ceph.dir.pin.random" | ||
| || name == "ceph.dir.subvolume") { | ||
| handle_set_vxattr(mdr, cur); |
There was a problem hiding this comment.
It seems the comment above this if block is no longer correct. How about we change the code to:
if (name.find("ceph.") == 0) {
if (req->get_data().length()) {
respond_to_request(mdr, -CEPHFS_EINVAL);
return;
}
handle_set_vxattr(mdr, cur);
}
There was a problem hiding this comment.
Fix all vxattrs that should not allow removal to reject the RPC (EINVAL).
There was a problem hiding this comment.
That works for me. Thanks for the suggestion!
There was a problem hiding this comment.
@chrisphoffman don't forget:
Fix all vxattrs that should not allow removal to reject the RPC (EINVAL).
Include in your test that setfattr -x ceph.X <path>. fails for vxattrs where removal makes no sense. I think ceph.quota is another example of a vxattr which should support rmxattr.
There was a problem hiding this comment.
Took a while to unpack all of this. I did an audit of all xattrs handled. All ceph.* xattrs should either reset to def value, or reject for xattrs that shouldn't be removed (my judgement). If neither case, it is unknown xattr and will reject again with EINVAL.
src/mds/Server.cc
Outdated
|
|
||
| bool val; | ||
| try { | ||
| if (value.length() == 0) { |
There was a problem hiding this comment.
For readability, put at the start of this method:
bool is_rmxattr = (value.length() == 0);
Then use that.
There was a problem hiding this comment.
I ended up using bool is_rmxattr = (req->get_op() == CEPH_MDS_OP_RMXATTR); instead. That way seemed more straight forward.
8739aec to
4aa8195
Compare
src/mds/Server.cc
Outdated
| || name == "ceph.dir.pin.distributed" | ||
| || name == "ceph.dir.pin.random" | ||
| || name == "ceph.dir.subvolume") { | ||
| handle_set_vxattr(mdr, cur); |
There was a problem hiding this comment.
@chrisphoffman don't forget:
Fix all vxattrs that should not allow removal to reject the RPC (EINVAL).
Include in your test that setfattr -x ceph.X <path>. fails for vxattrs where removal makes no sense. I think ceph.quota is another example of a vxattr which should support rmxattr.
4aa8195 to
53e869a
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
53e869a to
7b057af
Compare
Somehow extra commits got into the push and triggered this message. I removed the label and repushed as I don't believe there are any conflicts. |
doc/cephfs/quota.rst
Outdated
| running ``getfattr /some/dir -n ceph.<some-xattr>``. | ||
|
|
||
| To remove a quota, set the value of extended attribute to ``0``:: | ||
| To remove a quota, remove the respective extended attribute or set the value to ``0``:: |
There was a problem hiding this comment.
i know it's quite trivial but how about adding example illustrating removal using setfattr -x, maybe helpful for naive users i guess and also the reason that we illustrate setting val to 0; this might be a good addition
| #ceph.quota, def value 0, reset val 0 | ||
| setfattr -n ceph.quota.max_bytes -v 100000000 dir | ||
| setfattr -n ceph.quota.max_files -v 10000 dir | ||
| setfattr -x ceph.quota.max_bytes dir | ||
| setfattr -x ceph.quota.max_files dir |
There was a problem hiding this comment.
we should check for the change using getfattr here, or maybe add a comment for now since you've mentioned the test machines don't support it yet?
7b057af to
76b53c4
Compare
* refs/pull/53755/head: PendingReleaseNotes: add note about CephFS set_vxattrs doc/cephfs: Update docs to match remove functionality and respective vxattrs qa: Add test coverage for vxattr behavior qa: Add removexattr to support setfattr removal. mds: Implement remove for ceph vxattrs Reviewed-by: Dhairya Parmar <dparmar@redhat.com> Reviewed-by: Patrick Donnelly <pdonnell@redhat.com> Reviewed-by: Milind Changire <mchangir@redhat.com>
vshankar
left a comment
There was a problem hiding this comment.
PTAL at the failure @chrisphoffman
For a variety of ceph xattrs, the setfattr remove isn't handled and "No such attribute" is returned. Add support to remove xattrs to match where docs say to clear value, one can remove or set to X value. When removing, add "default" value back to xattr depending on xattr name. Simplify current code to make clearer and minimize code reuse. Fixes: https://tracker.ceph.com/issues/62793 Signed-off-by: Christopher Hoffman <choffman@redhat.com>
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
Add tests to validate default and remove xattr behaviors. Signed-off-by: Christopher Hoffman <choffman@redhat.com>
…vxattrs Signed-off-by: Christopher Hoffman <choffman@redhat.com>
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
|
jenkins retest this please |
|
This PR is under test in https://tracker.ceph.com/issues/66327. |
|
jenkins test windows |
|
jenkins render docs |
|
jenkins test api |
|
jenkins test make check |
1 similar comment
|
jenkins test make check |
|
jenkins test docs |
|
This PR is under test in https://tracker.ceph.com/issues/66522. |
|
jenkins retest this please |
|
jenkins test api |
1 similar comment
|
jenkins test api |
For a variety of ceph xattrs, the setfattr remove
isn't handled and "No such attribute" is returned.
Add support to remove xattrs to match where docs
say to clear value, one can remove or set to X value.
When removing, add "default" value back to xattr depending
on xattr name.
Fixes: https://tracker.ceph.com/issues/62793
Signed-off-by: Christopher Hoffman choffman@redhat.com
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. "pacific"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windows