From: Tianshan Qu Date: Wed, 21 Aug 2019 04:33:37 +0000 (+0800) Subject: rgw: fix some list buckets handle leak X-Git-Tag: v15.2.4~10^2~8^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F34985%2Fhead;p=ceph.git rgw: fix some list buckets handle leak Fixes: https://tracker.ceph.com/issues/44283 Signed-off-by: Tianshan Qu (cherry picked from commit 8955ca2c0c804f6c43bb33c97bbe263bac1cc36d) --- diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 2e1e8b39ac2a..c017418826e7 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -1655,6 +1655,7 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState formatter->dump_string("bucket", bucket_name); } } + store->ctl()->meta.mgr->list_keys_complete(handle); formatter->close_section(); } @@ -1811,6 +1812,11 @@ static int process_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdmi bool truncated; formatter->open_array_section("keys"); + auto g = make_scope_guard([&store, &handle, &formatter]() { + store->ctl()->meta.mgr->list_keys_complete(handle); + formatter->close_section(); // keys + formatter->flush(cout); + }); do { list keys; @@ -1836,8 +1842,6 @@ static int process_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdmi } } while (truncated); - formatter->close_section(); // keys - formatter->flush(cout); return 0; }