From 60c1b9a5788ceb9ae5f87bb73fcadfd038512437 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Sun, 9 Mar 2014 11:43:00 -0700 Subject: [PATCH] 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 --- src/osd/ReplicatedPG.cc | 20 +++++++++++++++++++- src/osd/ReplicatedPG.h | 4 ++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 8ea8a624850c1..1f85dd7b23f3e 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 dda41c0dab707..7e2274df8884e 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, -- 2.39.5