From 8b20dd75b6261ce87bbb55a06e4fe38ff3e802de Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Fri, 10 Jul 2020 12:38:06 -0400 Subject: [PATCH] cls/rgw: preserve olh entry's name on last unlink When rgw_bucket_unlink_instance removes the last instance of a name, it also clears the value of rgw_bucket_olh_entry.key. However, bucket index resharding uses this key when choosing its shard placement, so an empty key causes all of these olh entries to be misplaced in shard 0. After reshard, all of the olh recovery/cleanup logic would be sent to the correct shard, and these misplaced olh entries would never be cleaned up. Preserving the key's name on last unlink allows the olh entry to be resharded correctly and cleaned up normally. Fixes: https://tracker.ceph.com/issues/46456 Signed-off-by: Casey Bodley (cherry picked from commit acf8f3cad9f55e34c703fdaef684853a3fb3b369) --- src/cls/rgw/cls_rgw.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index 96dbab343f6f1..ed004c256177e 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -1692,7 +1692,9 @@ static int rgw_bucket_unlink_instance(cls_method_context_t hctx, bufferlist *in, olh.update(next_key, next.is_delete_marker()); olh.update_log(CLS_RGW_OLH_OP_LINK_OLH, op.op_tag, next_key, next.is_delete_marker()); } else { - /* next_key is empty */ + // next_key is empty, but we need to preserve its name in case this entry + // gets resharded, because this key is used for hash placement + next_key.name = dest_key.name; olh.update(next_key, false); olh.update_log(CLS_RGW_OLH_OP_UNLINK_OLH, op.op_tag, next_key, false); olh.set_exists(false); -- 2.39.5