Project

General

Profile

Actions

Bug #82020

open
VA VA

Extended attributes for object are lost when its contents are modified via librgw

Bug #82020: Extended attributes for object are lost when its contents are modified via librgw

Added by Vinit Agnihotri about 1 month ago. Updated about 1 month ago.

Status:
Fix Under Review
Priority:
Normal
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

We can set extended attributes on object using librgw.
However when contents of object are changed, these extended attributes are lost.

Re-producible: Always

Steps to re-produce:
1. Create object on bucket using rgw_create()
2. Write data in object using rgw_write()
3. Set extended attribute using rgw_setxattrs()
4. List extended attribute using rgw_lsxatrrs() and verify attributes set in step 3 are listed.
5. Modify contents of object and write using rgw_write()
6. List extended attribute using rgw_lsxatrrs() and verify attributes set in step 3 are listed.

Expected result:
- On listing: attributes are listed and matches with set attributes

Actual result:
- On listing: No extended attributes are returned

We investigated this and found that exec_finish for rgw_write() builds standard unix attributes and set to new object,
however extended attributes stored under "x-amz-meta" are not added to attribute list and thus not set to object.

Attaching reproducer sample program.

Program needs to be compiled with
gcc -g -o myrgw_write_issue myrgw_write_issue.c -lrgw

Execute as:
./myrgw_write_issue admin /etc/ceph/ceph.conf /etc/ceph/ceph.client.admin.keyring <bucket-name> <rados-bucket-user> <access-key> <secret-access-key>


Files

myrgw_write_issue.c (11.7 KB) myrgw_write_issue.c Reproducer sample program Vinit Agnihotri, 10/23/2026 07:28 AM
rgw_file_xattr_cache_opt2.patch (3.16 KB) rgw_file_xattr_cache_opt2.patch Patch2 Vinit Agnihotri, 10/23/2026 07:54 AM
rgw_file_xattr_cache_opt1.patch (3.3 KB) rgw_file_xattr_cache_opt1.patch Patch1 Vinit Agnihotri, 10/23/2026 07:54 AM
rgw_file_xattr_cache_opt2.patch (3.21 KB) rgw_file_xattr_cache_opt2.patch Patch2 Vinit Agnihotri, 10/23/2026 09:50 AM

VA Updated by Vinit Agnihotri about 1 month ago Actions #1

We have couple of proposed patches, prepared as per our understanding of code and AI assitant.
We have tested with both patches and it seem to fix the issue, however since we do not know entirety of the code.

Patch1: This patch stores extended attributes in a map on handle and apply them in write_finish
Patch2: This patch stores extended attributes before write starts and restores then on write_finish

We can also create a PR, however we are not sure which approach is better.

VA Updated by Vinit Agnihotri about 1 month ago Actions #2

I realised I have uploaded incorrect patch file for patch2.
Please use/refer this instead.

AC Updated by Anoop C S about 1 month ago Actions #3

  • Status changed from New to In Progress
  • Assignee set to Vinit Agnihotri

VA Updated by Vinit Agnihotri about 1 month ago Actions #5

  • Pull request ID set to 82020

VA Updated by Vinit Agnihotri about 1 month ago Actions #6

  • Pull request ID changed from 82020 to 73048

AC Updated by Anoop C S about 1 month ago Actions #7

  • Status changed from In Progress to Fix Under Review
Actions

Also available in: PDF Atom