From e8506b5adf96985df3113ab2f765041e21dc2369 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 30 Aug 2013 17:20:54 -0700 Subject: [PATCH] osd/ReplicatedPG: do not set ctx->user_at_version unless ctx->user_modify Leave ctx->user_at_version set to the previous oi.user_version unless/until we find that ctx->user_modify is true. Signed-off-by: Sage Weil --- src/osd/ReplicatedPG.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 5f458644af0fc..a50e0f263d6fa 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -969,7 +969,7 @@ void ReplicatedPG::execute_ctx(OpContext *ctx) << dendl; } - ctx->user_at_version = info.last_user_version; + ctx->user_at_version = obc->obs.oi.user_version; // note my stats utime_t now = ceph_clock_now(g_ceph_context); @@ -3951,14 +3951,14 @@ int ReplicatedPG::prepare_transaction(OpContext *ctx) // finish and log the op. if (ctx->user_modify) { - /* update the user_version for any modify ops, except for the watch op */ - ++ctx->user_at_version; - assert(ctx->user_at_version > ctx->new_obs.oi.user_version); + // update the user_version for any modify ops, except for the watch op + ctx->user_at_version = MAX(info.last_user_version, ctx->new_obs.oi.user_version) + 1; /* In order for new clients and old clients to interoperate properly * when exchanging versions, we need to lower bound the user_version * (which our new clients pay proper attention to) * by the at_version (which is all the old clients can ever see). */ - ctx->user_at_version = MAX(ctx->at_version.version, ctx->user_at_version); + if (ctx->at_version.version > ctx->user_at_version) + ctx->user_at_version = ctx->at_version.version; ctx->new_obs.oi.user_version = ctx->user_at_version; } ctx->bytes_written = ctx->op_t.get_encoded_bytes(); -- 2.39.5