From e2f278675d185682176d36752428fe397028e60a Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Wed, 14 Aug 2019 14:12:43 +0800 Subject: [PATCH] osd/PrimaryLogPG: fix dirty range of write_full A write_full operation may implicitly truncate the object down, hence we need to mark the truncated part as dirty as well since follow-up randomized writes may still be able to (re)extend the object size and leave some holes against the truncated part, which as a result might cause problems during incremental-mode recovery. Note that write_update_size_and_usage would reset oi.size and that's why we move the mark_data_region_dirty call before that. Signed-off-by: xie xingguo --- src/osd/PrimaryLogPG.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 23f6dc5221154..d0b24b90bbcb1 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -6401,10 +6401,10 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) } else { obs.oi.clear_data_digest(); } - + ctx->clean_regions.mark_data_region_dirty(0, + std::max((uint64_t)op.extent.length, oi.size)); write_update_size_and_usage(ctx->delta_stats, oi, ctx->modified_ranges, 0, op.extent.length, true); - ctx->clean_regions.mark_data_region_dirty(0, op.extent.length); } break; -- 2.39.5