Skip to content

client: Fix return in removexattr for xattrs from system. namespace - #55087

Merged
vshankar merged 2 commits into
ceph:mainfrom
anoopcs9:fix-removexattr-return
Feb 20, 2024
Merged

vshankar merged 2 commits into
ceph:mainfrom
anoopcs9:fix-removexattr-return

Conversation

@anoopcs9

@anoopcs9 anoopcs9 commented Jan 8, 2024

Copy link
Copy Markdown
Contributor

removexattr() code path generally returns success for POSIX ACL xattrs even if they are absent on files. It is this special behaviour for system.posix_acl_access and system.posix_acl_default xattrs that we observe during setfattr -x execution or fremovexattr() call on a kernel ceph client mount. On the other side userspace client diverge a little bit around this area to produce different return code breaking consumers like Samba where anything other than 0 is treated as failure. In this change we catch ENODATA for those xattrs and fix the return code to match kernel client behaviour for others from system. namespace.

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)

To match the kernel ceph client, as mentioned by the inline comments,
remove the comparison with "system." xattr namespace in removexattr()
code path. This is in preparation to handle the case where POSIX ACL
xattrs are treated differently by kernel during removexattr operation.

ref: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/ceph/xattr.c#n21

Signed-off-by: Anoop C S <[email protected]>
@github-actions github-actions Bot added the cephfs Ceph File System label Jan 8, 2024
@anoopcs9
anoopcs9 force-pushed the fix-removexattr-return branch from de5fcbd to 2bdaebb Compare January 8, 2024 15:51
With an exception to POSIX ACL xattrs all others from "system."
namespace are found to return ENOTSUP during a removal attempt.
Hence "system.posix_acl_access" and "system.posix_acl_default"
are exempted thereby returning success despite their presence
on files.

Signed-off-by: Anoop C S <[email protected]>
@anoopcs9
anoopcs9 force-pushed the fix-removexattr-return branch from 2bdaebb to a17dcce Compare January 8, 2024 16:31
@anoopcs9
anoopcs9 marked this pull request as ready for review January 9, 2024 06:33
Comment thread src/client/Client.cc Resolved
Comment thread src/client/Client.cc Resolved
@vshankar
vshankar requested a review from a team January 10, 2024 10:22

@vshankar vshankar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Discussed with @lxbsz and @anoopcs9 - this needs to be fixed in the MDS with setxattr returning -ENODATA when the xattr does not exist (even if value is empty w/ XATTR_REPLACE).

@xiubli xiubli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@xiubli

xiubli commented Jan 23, 2024 •

Copy link
Copy Markdown
Member

Discussed with @lxbsz and @anoopcs9 - this needs to be fixed in the MDS with setxattr returning -ENODATA when the xattr does not exist (even if value is empty w/ XATTR_REPLACE).

@vshankar This change is fine.

POSIX ACL attributes:

ACL_EA_ACCESS  "system.posix_acl_access"
ACL_EA_DEFAULT "system.posix_acl_default" 

For POSIX ACL cases the xfs and ext4 will just switch the -ENODATA or -ENOATTR to 0. And for all the other they will return the errno directly.

So this PR will just fix the POSIX ACL case and I will raise a separate PR to fix the latter one.

@anoopcs9
anoopcs9 requested a review from vshankar January 29, 2024 11:21
@vshankar

Copy link
Copy Markdown
Contributor

Discussed with @lxbsz and @anoopcs9 - this needs to be fixed in the MDS with setxattr returning -ENODATA when the xattr does not exist (even if value is empty w/ XATTR_REPLACE).

@vshankar This change is fine.

POSIX ACL attributes:

ACL_EA_ACCESS  "system.posix_acl_access"
ACL_EA_DEFAULT "system.posix_acl_default" 

For POSIX ACL cases the xfs and ext4 will just switch the -ENODATA or -ENOATTR to 0. And for all the other they will return the errno directly.

So this PR will just fix the POSIX ACL case and I will raise a separate PR to fix the latter one.

ACK.

@anoopcs9

anoopcs9 commented Feb 6, 2024

Copy link
Copy Markdown
Contributor Author

@vshankar Should I make any changes in case backport is needed here?

@vshankar

vshankar commented Feb 6, 2024

Copy link
Copy Markdown
Contributor

