diff options
author | Adam Emerson <aemerson@redhat.com> | 2025-01-09 17:46:32 +0100 |
---|---|---|
committer | Adam Emerson <aemerson@redhat.com> | 2025-01-09 17:46:32 +0100 |
commit | 4318b188740634ead65a986680f9186541c9d1b0 (patch) | |
tree | 9b8824963f32896ef3aed2b133a03351387c65d4 /src/rgw/driver/rados/rgw_tools.cc | |
parent | Merge pull request #61243 from anthonyeleven/etags-fix (diff) | |
download | ceph-4318b188740634ead65a986680f9186541c9d1b0.tar.xz ceph-4318b188740634ead65a986680f9186541c9d1b0.zip |
rgw: Don't crash on exceptions from pool listing
Fixes: https://tracker.ceph.com/issues/69303
Signed-off-by: Adam Emerson <aemerson@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | src/rgw/driver/rados/rgw_tools.cc | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/rgw/driver/rados/rgw_tools.cc b/src/rgw/driver/rados/rgw_tools.cc index 79d2be0bcfa..bf7a309e864 100644 --- a/src/rgw/driver/rados/rgw_tools.cc +++ b/src/rgw/driver/rados/rgw_tools.cc @@ -339,21 +339,35 @@ int rgw_list_pool(const DoutPrefixProvider *dpp, ldpp_dout(dpp, 10) << "failed to parse cursor: " << marker << dendl; return -EINVAL; } - - auto iter = ioctx.nobjects_begin(oc); + librados::NObjectIterator iter; + try { + iter = ioctx.nobjects_begin(oc); + } catch (const std::system_error& e) { + ldpp_dout(dpp, 1) << "rgw_list_pool: Failed to begin iteration of pool " + << ioctx.get_pool_name() << " with error " + << e.what() << dendl; + return ceph::from_error_code(e.code()); + } /// Pool_iterate if (iter == ioctx.nobjects_end()) return -ENOENT; - for (; oids->size() < max && iter != ioctx.nobjects_end(); ++iter) { - string oid = iter->get_oid(); - ldpp_dout(dpp, 20) << "RGWRados::pool_iterate: got " << oid << dendl; + try { + for (; oids->size() < max && iter != ioctx.nobjects_end(); ++iter) { + string oid = iter->get_oid(); + ldpp_dout(dpp, 20) << "RGWRados::pool_iterate: got " << oid << dendl; - // fill it in with initial values; we may correct later - if (filter && !filter(oid, oid)) - continue; + // fill it in with initial values; we may correct later + if (filter && !filter(oid, oid)) + continue; - oids->push_back(oid); + oids->push_back(oid); + } + } catch (const std::system_error& e) { + ldpp_dout(dpp, 1) << "rgw_list_pool: Failed iterating pool " + << ioctx.get_pool_name() << " with error " + << e.what() << dendl; + return ceph::from_error_code(e.code()); } marker = iter.get_cursor().to_str(); |