Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dm-integrity: fix a typo in the code for write/discard race

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: 31843edab7cb ("dm integrity: improve discard in journal mode")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

+1 -1
+1 -1
drivers/md/dm-integrity.c
··· 2411 2411 2412 2412 new_pos = find_journal_node(ic, dio->range.logical_sector, &next_sector); 2413 2413 if (unlikely(new_pos != NOT_FOUND) || 2414 - unlikely(next_sector < dio->range.logical_sector - dio->range.n_sectors)) { 2414 + unlikely(next_sector < dio->range.logical_sector + dio->range.n_sectors)) { 2415 2415 remove_range_unlocked(ic, &dio->range); 2416 2416 spin_unlock_irq(&ic->endio_wait.lock); 2417 2417 queue_work(ic->commit_wq, &ic->commit_work);