]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: always encode snaps in finish_ctx
authorSage Weil <sage@inktank.com>
Thu, 26 Dec 2013 17:19:08 +0000 (09:19 -0800)
committerSage Weil <sage@inktank.com>
Tue, 14 Jan 2014 00:19:40 +0000 (16:19 -0800)
On promote we use finish_ctx to build the final log entries, and need to
encode the snaps vector in that case.  (Normally this is done by
make_writeable or explicitly by the snap trimmer.)

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/ReplicatedPG.cc

index 2b9bb5cc70ee5004195582236512950deb28e9f6..1119d2c9926415f0743665d47295814db5c345de 100644 (file)
@@ -4645,6 +4645,10 @@ void ReplicatedPG::finish_ctx(OpContext *ctx, int log_op_type)
                                    ctx->obs->oi.version,
                                    ctx->user_at_version, ctx->reqid,
                                    ctx->mtime));
+  if (soid.snap < CEPH_NOSNAP) {
+    dout(20) << __func__ << " encoding snaps " << ctx->new_obs.oi.snaps << dendl;
+    ::encode(ctx->new_obs.oi.snaps, ctx->log.back().snaps);
+  }
 
   // apply new object state.
   ctx->obc->obs = ctx->new_obs;