diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index 4edcd4817db3..067ea9ca6e94 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -1422,10 +1422,21 @@ int RGWRados::log_list_init(const DoutPrefixProvider *dpp, const string& prefix, delete state; return r; } - state->prefix = prefix; - state->obit = state->io_ctx.nobjects_begin(); - *handle = (RGWAccessHandle)state; - return 0; + try { + state->prefix = prefix; + state->obit = state->io_ctx.nobjects_begin(); + *handle = (RGWAccessHandle)state; + return 0; + } catch (const std::system_error& e) { + r = -e.code().value(); + ldpp_dout(dpp, 10) << "nobjects_begin threw " << e.what() + << ", returning " << r << dendl; + return r; + } catch (const std::exception& e) { + ldpp_dout(dpp, 10) << "nobjects_begin threw " << e.what() + << ", returning -5" << dendl; + return -EIO; + } } int RGWRados::log_list_next(RGWAccessHandle handle, string *name) diff --git a/src/rgw/services/svc_rados.cc b/src/rgw/services/svc_rados.cc index 7d1239cec2c6..99f400f42b02 100644 --- a/src/rgw/services/svc_rados.cc +++ b/src/rgw/services/svc_rados.cc @@ -330,11 +330,21 @@ int RGWSI_RADOS::Pool::List::init(const DoutPrefixProvider *dpp, const string& m return -EINVAL; } - ctx.iter = ctx.ioctx.nobjects_begin(oc); - ctx.filter = filter; - ctx.initialized = true; - - return 0; + try { + ctx.iter = ctx.ioctx.nobjects_begin(oc); + ctx.filter = filter; + ctx.initialized = true; + return 0; + } catch (const std::system_error& e) { + r = -e.code().value(); + ldpp_dout(dpp, 10) << "nobjects_begin threw " << e.what() + << ", returning " << r << dendl; + return r; + } catch (const std::exception& e) { + ldpp_dout(dpp, 10) << "nobjects_begin threw " << e.what() + << ", returning -5" << dendl; + return -EIO; + } } int RGWSI_RADOS::Pool::List::get_next(const DoutPrefixProvider *dpp,