From: Zhiqiang Wang Date: Tue, 2 Jun 2015 08:20:35 +0000 (+0800) Subject: osd: set the blocked_by relationship when rolling back to a degraded X-Git-Tag: v9.1.0~345^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aff8aa1a7b408e7a61ecec40c6ebd8b9fe4afe6f;p=ceph.git osd: set the blocked_by relationship when rolling back to a degraded object In a scenario like below: - A rollback op comes in, and is enqueued. - Several other ops on the same object come in, and are enqueued. - The rollback op dispatches, and finds the object which it rollbacks to is degraded, then this op is pushbacked into a list to wait for the degraded object to recover. - The later ops are handled and responded back to client. - The degraded object recovers. The rollback op is enqueued again and finally responded to client. This breaks the op order. Need to set the blocked_by relationship to enqueue the later ops until the degraded object recovers. Signed-off-by: Zhiqiang Wang --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index aa87d85a9886..96f0994eb852 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -5493,6 +5493,8 @@ int ReplicatedPG::_rollback_to(OpContext *ctx, ceph_osd_op& op) if (is_degraded_or_backfilling_object(rollback_to_sobject)) { dout(20) << "_rollback_to attempted to roll back to a degraded object " << rollback_to_sobject << " (requested snapid: ) " << snapid << dendl; + ctx->obc->blocked_by = rollback_to; + rollback_to->blocking.insert(ctx->obc); wait_for_degraded_object(rollback_to_sobject, ctx->op); ret = -EAGAIN; } else if (rollback_to->obs.oi.soid.snap == CEPH_NOSNAP) {