]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
rgw: avoid infinite loop when deleting a bucket 42230/head
authorJeegn Chen <jeegnchen@tencent.com>
Wed, 25 Nov 2020 09:15:25 +0000 (17:15 +0800)
committerCory Snyder <csnyder@iland.com>
Wed, 7 Jul 2021 17:46:01 +0000 (13:46 -0400)
commitb60e70f4179c19270b06b0ee6715634343422ab9
tree2a14d426ac7626b530be41c19edea048424102ad
parent2da4f0a00259e70842bd8c8408e9267833b68856
rgw: avoid infinite loop when deleting a bucket

When deleting a bucket with an incomplete multipart upload that
has about 2000 parts uploaded, we noticed an infinite loop, which
stopped s3cmd from deleting the bucket forever.
Per check, when the bucket index was sharded (for example 128
shards), the original logic in
RGWRados::cls_bucket_list_unordered() did not calculate
the bucket shard ID correctly when the index key of a data
part was taken as the marker.

The issue is not necessarily reproduced each time. It will depend
on the key of the object. To reproduce it in 128-shard bucket,
we use 334 as the key for the incomplete multipart upload,
which will be located in Shard 127 (known by experiment). In this
setup, the original logic will usually come out a shard ID smaller
than 127 (since 127 is the largest one) from the marker and
thus a circle is constructed, which results in an infinite loop.

PS: Some times the bucket ID calculation may incorrectly going forward
instead of backward. Thus, the check logic may skip some shards,
which may have regular keys. In such scenarios, some non-empty buckets may
be deleted by accident.

Fixes: http://tracker.ceph.com/issues/49206
Signed-off-by: Jeegn Chen <jeegnchen@tencent.com>
(cherry picked from commit 3cafe5774a5a453d58a3a6bed1f02d3200c4bb1d)
src/rgw/rgw_rados.cc