--- drivers/md/dm-integrity.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) Index: linux-2.6/drivers/md/dm-integrity.c =================================================================== --- linux-2.6.orig/drivers/md/dm-integrity.c 2019-04-23 16:23:58.000000000 +0200 +++ linux-2.6/drivers/md/dm-integrity.c 2019-04-23 17:35:48.000000000 +0200 @@ -2762,8 +2762,6 @@ static void dm_integrity_resume(struct d DEBUG_print("resume\n"); if (ic->mode == 'B') { - block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, ic->recalculate_flag ? BITMAP_OP_SET : BITMAP_OP_CLEAR); - block_bitmap_op(ic, ic->may_write_bitmap, 0, ic->provided_data_sectors, ic->recalculate_flag ? BITMAP_OP_SET : BITMAP_OP_CLEAR); } if (ic->sb->flags & cpu_to_le32(SB_FLAG_DIRTY_BITMAP)) { @@ -2803,17 +2801,22 @@ static void dm_integrity_resume(struct d } else { replay_journal(ic); if (ic->mode == 'B') { + int mode; ic->sb->flags |= cpu_to_le32(SB_FLAG_DIRTY_BITMAP); ic->sb->log2_blocks_per_bitmap_bit = ic->log2_blocks_per_bitmap_bit; r = sync_rw_sb(ic, REQ_OP_WRITE, REQ_FUA); if (unlikely(r)) dm_integrity_io_error(ic, "writing superblock", r); - block_bitmap_op(ic, ic->journal, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR); + + mode = ic->recalculate_flag ? BITMAP_OP_SET : BITMAP_OP_CLEAR; + block_bitmap_op(ic, ic->journal, 0, ic->provided_data_sectors, mode); + block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, mode); + block_bitmap_op(ic, ic->may_write_bitmap, 0, ic->provided_data_sectors, mode); rw_journal_sectors(ic, REQ_OP_WRITE, REQ_FUA | REQ_SYNC, 0, ic->n_bitmap_blocks * (BITMAP_BLOCK_SIZE >> SECTOR_SHIFT), NULL); } } - DEBUG_print("testing recalc: %x %x", ic->sb->flags, ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)); + DEBUG_print("testing recalc: %x\n", ic->sb->flags); if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)) { __u64 recalc_pos = le64_to_cpu(ic->sb->recalc_sector); DEBUG_print("recalc pos: %lx / %lx\n", (long)recalc_pos, ic->provided_data_sectors);