Skip to content

Commit b101e74

Browse files
Mikulas Patockagregkh
authored andcommitted
dm integrity: set journal entry unused when shrinking device
commit cc09e8a upstream. Commit f6f72f3 ("dm integrity: don't replay journal data past the end of the device") skips journal replay if the target sector points beyond the end of the device. Unfortunatelly, it doesn't set the journal entry unused, which resulted in this BUG being triggered: BUG_ON(!journal_entry_is_unused(je)) Fix this by calling journal_entry_set_unused() for this case. Fixes: f6f72f3 ("dm integrity: don't replay journal data past the end of the device") Cc: [email protected] # v5.7+ Signed-off-by: Mikulas Patocka <[email protected]> Tested-by: Milan Broz <[email protected]> [snitzer: revised header] Signed-off-by: Mike Snitzer <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d5d5804 commit b101e74

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/md/dm-integrity.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,9 +2354,11 @@ static void do_journal_write(struct dm_integrity_c *ic, unsigned write_start,
23542354
dm_integrity_io_error(ic, "invalid sector in journal", -EIO);
23552355
sec &= ~(sector_t)(ic->sectors_per_block - 1);
23562356
}
2357+
if (unlikely(sec >= ic->provided_data_sectors)) {
2358+
journal_entry_set_unused(je);
2359+
continue;
2360+
}
23572361
}
2358-
if (unlikely(sec >= ic->provided_data_sectors))
2359-
continue;
23602362
get_area_and_offset(ic, sec, &area, &offset);
23612363
restore_last_bytes(ic, access_journal_data(ic, i, j), je);
23622364
for (k = j + 1; k < ic->journal_section_entries; k++) {

0 commit comments

Comments
 (0)