From: Zhiqiang Wang Date: Thu, 11 Jun 2015 07:53:45 +0000 (+0800) Subject: osd/ReplicatedPG: snapset is not persisted X-Git-Tag: v9.1.0~405^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F4927%2Fhead;p=ceph.git osd/ReplicatedPG: snapset is not persisted When the new_obs doesn't exist, and the old snapset obc does exist, we need to update the snapdir object with the latest snapset. Signed-off-by: Zhiqiang Wang --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index a443899a572a..f8d0d4f2056d 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -5732,9 +5732,7 @@ void ReplicatedPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc ctx->snapset_obc->obs.exists = false; } } - } else if (ctx->new_snapset.clones.size() && - !ctx->cache_evict && - (!ctx->snapset_obc || !ctx->snapset_obc->obs.exists)) { + } else if (ctx->new_snapset.clones.size() && !ctx->cache_evict) { // save snapset on _snap hobject_t snapoid(soid.oid, soid.get_key(), CEPH_SNAPDIR, soid.get_hash(), info.pgid.pool(), soid.get_namespace()); @@ -5762,6 +5760,9 @@ void ReplicatedPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc } else if (!pool.info.require_rollback()) { ctx->log.back().mod_desc.mark_unrollbackable(); } + if (!ctx->snapset_obc->obs.exists) { + ctx->op_t->touch(snapoid); + } ctx->snapset_obc->obs.exists = true; ctx->snapset_obc->obs.oi.version = ctx->at_version; ctx->snapset_obc->obs.oi.last_reqid = ctx->reqid; @@ -5770,7 +5771,6 @@ void ReplicatedPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc bufferlist bv(sizeof(ctx->new_obs.oi)); ::encode(ctx->snapset_obc->obs.oi, bv); - ctx->op_t->touch(snapoid); setattr_maybe_cache(ctx->snapset_obc, ctx, ctx->op_t, OI_ATTR, bv); setattr_maybe_cache(ctx->snapset_obc, ctx, ctx->op_t, SS_ATTR, bss); if (pool.info.require_rollback()) {