From 7d3293505e8556d2efc02be8cebf64ba12b3cbbf Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 4 Dec 2008 10:07:43 -0800 Subject: [PATCH] osd: clear waiting_for_head when we pull the head; set skipped if we do Need to ++skipped if we skip because we're waiting for the head or else we'll incorrectly advanced requested_to. Clear waiting_for_head entry when we pull a head we're waiting for. --- src/osd/ReplicatedPG.cc | 58 +++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 50f596b567f21..bf71788adb45b 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -2416,6 +2416,9 @@ void ReplicatedPG::sub_op_push(MOSDSubOp *op) missing_loc.erase(poid.oid); + if (poid.oid.snap == CEPH_NOSNAP && waiting_for_head.count(poid.oid)) + waiting_for_head.erase(poid.oid); + // close out pull op? if (pulling.count(poid.oid)) pulling.erase(poid.oid); @@ -2681,35 +2684,38 @@ int ReplicatedPG::recover_primary(int max) if (latest->is_update() && !pulling.count(latest->oid) && - !waiting_for_head.count(latest->oid) && missing.is_missing(latest->oid)) { - pobject_t poid(info.pgid.pool(), 0, latest->oid); - - // is this a clone operation that we can do locally? - if (latest->op == Log::Entry::CLONE) { - pobject_t head = poid; - head.oid.snap = CEPH_NOSNAP; - if (missing.is_missing(head.oid) && - missing.have_old(head.oid) == latest->prior_version) { - dout(10) << "recover_primary cloning " << head << " v" << latest->prior_version - << " to " << poid << " v" << latest->version - << " snaps " << latest->snaps << dendl; - ObjectStore::Transaction t; - _make_clone(t, head, poid, latest->prior_version, latest->version, - latest->snaps); - osd->store->apply_transaction(t); - missing.got(latest->oid, latest->version); - missing_loc.erase(latest->oid); - continue; + if (waiting_for_head.count(latest->oid)) { + ++skipped; + } else { + pobject_t poid(info.pgid.pool(), 0, latest->oid); + + // is this a clone operation that we can do locally? + if (latest->op == Log::Entry::CLONE) { + pobject_t head = poid; + head.oid.snap = CEPH_NOSNAP; + if (missing.is_missing(head.oid) && + missing.have_old(head.oid) == latest->prior_version) { + dout(10) << "recover_primary cloning " << head << " v" << latest->prior_version + << " to " << poid << " v" << latest->version + << " snaps " << latest->snaps << dendl; + ObjectStore::Transaction t; + _make_clone(t, head, poid, latest->prior_version, latest->version, + latest->snaps); + osd->store->apply_transaction(t); + missing.got(latest->oid, latest->version); + missing_loc.erase(latest->oid); + continue; + } } + + if (pull(poid)) + ++started; + else + ++skipped; + if (started >= max) + return started; } - - if (pull(poid)) - ++started; - else - ++skipped; - if (started >= max) - return started; } p++; -- 2.39.5