]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw:log_list_init() catches IoCtx::nobjects_begin() exceptions
authorlicc <lichaochao2_yewu@cmss.chinamobile.com>
Tue, 7 Feb 2023 07:31:44 +0000 (08:31 +0100)
committerlicc <lichaochao2_yewu@cmss.chinamobile.com>
Mon, 13 Feb 2023 01:00:49 +0000 (02:00 +0100)
Signed-off-by: lichaochao <lichaochao2_yewu@cmss.chinamobile.com>
src/rgw/driver/rados/rgw_rados.cc

index 4edcd4817db3f47f885dad7c8714599267c3c0fd..067ea9ca6e9460df53205695ec7efe1685f14c30 100644 (file)
@@ -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)