@vshankar Should I make any changes in case backport is needed here?

Not really. I'll put this to test soon.

@vshankar

vshankar commented Feb 8, 2024

Copy link
Copy Markdown
Contributor

fs suite has many failures - https://pulpito.ceph.com/vshankar-2024-02-06_08:10:23-fs-wip-vshankar-testing-20240206.051942-testing-default-smithi/

I would need to analyse them to ascertain if the failures are related to this change or not.

@anoopcs9

anoopcs9 commented Feb 8, 2024

Copy link
Copy Markdown
Contributor Author

fs suite has many failures - https://pulpito.ceph.com/vshankar-2024-02-06_08:10:23-fs-wip-vshankar-testing-20240206.051942-testing-default-smithi/

Following changes are expected for removexattr() from libcephfs:

  • Attempt to remove POSIX ACL xattrs(system.posix_acl_access and system.posix_acl_default) will return success(0) for any -CEPHFS_ENODATA reported from MDS.
    • Previous error code was -CEPHFS_ENODATA.
  • Attempt to remove any other xattr from system namespace will return -CEPHFS_EOPNOTSUPP.
    • Previous error code could be -CEPHFS_ENODATA or 0 depending on the presence of xattr itself on the file.

@vshankar

vshankar commented Feb 9, 2024

Copy link
Copy Markdown
Contributor

fs suite has many failures - https://pulpito.ceph.com/vshankar-2024-02-06_08:10:23-fs-wip-vshankar-testing-20240206.051942-testing-default-smithi/

I would need to analyse them to ascertain if the failures are related to this change or not.

This run is a bit messy - I'm going to rerun the failed test and see what comes back.

@anoopcs9

Copy link
Copy Markdown
Contributor Author

fs suite has many failures - https://pulpito.ceph.com/vshankar-2024-02-06_08:10:23-fs-wip-vshankar-testing-20240206.051942-testing-default-smithi/
I would need to analyse them to ascertain if the failures are related to this change or not.

This run is a bit messy - I'm going to rerun the failed test and see what comes back.

Any luck with the rerun of failed tests?

@vshankar

Copy link
Copy Markdown
Contributor

Any luck with the rerun of failed tests?

Not really - but I don't think this test is responsible for the failure, so, I'll merger this by EOD.

@vshankar

Copy link
Copy Markdown
Contributor

Unfortunately the latest fs suite run is still messy. See: https://pulpito.ceph.com/vshankar-2024-02-16_10:35:24-fs-wip-vshankar-testing-20240216.060239-testing-default-smithi/7562055/

Command failed on smithi049 with status 1: 'sudo /home/ubuntu/cephtest/cephadm --image quay-quay-quay.apps.os.sepia.ceph.com/ceph-ci/ceph:25296a8f176256aea5ed8b5850b25167dce0ae33 pull'

