]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: clear data digest when write_trunc 41620/head
authorAran85 <z13121369189@gmail.com>
Wed, 12 May 2021 01:33:06 +0000 (09:33 +0800)
committerCory Snyder <csnyder@iland.com>
Tue, 1 Jun 2021 11:47:37 +0000 (07:47 -0400)
like CEPH_OSD_OP_TRUNCATE, the truncate within CEPH_OSD_OP_WRITE should
clear oi.data_digest too.

consider such circumstance:
[write 0~10]
[write 5~10 [1@5]]

the first write will generate data_digest, if the second write don't
clear digest, it will continue calc digest and make crc mismatch.

Fixes: https://tracker.ceph.com/issues/50763
Signed-off-by: Zengran Zhang <zhangzengran@sangfor.com.cn>
(cherry picked from commit 0e4ffe5e51291d1776aacfc0d88aa3b5f4c3ecca)

src/osd/PrimaryLogPG.cc

index 5dac3a144fd093cb23cc8486de58897ae50e9fb9..76217a54e849c3e93c785bdc068c776a4ca2fb7e 100644 (file)
@@ -6400,6 +6400,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
                oi.size - op.extent.truncate_size);
              ctx->modified_ranges.union_of(trim);
              ctx->clean_regions.mark_data_region_dirty(op.extent.truncate_size, oi.size - op.extent.truncate_size);
+             oi.clear_data_digest();
            }
            if (op.extent.truncate_size != oi.size) {
               truncate_update_size_and_usage(ctx->delta_stats,