]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: make ObjectState mutable. Evict mutated state on error.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 29 Apr 2019 18:57:24 +0000 (20:57 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 8 May 2019 05:44:11 +0000 (07:44 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/pg.cc
src/crimson/osd/pg.h
src/crimson/osd/pg_backend.cc
src/crimson/osd/pg_backend.h

index d3e604f89a27856726ecc83284715ada763f17dd..d3912f1e1b659184e2602661fd8def6de1abfd49 100644 (file)
@@ -969,8 +969,9 @@ seastar::future<> PG::wait_for_active()
   }
 }
 
+// TODO: split the method accordingly to os' constness needs
 seastar::future<>
-PG::do_osd_op(const ObjectState& os, OSDOp& osd_op, ceph::os::Transaction& txn)
+PG::do_osd_op(ObjectState& os, OSDOp& osd_op, ceph::os::Transaction& txn)
 {
   // TODO: dispatch via call table?
   // TODO: we might want to find a way to unify both input and output
@@ -994,6 +995,7 @@ PG::do_osd_op(const ObjectState& os, OSDOp& osd_op, ceph::os::Transaction& txn)
     // through path somehow works but this is really nasty.
     [[fallthrough]];
   case CEPH_OSD_OP_WRITEFULL:
+    // XXX: os = backend->write(std::move(os), ...) instead?
     return backend->writefull(os, osd_op, txn);
   case CEPH_OSD_OP_SETALLOCHINT:
     return seastar::now();
@@ -1025,6 +1027,9 @@ seastar::future<Ref<MOSDOpReply>> PG::do_osd_ops(Ref<MOSDOp> m)
       reply->add_flags(CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK);
       return seastar::make_ready_future<Ref<MOSDOpReply>>(std::move(reply));
     }).handle_exception_type([=](const object_not_found& dne) {
+      logger().debug("got object_not_found for {}", oid);
+
+      backend->evict_object_state(oid);
       auto reply = make_message<MOSDOpReply>(m.get(), -ENOENT, get_osdmap_epoch(),
                                              0, false);
       reply->set_enoent_reply_versions(info.last_update,
index bcf6eea4d4eb511231f3e6e48cc0a1d1173cd497..12f6bd730e47aeaa93b1a0d8bfb2f13b52311ccc 100644 (file)
@@ -131,7 +131,7 @@ private:
                            int new_acting_primary);
   seastar::future<Ref<MOSDOpReply>> do_osd_ops(Ref<MOSDOp> m);
   seastar::future<> do_osd_op(
-    const ObjectState& os,
+    ObjectState& os,
     OSDOp& op,
     ceph::os::Transaction& txn);
 
index 25bac37cc38ddf8ccafb2613f88dff81f3a36126..11459db34ec7067bd63ff8cfe1e2340bcf20b7ca 100644 (file)
@@ -199,7 +199,7 @@ seastar::future<bufferlist> PGBackend::read(const object_info_t& oi,
 }
 
 seastar::future<> PGBackend::writefull(
-  const ObjectState& os,
+  ObjectState& os,
   const OSDOp& osd_op,
   ceph::os::Transaction& txn)
 {
index 69a55be25612dc50e8d8c68d067bd25861e5d50c..003ef0151f198ea533b5b2f27baa640d2097fd54 100644 (file)
@@ -42,7 +42,7 @@ public:
                                   uint32_t truncate_seq,
                                   uint32_t flags);
   seastar::future<> writefull(
-    const ObjectState& os,
+    ObjectState& os,
     const OSDOp& osd_op,
     ceph::os::Transaction& trans);
   seastar::future<> submit_transaction(ceph::os::Transaction&& txn);