From: Aran85 Date: Wed, 12 May 2021 01:33:06 +0000 (+0800) Subject: osd: clear data digest when write_trunc X-Git-Tag: v17.1.0~1983^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F41290%2Fhead;p=ceph.git osd: clear data digest when write_trunc 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 --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index e660cc49fa53..d64f26c66d42 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -6668,6 +6668,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& 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,