2024-02-16T11:12:44.632 INFO:teuthology.orchestra.run.smithi049.stderr:Non-zero exit code 126 from /bin/podman run --rm --ipc=host --stop-signal=SIGTERM --net=host --entrypoint ceph --init -e CONTAINER_IMAGE=quay-quay-quay.apps.os.sepia.ceph.com
/ceph-ci/ceph:25296a8f176256aea5ed8b5850b25167dce0ae33 -e NODE_NAME=smithi049 quay-quay-quay.apps.os.sepia.ceph.com/ceph-ci/ceph:25296a8f176256aea5ed8b5850b25167dce0ae33 --version
2024-02-16T11:12:44.632 INFO:teuthology.orchestra.run.smithi049.stderr:ceph: stderr Error: OCI runtime error: crun: bpf create ``: Function not implemented
2024-02-16T11:12:44.632 INFO:teuthology.orchestra.run.smithi049.stderr:Traceback (most recent call last):
2024-02-16T11:12:44.632 INFO:teuthology.orchestra.run.smithi049.stderr:  File "/usr/lib64/python3.9/runpy.py", line 197, in _run_module_as_main
2024-02-16T11:12:44.635 INFO:teuthology.orchestra.run.smithi049.stderr:    return _run_code(code, main_globals, None,
2024-02-16T11:12:44.635 INFO:teuthology.orchestra.run.smithi049.stderr:  File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
2024-02-16T11:12:44.636 INFO:teuthology.orchestra.run.smithi049.stderr:    exec(code, run_globals)
2024-02-16T11:12:44.636 INFO:teuthology.orchestra.run.smithi049.stderr:  File "/tmp/tmpth8kyqko.cephadm.build/app/__main__.py", line 5520, in <module>
2024-02-16T11:12:44.637 INFO:teuthology.orchestra.run.smithi049.stderr:  File "/tmp/tmpth8kyqko.cephadm.build/app/__main__.py", line 5508, in main
2024-02-16T11:12:44.637 INFO:teuthology.orchestra.run.smithi049.stderr:  File "/tmp/tmpth8kyqko.cephadm.build/app/__main__.py", line 443, in _default_image
2024-02-16T11:12:44.637 INFO:teuthology.orchestra.run.smithi049.stderr:  File "/tmp/tmpth8kyqko.cephadm.build/app/__main__.py", line 1835, in command_pull
2024-02-16T11:12:44.637 INFO:teuthology.orchestra.run.smithi049.stderr:  File "/tmp/tmpth8kyqko.cephadm.build/app/cephadmlib/decorators.py", line 27, in _require_image
2024-02-16T11:12:44.637 INFO:teuthology.orchestra.run.smithi049.stderr:  File "/tmp/tmpth8kyqko.cephadm.build/app/__main__.py", line 434, in _infer_image
2024-02-16T11:12:44.637 INFO:teuthology.orchestra.run.smithi049.stderr:  File "/tmp/tmpth8kyqko.cephadm.build/app/__main__.py", line 1882, in command_inspect_image
2024-02-16T11:12:44.638 INFO:teuthology.orchestra.run.smithi049.stderr:  File "/tmp/tmpth8kyqko.cephadm.build/app/cephadmlib/container_types.py", line 433, in run
2024-02-16T11:12:44.638 INFO:teuthology.orchestra.run.smithi049.stderr:  File "/tmp/tmpth8kyqko.cephadm.build/app/cephadmlib/call_wrappers.py", line 307, in call_throws
2024-02-16T11:12:44.638 INFO:teuthology.orchestra.run.smithi049.stderr:RuntimeError: Failed command: /bin/podman run --rm --ipc=host --stop-signal=SIGTERM --net=host --entrypoint ceph --init -e CONTAINER_IMAGE=quay-quay-quay.apps.os.sepia.ceph.c
om/ceph-ci/ceph:25296a8f176256aea5ed8b5850b25167dce0ae33 -e NODE_NAME=smithi049 quay-quay-quay.apps.os.sepia.ceph.com/ceph-ci/ceph:25296a8f176256aea5ed8b5850b25167dce0ae33 --version: Error: OCI runtime error: crun: bpf create ``: Function not im
plemented

I've looped in @adk3798 in ceph-devel on slack related to this.

@vshankar

Copy link
Copy Markdown
Contributor

https://pulpito.ceph.com/vshankar-2024-02-17_05:57:56-fs-wip-vshankar-testing-20240217.015652-testing-default-smithi/

This run still has quay fetch failures

Command failed on smithi155 with status 1: 'sudo /home/ubuntu/cephtest/cephadm --image quay-quay-quay.apps.os.sepia.ceph.com/ceph-ci/ceph:1c920afa8316ea21877f3186850254947531ea22 pull'

I'll file a tracker for that and merge this batch.

@vshankar

Copy link
Copy Markdown
Contributor

Apologies for the delay @anoopcs9 - this will be merged tomorrow.

@vshankar
vshankar merged commit 8ffdab7 into ceph:main Feb 20, 2024
@vshankar

Copy link
Copy Markdown
Contributor

Doh, I thought this was linked to a tracker, but its not :/

@anoopcs9 - mind creating one please?

@anoopcs9

Copy link
Copy Markdown
Contributor Author

Doh, I thought this was linked to a tracker, but its not :/

Actually it was my intention via the question from #55087 (comment) which might not have been clear then.

@anoopcs9 - mind creating one please?

Sure, I'll update here with the tracker link once my account is approved.

@anoopcs9

Copy link
Copy Markdown
Contributor Author

Doh, I thought this was linked to a tracker, but its not :/

@anoopcs9 - mind creating one please?

Here you go: https://tracker.ceph.com/issues/64542

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

Labels

cephfs Ceph File System

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants