From 478389924b9e1296d4b65e8cea6f64cb01cc5263 Mon Sep 17 00:00:00 2001 From: Zhiqiang Wang Date: Thu, 18 Jun 2015 15:32:48 +0800 Subject: [PATCH] osd: return ENOENT when object doesn't exist for cache pin/unpin Signed-off-by: Zhiqiang Wang --- src/osd/ReplicatedPG.cc | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 2402a2b6d9dee..e012a1c624494 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -5098,14 +5098,10 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops) } ++ctx->num_write; { - if (!obs.exists) { - assert(!oi.is_cache_pinned()); - ctx->mod_desc.create(); - t->touch(soid); - ctx->delta_stats.num_objects++; - obs.exists = true; - obs.oi.new_object(); - } + if (!obs.exists || oi.is_whiteout()) { + result = -ENOENT; + break; + } if (!oi.is_cache_pinned()) { oi.set_flag(object_info_t::FLAG_CACHE_PIN); @@ -5127,10 +5123,10 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops) } ++ctx->num_write; { - if (!obs.exists) { - result = 0; + if (!obs.exists || oi.is_whiteout()) { + result = -ENOENT; break; - } + } if (oi.is_cache_pinned()) { oi.clear_flag(object_info_t::FLAG_CACHE_PIN); -- 2.39.5