]> 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)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Tue, 20 Aug 2024 13:01:58 +0000 (20:01 +0700)
Signed-off-by: lichaochao <lichaochao2_yewu@cmss.chinamobile.com>
(cherry picked from commit 14176f00f44d51b7ecbf9952a1fbbe056f7988eb)

src/rgw/rgw_rados.cc

index 157c5c993d23e9da6bfea537b117c41a3d7467e3..40e429d7b09379ff86c36dea850c24582f94dafb 100644 (file)
@@ -1462,10 +1462,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)