]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix `bi put` not using right bucket index shard 44166/head
authorJ. Eric Ivancich <ivancich@redhat.com>
Thu, 11 Nov 2021 22:20:24 +0000 (17:20 -0500)
committerCory Snyder <csnyder@iland.com>
Wed, 1 Dec 2021 19:40:52 +0000 (14:40 -0500)
When `radosgw-admin bi put` adds an entry for an incomplete multipart
upload, the bucket index shard is not calculated correctly. It should
be based on the name of the ultimate object. However the calculation
was including the added organizational suffixes as well. This corrects
that.

NOTE: When entries are not put in the correct index shard, unordered
listing becomes unreliable, perhaps causing entries to be skipped or
infinite loops to form.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
(cherry picked from commit 2e620ac2abab6c14cbe4f17c59d5758b09430703)

src/rgw/rgw_rados.cc

index 3bee2203ce1e99d83871449033bd491da2b586bb..0ba0038d3171f2fb24d5b32c6451669dcb4a78b4 100644 (file)
@@ -8097,7 +8097,14 @@ int RGWRados::bi_put(BucketShard& bs, rgw_cls_bi_entry& entry)
 
 int RGWRados::bi_put(const DoutPrefixProvider *dpp, rgw_bucket& bucket, rgw_obj& obj, rgw_cls_bi_entry& entry)
 {
+  // make sure incomplete multipart uploads are hashed correctly
+  if (obj.key.ns == RGW_OBJ_NS_MULTIPART) {
+    RGWMPObj mp;
+    mp.from_meta(obj.key.name);
+    obj.index_hash_source = mp.get_key();
+  }
   BucketShard bs(this);
+
   int ret = bs.init(bucket, obj, nullptr /* no RGWBucketInfo */, dpp);
   if (ret < 0) {
     ldpp_dout(dpp, 5) << "bs.init() returned ret=" << ret << dendl;