]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/PrimaryLogPG: fix dirty range of write_full
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 14 Aug 2019 06:12:43 +0000 (14:12 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 19 Aug 2019 00:39:07 +0000 (08:39 +0800)
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 <xie.xingguo@zte.com.cn>
src/osd/PrimaryLogPG.cc

index 23f6dc5221154437eba00f8cfb36c65d3a210d89..d0b24b90bbcb174d81ec2ef2df0ebc7496677432 100644 (file)
@@ -6401,10 +6401,10 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& 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;