]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: use pending_attrs in rollback
authorSamuel Just <sam.just@inktank.com>
Sun, 9 Mar 2014 18:43:00 +0000 (11:43 -0700)
committerSamuel Just <sam.just@inktank.com>
Mon, 10 Mar 2014 23:02:41 +0000 (16:02 -0700)
Otherwise, we won't have the correct attr_cache in
make_writeable for the clone.

Fixes: #7663
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 8ea8a624850c121637b26067ab7ce2b38a6f0da1..1f85dd7b23f3e516d71280cae3dfae7a09bc561a 100644 (file)
@@ -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<string, bufferlist> &new_attrs)
+{
+  ctx->pending_attrs[obc].clear();
+  for (map<string, bufferlist>::iterator i = obc->attr_cache.begin();
+       i != obc->attr_cache.end();
+       ++i) {
+    ctx->pending_attrs[obc][i->first] = boost::optional<bufferlist>();
+  }
+  for (map<string, bufferlist>::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,
index dda41c0dab70728cb3ed55f0f28c4207e3df923e..7e2274df8884e52e43c3b7346ce677c0577e26e7 100644 (file)
@@ -1323,6 +1323,10 @@ public:
   void on_shutdown();
 
   // attr cache handling
+  void replace_cached_attrs(
+    OpContext *ctx,
+    ObjectContextRef obc,
+    const map<string, bufferlist> &new_attrs);
   void setattr_maybe_cache(
     ObjectContextRef obc,
     OpContext *op,