From 0a87c3d05b8babe6aee7f7843ca33a0be678172c 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 (cherry picked from commit 120df4bb38f60a9a934ce6c8f8b029ef323221b1) --- 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 fb90602b185..779a0698f09 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -281,7 +281,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.47.3