Skip to content

Commit e27fec6

Browse files
Mikulas Patockasnitm
authored andcommitted
dm integrity: fix error reporting in bitmap mode after creation
The dm-integrity target did not report errors in bitmap mode just after creation. The reason is that the function integrity_recalc didn't clean up ic->recalc_bitmap as it proceeded with recalculation. Fix this by updating the bitmap accordingly -- the double shift serves to rounddown. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Fixes: 468dfca ("dm integrity: add a bitmap mode") Cc: stable@vger.kernel.org # v5.2+ Signed-off-by: Mike Snitzer <snitzer@redhat.com>
1 parent 7785a9e commit e27fec6

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

drivers/md/dm-integrity.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,6 +2487,7 @@ static void integrity_recalc(struct work_struct *w)
24872487
range.logical_sector = le64_to_cpu(ic->sb->recalc_sector);
24882488
if (unlikely(range.logical_sector >= ic->provided_data_sectors)) {
24892489
if (ic->mode == 'B') {
2490+
block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR);
24902491
DEBUG_print("queue_delayed_work: bitmap_flush_work\n");
24912492
queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, 0);
24922493
}
@@ -2564,6 +2565,17 @@ static void integrity_recalc(struct work_struct *w)
25642565
goto err;
25652566
}
25662567

2568+
if (ic->mode == 'B') {
2569+
sector_t start, end;
2570+
start = (range.logical_sector >>
2571+
(ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)) <<
2572+
(ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit);
2573+
end = ((range.logical_sector + range.n_sectors) >>
2574+
(ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)) <<
2575+
(ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit);
2576+
block_bitmap_op(ic, ic->recalc_bitmap, start, end - start, BITMAP_OP_CLEAR);
2577+
}
2578+
25672579
advance_and_next:
25682580
cond_resched();
25692581

0 commit comments

Comments
 (0)