]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: apply errorator along the read path, part 4.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 10 Sep 2019 12:31:57 +0000 (14:31 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 20 Nov 2019 19:37:27 +0000 (20:37 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/common/errorator.h
src/crimson/osd/ops_executer.cc
src/crimson/osd/pg_backend.cc
src/crimson/osd/pg_backend.h

index 410d69176d1e49718c966cc3a9008beeae42c056..003c9e3ef04a4736b804bf704c3bd1c9be270d4e 100644 (file)
@@ -12,7 +12,8 @@ namespace _impl {
     enoent,
     invarg,
     enodata,
-    input_output_error
+    input_output_error,
+    object_corrupted
   };
 }
 
@@ -418,6 +419,7 @@ namespace ct_error {
   using enodata = unthrowable_wrapper<_impl::ct_error::enodata>;
   using invarg = unthrowable_wrapper<_impl::ct_error::invarg>;
   using input_output_error = unthrowable_wrapper<_impl::ct_error::input_output_error>;
+  using object_corrupted = unthrowable_wrapper<_impl::ct_error::object_corrupted>;
 }
 
 } // namespace crimson
index 385fcb0a8b959193a97b65c94bddb53cad78479d..3e7519dfb643245afcb6441a0de106135abe9f08 100644 (file)
@@ -365,12 +365,12 @@ OpsExecuter::execute_osd_op(OSDOp& osd_op)
                           osd_op.op.extent.length,
                           osd_op.op.extent.truncate_size,
                           osd_op.op.extent.truncate_seq,
-                          osd_op.op.flags).then(
+                          osd_op.op.flags).safe_then(
         [&osd_op](bufferlist bl) {
           osd_op.rval = bl.length();
           osd_op.outdata = std::move(bl);
           return seastar::now();
-        });
+        }, PGBackend::read_errorator::discard_all{});
     });
   case CEPH_OSD_OP_GETXATTR:
     return do_read_op([&osd_op] (auto& backend, const auto& os) {
index 43614732c292b12968039a7cbca2735c9b258587..81b47f70f400847e64dfb5787016fcd1f9f56c89 100644 (file)
@@ -226,12 +226,13 @@ static inline bool _read_verify_data(
   return true;
 }
 
-seastar::future<bufferlist> PGBackend::read(const object_info_t& oi,
-                                            size_t offset,
-                                            size_t length,
-                                            size_t truncate_size,
-                                            uint32_t truncate_seq,
-                                            uint32_t flags)
+PGBackend::read_errorator::future<ceph::bufferlist>
+PGBackend::read(const object_info_t& oi,
+                const size_t offset,
+                size_t length,
+                const size_t truncate_size,
+                const uint32_t truncate_seq,
+                const uint32_t flags)
 {
   logger().trace("read: {} {}~{}", oi.soid, offset, length);
   // are we beyond truncate_size?
@@ -250,13 +251,13 @@ seastar::future<bufferlist> PGBackend::read(const object_info_t& oi,
     return seastar::make_ready_future<bufferlist>();
   }
   return _read(oi.soid, offset, length, flags).safe_then(
-    [&oi](auto&& bl) {
+    [&oi](auto&& bl) -> read_errorator::future<ceph::bufferlist> {
       if (const bool is_fine = _read_verify_data(oi, bl); is_fine) {
         return seastar::make_ready_future<bufferlist>(std::move(bl));
       } else {
-        throw crimson::osd::object_corrupted{};
+        return crimson::make_error<ceph::ct_error::object_corrupted>();
       }
-    }, ll_read_errorator::throw_as_runtime_error{});
+    }, ll_read_errorator::pass_further{});
 }
 
 seastar::future<> PGBackend::stat(
index 4c26c568a7c17b04809e6c1d03ae6a8d78daa3d1..2ea325032cbf8bb0fde8be8ed4f7d6e0f97693eb 100644 (file)
@@ -47,14 +47,16 @@ public:
   seastar::future<cached_os_t> get_object_state(const hobject_t& oid);
   seastar::future<> evict_object_state(const hobject_t& oid);
 
-  using read_errorator = \
-    ll_read_errorator::extend<crimson::ct_error::input_output_error>;
-  seastar::future<bufferlist> read(const object_info_t& oi,
-                                  uint64_t off,
-                                  uint64_t len,
-                                  size_t truncate_size,
-                                  uint32_t truncate_seq,
-                                  uint32_t flags);
+  using read_errorator = ll_read_errorator::extend<
+    crimson::ct_error::input_output_error,
+    crimson::ct_error::object_corrupted>;
+  read_errorator::future<ceph::bufferlist> read(
+    const object_info_t& oi,
+    uint64_t off,
+    uint64_t len,
+    size_t truncate_size,
+    uint32_t truncate_seq,
+    uint32_t flags);
   seastar::future<> stat(
     const ObjectState& os,
     OSDOp& osd_op);