From: David Zafman Date: Wed, 17 May 2017 16:41:33 +0000 (-0700) Subject: osd: Handle read error when pushing after pull completion X-Git-Tag: ses5-milestone8~1^2~19^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6673c01e21a3add1e3ee883144584edfac228817;p=ceph.git osd: Handle read error when pushing after pull completion Signed-off-by: David Zafman --- diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index 4b2793802068..8fcc42ab3f90 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -104,6 +104,8 @@ typedef ceph::shared_ptr OSDMapRef; const hobject_t oid) = 0; virtual void failed_push(const list &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; diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index c6c3b74050e9..4faae4005958 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -519,8 +519,7 @@ void PrimaryLogPG::on_primary_error( eversion_t v) { dout(0) << __func__ << ": oid " << oid << " version " << v << dendl; - list 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 fl = { pg_whoami }; + failed_push(fl, soid); +} + void PrimaryLogPG::failed_push(const list &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 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 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()); diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 93dacfe1d039..fc97c68344d7 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -263,6 +263,7 @@ public: const hobject_t &oid, const object_stat_sum_t &stat_diff) override; void failed_push(const list &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); diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 81d7e8771f69..5161ca6fe270 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -859,9 +859,11 @@ struct C_ReplicatedBackend_OnPullComplete : GenContext { 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); }