Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
rgw/sfs: recognize delete-marker on DeleteObj
Browse files Browse the repository at this point in the history
RGWDeleteObj::execute() relies on the return code from
rgw::sal::Object::get_obj_state() to ascert the object being deleted is
a regular object rather than a delete-marker.
The rule is to return -ENOENT to signal a delete-marker.
get_obj_state() in rgw/sfs was returning always 0 for any object,
therefore also a delete-marker fell into a regular object in
RGWDeleteObj::execute().
This is wrong because, when dealing with object lock checks, a delete-marker
is always allowed to be deleted regardless of the object's retention mode.
Returing 0 was incorrectly preventing a delete-marker to be deleted for
object-lock protected objects.

Fixes: https://github.com/aquarist-labs/s3gw/issues/690
Signed-off-by: Giuseppe Baccini <[email protected]>
  • Loading branch information
Giuseppe Baccini committed Oct 31, 2023
1 parent 4976c75 commit e5d9457
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion qa/rgw/store/sfs/tests/fixtures/s3-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ test_object_lock_get_obj_retention_invalid_bucket
# test_object_lock_put_obj_retention_shorten_period
# test_object_lock_put_obj_retention_shorten_period_bypass
# test_object_lock_delete_object_with_retention
# test_object_lock_delete_object_with_retention_and_marker
test_object_lock_delete_object_with_retention_and_marker
# test_object_lock_multi_delete_object_with_retention
# test_object_lock_put_legal_hold
test_object_lock_put_legal_hold_invalid_bucket
Expand Down
1 change: 0 additions & 1 deletion qa/rgw/store/sfs/tests/fixtures/s3tr_excuses.csv
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ test_bucket_recreate_overwrite_acl;https://github.com/aquarist-labs/s3gw/issues/
test_logging_toggle;https://tracker.ceph.com/issues/984;Not supported by RGW
test_object_copy_replacing_metadata;https://github.com/aquarist-labs/s3gw/issues/525;BUG
test_object_copy_to_itself_with_metadata;https://github.com/aquarist-labs/s3gw/issues/525;BUG
test_object_lock_delete_object_with_retention_and_marker;https://github.com/aquarist-labs/s3gw/issues/690;BUG
test_object_read_unreadable;https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html;Broken test, Object names are UTF-8
test_object_requestid_matches_header_on_error;https://github.com/aquarist-labs/s3gw/issues/689;BUG
test_object_set_get_unicode_metadata;https://github.com/aquarist-labs/s3gw/issues/688;BUG, maybe upstream
Expand Down
2 changes: 1 addition & 1 deletion src/rgw/driver/sfs/object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ int SFSObject::get_obj_state(
) {
refresh_meta();
*_state = &state;
return 0;
return objref->deleted ? -ENOENT : 0;
}

int SFSObject::set_obj_attrs(
Expand Down

0 comments on commit e5d9457

Please sign in to comment.