From a2f5ac1365566754fa21345e73c5c0a53c50109d Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Sun, 28 Feb 2021 00:53:20 +0900 Subject: [PATCH] osd: update user_version if redirect object on promote() If the object is redirect manifest object, need to change user_version to the target object on promote() Signed-off-by: Myoungwon Oh --- src/osd/PrimaryLogPG.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 526e5ae45ad33..d1f924d063ba8 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -3904,7 +3904,21 @@ public: int r = results.get<0>(); if (ctx) { promote_results = results; - pg->execute_ctx(ctx); + if (obc->obs.oi.has_manifest() && obc->obs.oi.manifest.is_redirect()) { + ctx->user_at_version = results_data->user_version; + } + if (r >= 0) { + ctx->pg->execute_ctx(ctx); + } else { + if (r != -ECANCELED) { + if (ctx->op) + ctx->pg->osd->reply_op_error(ctx->op, r); + } else if (results_data->should_requeue) { + if (ctx->op) + ctx->pg->requeue_op(ctx->op); + } + ctx->pg->close_op_ctx(ctx); + } } else { pg->finish_promote_manifest(r, results_data, obc); } -- 2.39.5