Skip to content
/ linux Public

Commit fa56f90

Browse files
Mikulas PatockaSasha Levin
authored andcommitted
dm-integrity: fix a typo in the code for write/discard race
[ Upstream commit c698b7f ] If we send a write followed by a discard, it may be possible that the discarded data end up being overwritten by the previous write from the journal. The code tries to prevent that, but there was a typo in this logic that made it not being activated as it should be. Note that if we end up here the second time (when discard_retried is true), it means that the write bio is actually racing with the discard bio, and in this situation it is not specified which of them should win. Cc: stable@vger.kernel.org Fixes: 31843ed ("dm integrity: improve discard in journal mode") Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent eb2cf62 commit fa56f90

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/md/dm-integrity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2298,7 +2298,7 @@ static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map
22982298
sector_t next_sector;
22992299
unsigned int new_pos = find_journal_node(ic, dio->range.logical_sector, &next_sector);
23002300
if (unlikely(new_pos != NOT_FOUND) ||
2301-
unlikely(next_sector < dio->range.logical_sector - dio->range.n_sectors)) {
2301+
unlikely(next_sector < dio->range.logical_sector + dio->range.n_sectors)) {
23022302
remove_range_unlocked(ic, &dio->range);
23032303
spin_unlock_irq(&ic->endio_wait.lock);
23042304
queue_work(ic->commit_wq, &ic->commit_work);

0 commit comments

Comments
 (0)