]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Handle read error when pushing after pull completion
authorDavid Zafman <dzafman@redhat.com>
Wed, 17 May 2017 16:41:33 +0000 (09:41 -0700)
committerDavid Zafman <dzafman@redhat.com>
Fri, 23 Jun 2017 15:02:51 +0000 (08:02 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/osd/PGBackend.h
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h
src/osd/ReplicatedBackend.cc

index 4b279380206831e04ca77e11e62800a46ec6e911..8fcc42ab3f909163b92e56d3347e946bd21a3d9e 100644 (file)
@@ -104,6 +104,8 @@ typedef ceph::shared_ptr<const OSDMap> OSDMapRef;
        const hobject_t oid) = 0;
 
      virtual void failed_push(const list<pg_shard_t> &from, const hobject_t &soid) = 0;
+     virtual void primary_failed(const hobject_t &soid) = 0;
+     virtual bool primary_error(const hobject_t& soid, eversion_t v) = 0;
      
      virtual void cancel_pull(const hobject_t &soid) = 0;
 
index c6c3b74050e95cf2975c9beab5dc61eea08ae6a8..4faae40059585b990cb9a7556a6a7bd231601574 100644 (file)
@@ -519,8 +519,7 @@ void PrimaryLogPG::on_primary_error(
   eversion_t v)
 {
   dout(0) << __func__ << ": oid " << oid << " version " << v << dendl;
-  list<pg_shard_t> fl = { pg_whoami };
-  failed_push(fl, oid);
+  primary_failed(oid);
   primary_error(oid, v);
   backfills_in_flight.erase(oid);
   missing_loc.add_missing(oid, v, eversion_t());
@@ -10258,6 +10257,12 @@ void PrimaryLogPG::recover_got(hobject_t oid, eversion_t v)
   }
 }
 
+void PrimaryLogPG::primary_failed(const hobject_t &soid)
+{
+  list<pg_shard_t> fl = { pg_whoami };
+  failed_push(fl, soid);
+}
+
 void PrimaryLogPG::failed_push(const list<pg_shard_t> &from, const hobject_t &soid)
 {
   dout(20) << __func__ << ": " << soid << dendl;
@@ -11351,8 +11356,7 @@ int PrimaryLogPG::prep_object_replica_pushes(
   obc->ondisk_read_unlock();
   if (r < 0) {
     dout(0) << __func__ << " Error " << r << " on oid " << soid << dendl;
-    list<pg_shard_t> fl = { pg_whoami };
-    failed_push(fl, soid);
+    primary_failed(soid);
     primary_error(soid, v);
     return 0;
   }
@@ -11947,8 +11951,7 @@ int PrimaryLogPG::prep_backfill_object_push(
   obc->ondisk_read_unlock();
   if (r < 0) {
     dout(0) << __func__ << " Error " << r << " on oid " << oid << dendl;
-    list<pg_shard_t> fl = { pg_whoami };
-    failed_push(fl, oid);
+    primary_failed(oid);
     primary_error(oid, v);
     backfills_in_flight.erase(oid);
     missing_loc.add_missing(oid, v, eversion_t());
index 93dacfe1d03900bd8ea735eab0167c83c9b9eda5..fc97c68344d7cebeab4623acfe00dbc247a151b2 100644 (file)
@@ -263,6 +263,7 @@ public:
     const hobject_t &oid,
     const object_stat_sum_t &stat_diff) override;
   void failed_push(const list<pg_shard_t> &from, const hobject_t &soid) override;
+  void primary_failed(const hobject_t &soid) override;
   bool primary_error(const hobject_t& soid, eversion_t v) override;
   void cancel_pull(const hobject_t &soid) override;
   void apply_stats(
@@ -1070,7 +1071,6 @@ protected:
   hobject_t last_backfill_started;
   bool new_backfill;
 
-  void primary_error(const hobject_t& soid, eversion_t v);
   int prep_object_replica_pushes(const hobject_t& soid, eversion_t v,
                                 PGBackend::RecoveryHandle *h);
 
index 81d7e8771f691eeb4858add358693e2dc4886238..5161ca6fe270b677e3f53d0eefc8ab00e1227dd6 100644 (file)
@@ -859,9 +859,11 @@ struct C_ReplicatedBackend_OnPullComplete : GenContext<ThreadPool::TPHandle&> {
       ObjectContextRef obc = j->second.obc;
       bc->clear_pull(j, false /* already did it */);
       int started = bc->start_pushes(i.hoid, obc, h);
-      // XXX: Handle errors here?
-      assert(started >= 0);
-      if (!started) {
+      if (started < 0) {
+       bc->pushing[i.hoid].clear();
+       bc->get_parent()->primary_failed(i.hoid);
+       bc->get_parent()->primary_error(i.hoid, obc->obs.oi.version);
+      } else if (!started) {
        bc->get_parent()->on_global_recover(
          i.hoid, i.stat);
       }