Skip to content

librgw: Persist extended attributes across all writes for object - #73048

Open
vagnihotri-dev wants to merge 2 commits into
ceph:mainfrom
vagnihotri-dev:write_fix
Open

vagnihotri-dev wants to merge 2 commits into
ceph:mainfrom
vagnihotri-dev:write_fix

Conversation

@vagnihotri-dev

@vagnihotri-dev vagnihotri-dev commented Oct 24, 2026 •

Copy link
Copy Markdown

Current rgw_write() implementation does not preserve extended attributes across writes for object,
therefore, if object is modifying all of its extended attributes are lost.

This PR proposes a fix, by storing attributes in beginning of write and then puts them back on write finish,
additionally, it also ensures attribute consistency by preventing access to set remove attribute till write is finished.

Fixes: https://tracker.ceph.com/issues/82020

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.

@vagnihotri-dev
vagnihotri-dev requested a review from a team as a code owner October 24, 2026 10:55
@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR ci-approved to allow Jenkins CI jobs to run.

@mattbenjamin mattbenjamin 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.

I think I support this provisionally, but I think it's essentially operating in a semantically ill-defined space in the current model. However, because preserving xattrs into new versions of an object will be in the forthcoming open2 model, it's probably better than what we do today, for most usages.

@anoopcs9

Copy link
Copy Markdown
Contributor

I can confirm that the issue where the Windows SMB client loses critical metadata stored in extended attributes after a modify operation is no longer observed in a build that includes the proposed changes.

@anoopcs9

Copy link
Copy Markdown
Contributor

Recently I realized that the new EBUSY check in setxattrs()/rmxattrs() breaks SMB clients using Samba's vfs_ceph_rgw. Clients like windows often write data and then set the ACL (stored as an xattr) on the same handle before closing it. That setxattrs() call now fails with EBUSY, so the client gets an error.

@vagnihotri-dev Could xattr changes made during an active write be queued and applied when the write finishes, instead of returning EBUSY?

@vagnihotri-dev

Copy link
Copy Markdown
Author

Recently I realized that the new EBUSY check in setxattrs()/rmxattrs() breaks SMB clients using Samba's vfs_ceph_rgw. Clients like windows often write data and then set the ACL (stored as an xattr) on the same handle before closing it. That setxattrs() call now fails with EBUSY, so the client gets an error.

@vagnihotri-dev Could xattr changes made during an active write be queued and applied when the write finishes, instead of returning EBUSY?

I am trying to work out something like, to allow set/rm attribute operations to update cache instead f returning EBUSY.
However, we might lose out a set xattr operation in case write_finish fails, consider following scenario.
Say a write_finish is not called yet, and set xattr call updates cache, thus caller consider this as success,
however, if write_finish fails, then this attribute will be lost, which was reported as a success earlier.

@anoopcs9

anoopcs9 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Recently I realized that the new EBUSY check in setxattrs()/rmxattrs() breaks SMB clients using Samba's vfs_ceph_rgw. Clients like windows often write data and then set the ACL (stored as an xattr) on the same handle before closing it. That setxattrs() call now fails with EBUSY, so the client gets an error.
@vagnihotri-dev Could xattr changes made during an active write be queued and applied when the write finishes, instead of returning EBUSY?

I am trying to work out something like, to allow set/rm attribute operations to update cache instead f returning EBUSY. However, we might lose out a set xattr operation in case write_finish fails, consider following scenario. Say a write_finish is not called yet, and set xattr call updates cache, thus caller consider this as success, however, if write_finish fails, then this attribute will be lost, which was reported as a success earlier.

Thanks for working on this. I verified that the new approach allows clients to modify xattrs through existing open handles. If I understand correctly, the associated test case still doesn't cover this scenario. Could you update it to keep the handle open while modifying the xattrs?

@vagnihotri-dev

Copy link
Copy Markdown
Author

Recently I realized that the new EBUSY check in setxattrs()/rmxattrs() breaks SMB clients using Samba's vfs_ceph_rgw. Clients like windows often write data and then set the ACL (stored as an xattr) on the same handle before closing it. That setxattrs() call now fails with EBUSY, so the client gets an error.
@vagnihotri-dev Could xattr changes made during an active write be queued and applied when the write finishes, instead of returning EBUSY?

I am trying to work out something like, to allow set/rm attribute operations to update cache instead f returning EBUSY. However, we might lose out a set xattr operation in case write_finish fails, consider following scenario. Say a write_finish is not called yet, and set xattr call updates cache, thus caller consider this as success, however, if write_finish fails, then this attribute will be lost, which was reported as a success earlier.

Thanks for working on this. I verified that the new approach allows clients to modify xattrs through existing open handles. If I understand correctly, the associated test case still doesn't cover this scenario. Could you update it to keep the handle open while modifying the xattrs?

Yes, I'd update test case.

Vinit Agnihotri added 2 commits November 4, 2026 10:57
Current write implementation perserves metadata attributes across write
operation, however it does not merge extended attributes.
Therefore write operation on same object wipes out these attributes.

As a fix, Fix this by reading the object's RGW_ATTR_META_PREFIX* attributes just
before the write is committed and re-applying them in exec_finish.

The exclusive lock is taken only when a write transaction is being
committed, never while data is being written, so xattr calls are not
delayed by an open file that is still receiving data.

Fixes: https://tracker.ceph.com/issues/82020

Signed-off-by: Vinit Agnihotri <[email protected]>
This test case verifies persistence of extended attributes in case of
modify operation on object.

Flow:
 1. create object via rgw_create, write 10 bytes.
 2. set user.TEST_ATTR on the object.
 3. list xattrs – assert user.TEST_ATTR is present and close.
 4. open and overwrite object with 20 bytes, close.
 5. list xattrs – PASS if user.TEST_ATTR still present, FAIL if lost
 6. release handle, unlink object

Fixes: https://tracker.ceph.com/issues/82020

Signed-off-by: Vinit Agnihotri <[email protected]>

@anoopcs9 anoopcs9 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.

Thanks, I'll defer the core review to @mattbenjamin.

@anrao19

anrao19 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-anrao6-testing-2026-11-13-0833-main.

@anrao19 anrao19 added wip-anrao1-testing and removed wip-anrao6-testing wip-anrao6-testing labels Nov 26, 2026
@anrao19

anrao19 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

This PR has been removed from wip-anrao6-testing-2026-11-13-1158-main.

@anrao19

anrao19 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-anrao1-testing-2026-11-26-0609-main.

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

Projects

Status: Reviewer approved

Development

Successfully merging this pull request may close these issues.

4 participants