]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: check obj exists 45866/head
authorchunmei-liu <chunmei.liu@intel.com>
Tue, 12 Apr 2022 09:16:37 +0000 (02:16 -0700)
committerchunmei-liu <chunmei.liu@intel.com>
Fri, 15 Apr 2022 06:06:22 +0000 (23:06 -0700)
Signed-off-by: chunmei-liu <chunmei.liu@intel.com>
src/crimson/common/errorator.h
src/crimson/osd/ops_executer.h
src/crimson/osd/pg_backend.cc
src/crimson/osd/pg_backend.h

index 14c2e941e24005bc7f4cf59844252b3f39afc59e..d50dee547dc1f07d4fcbd1f7ed4ee90fc105a610 100644 (file)
@@ -1145,6 +1145,7 @@ namespace ct_error {
   using ecanceled = ct_error_code<std::errc::operation_canceled>;
   using einprogress = ct_error_code<std::errc::operation_in_progress>;
   using enametoolong = ct_error_code<std::errc::filename_too_long>;
+  using eexist = ct_error_code<std::errc::file_exists>;
 
   struct pass_further_all {
     template <class ErrorT>
index b81cea31a60dbbb6da4db90ffa3ad279116c8d2e..82bf50c2d4b9a65cab3af512fadec1dff59824fc 100644 (file)
@@ -40,6 +40,7 @@ class OpsExecuter : public seastar::enable_lw_shared_from_this<OpsExecuter> {
   using call_errorator = crimson::errorator<
     crimson::stateful_ec,
     crimson::ct_error::enoent,
+    crimson::ct_error::eexist,
     crimson::ct_error::invarg,
     crimson::ct_error::erange,
     crimson::ct_error::ecanceled,
index df6de8522b294fcf2474c71742ef63d3f4508031..3ef35252ff0a83ce5cb3649e267a509cb52f3d15 100644 (file)
@@ -732,7 +732,7 @@ PGBackend::write_iertr::future<> PGBackend::zero(
   return write_ertr::now();
 }
 
-PGBackend::interruptible_future<> PGBackend::create(
+PGBackend::create_iertr::future<> PGBackend::create(
   ObjectState& os,
   const OSDOp& osd_op,
   ceph::os::Transaction& txn,
@@ -741,7 +741,7 @@ PGBackend::interruptible_future<> PGBackend::create(
   if (os.exists && !os.oi.is_whiteout() &&
       (osd_op.op.flags & CEPH_OSD_OP_FLAG_EXCL)) {
     // this is an exclusive create
-    throw crimson::osd::make_error(-EEXIST);
+    return crimson::ct_error::eexist::make();
   }
 
   if (osd_op.indata.length()) {
@@ -751,7 +751,7 @@ PGBackend::interruptible_future<> PGBackend::create(
       std::string category;
       decode(category, p);
     } catch (buffer::error&) {
-      throw crimson::osd::invalid_argument();
+      return crimson::ct_error::invarg::make();
     }
   }
   maybe_create_new_object(os, txn, delta_stats);
index 7112247d65802edda00f8428a37c125ace84189d..8bd9526e6d29bed9828a78b89875fcc482e8ff3e 100644 (file)
@@ -124,7 +124,14 @@ public:
     ::crimson::interruptible::interruptible_errorator<
       ::crimson::osd::IOInterruptCondition,
       write_ertr>;
-  interruptible_future<> create(
+  using create_ertr = crimson::errorator<
+    crimson::ct_error::invarg,
+    crimson::ct_error::eexist>;
+  using create_iertr =
+    ::crimson::interruptible::interruptible_errorator<
+      ::crimson::osd::IOInterruptCondition,
+      create_ertr>;
+  create_iertr::future<> create(
     ObjectState& os,
     const OSDOp& osd_op,
     ceph::os::Transaction& trans,