Bug #82020
openExtended attributes for object are lost when its contents are modified via librgw
0%
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
VA Updated by Vinit Agnihotri about 1 month ago
- File rgw_file_xattr_cache_opt1.patch rgw_file_xattr_cache_opt1.patch added
- File rgw_file_xattr_cache_opt2.patch rgw_file_xattr_cache_opt2.patch added
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
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
- Status changed from New to In Progress
- Assignee set to Vinit Agnihotri
VA Updated by Vinit Agnihotri about 1 month ago
VA Updated by Vinit Agnihotri about 1 month ago
- Pull request ID set to 82020
VA Updated by Vinit Agnihotri about 1 month ago
- Pull request ID changed from 82020 to 73048
AC Updated by Anoop C S about 1 month ago
- Status changed from In Progress to Fix Under Review