From 89fa6ea7e1589b876b8e26ae7821a7a5f1a357ef Mon Sep 17 00:00:00 2001 From: Tianshan Qu Date: Wed, 21 Aug 2019 12:33:37 +0800 Subject: [PATCH] rgw: fix some list buckets handle leak Fixes: https://tracker.ceph.com/issues/44283 Signed-off-by: Tianshan Qu (cherry picked from commit 8955ca2c0c804f6c43bb33c97bbe263bac1cc36d) --- src/rgw/rgw_bucket.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; } -- 2.47.3