mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
dm-writecache: fix uncommitted_blocks underflow
Revert the commit39495b12efwritecache_bio_copy_ssd sets wc->uncommitted_blocks = 0; and then queues the flush work: queue_work(wc->writeback_wq, &wc->flush_work); It may be possible that discard is dispatched in this window, and the discard would decrement wc->uncommitted_blocks to -1U. Note that this bug is benign - wc->uncommitted_blocks is only used to trigged autocommit, so decrementing it to -1U will trigger a spurious autocommit, but won't cause any data corruption. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Assisted-by: Claude:claude-opus-5 Fixes:39495b12ef("dm writecache: correct uncommitted_block when discarding uncommitted entry") Cc: stable@vger.kernel.org
This commit is contained in:
parent
b15dc73f60
commit
8a0cc5f344
|
|
@ -901,8 +901,6 @@ static void writecache_discard(struct dm_writecache *wc, sector_t start, sector_
|
|||
}
|
||||
discarded_something = true;
|
||||
}
|
||||
if (!writecache_entry_is_committed(wc, e))
|
||||
wc->uncommitted_blocks--;
|
||||
writecache_free_entry(wc, e);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user