From 120df4bb38f60a9a934ce6c8f8b029ef323221b1 Mon Sep 17 00:00:00 2001 From: Tianshan Qu Date: Mon, 26 Aug 2019 20:32:03 +0800 Subject: [PATCH] rgw: fix list versions starts with version_id=null list with version_id=null, the null will be treated as a "null" version in cls rgw_bucket_list, which cause the list return wrong keys Fixes: https://tracker.ceph.com/issues/41433 Signed-off-by: Tianshan Qu --- src/cls/rgw/cls_rgw.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index 0486bbd6c12..dcdd46f9a2a 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -283,7 +283,11 @@ static int encode_list_index_key(cls_method_context_t hctx, const cls_rgw_obj_ke } string obj_index_key; - encode_obj_index_key(key, &obj_index_key); + cls_rgw_obj_key tmp_key(key); + if (tmp_key.instance == "null") { + tmp_key.instance.clear(); + } + encode_obj_versioned_data_key(tmp_key, &obj_index_key); rgw_bucket_dir_entry entry; -- 2.39.5