From 614b5d3d3bcf8f373b38ec75ea6607b8e1f7f867 Mon Sep 17 00:00:00 2001 From: Aran85 Date: Wed, 12 May 2021 09:33:06 +0800 Subject: [PATCH] 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 (cherry picked from commit 0e4ffe5e51291d1776aacfc0d88aa3b5f4c3ecca) --- src/osd/PrimaryLogPG.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 71f5e68ab1b2c..9fb22e0f9ee53 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -6559,6 +6559,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, -- 2.39.5