]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWSI_RADOS::Pool::List::init() catches IoCtx::nobjects_begin() exceptions 50016/head
authorlicc <lichaochao2_yewu@cmss.chinamobile.com>
Tue, 7 Feb 2023 08:02:19 +0000 (09:02 +0100)
committerlicc <lichaochao2_yewu@cmss.chinamobile.com>
Mon, 13 Feb 2023 01:01:26 +0000 (02:01 +0100)
Signed-off-by: lichaochao <lichaochao2_yewu@cmss.chinamobile.com>
src/rgw/services/svc_rados.cc

index 7d1239cec2c6d388814998ca478e2c1ddb0bd628..99f400f42b0211c60fa2fbeeccc6493094372b5f 100644 (file)
@@ -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,