From: Samuel Just Date: Sun, 9 Mar 2014 18:43:00 +0000 (-0700) Subject: ReplicatedPG: use pending_attrs in rollback X-Git-Tag: v0.78~46^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=60c1b9a5788ceb9ae5f87bb73fcadfd038512437;p=ceph.git ReplicatedPG: use pending_attrs in rollback Otherwise, we won't have the correct attr_cache in make_writeable for the clone. Fixes: #7663 Signed-off-by: Samuel Just --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 8ea8a624850c..1f85dd7b23f3 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4587,7 +4587,7 @@ int ReplicatedPG::_rollback_to(OpContext *ctx, ceph_osd_op& op) t->remove(soid); } } - ctx->obc->attr_cache = rollback_to->attr_cache; + replace_cached_attrs(ctx, ctx->obc, rollback_to->attr_cache); } else { if (obs.exists) { ctx->mod_desc.mark_unrollbackable(); @@ -11346,6 +11346,24 @@ boost::statechart::result ReplicatedPG::WaitingOnReplicas::react(const SnapTrim& return transit< NotTrimming >(); } +void ReplicatedPG::replace_cached_attrs( + OpContext *ctx, + ObjectContextRef obc, + const map &new_attrs) +{ + ctx->pending_attrs[obc].clear(); + for (map::iterator i = obc->attr_cache.begin(); + i != obc->attr_cache.end(); + ++i) { + ctx->pending_attrs[obc][i->first] = boost::optional(); + } + for (map::const_iterator i = new_attrs.begin(); + i != new_attrs.end(); + ++i) { + ctx->pending_attrs[obc][i->first] = i->second; + } +} + void ReplicatedPG::setattr_maybe_cache( ObjectContextRef obc, OpContext *op, diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index dda41c0dab70..7e2274df8884 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -1323,6 +1323,10 @@ public: void on_shutdown(); // attr cache handling + void replace_cached_attrs( + OpContext *ctx, + ObjectContextRef obc, + const map &new_attrs); void setattr_maybe_cache( ObjectContextRef obc, OpContext *op,