summaryrefslogtreecommitdiff
path: root/lib/crc-ccitt.c
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2017-11-10 15:53:31 +0300
committerMike Snitzer <snitzer@redhat.com>2017-11-10 23:43:39 +0300
commitd1260e2a3f85f4c1010510a15f89597001318b1b (patch)
tree55b36baaa68a1c813e457e4d20c734ba353886f5 /lib/crc-ccitt.c
parent6bdd079610d3a5de0f4eb78d8015bd530c291cd7 (diff)
downloadlinux-d1260e2a3f85f4c1010510a15f89597001318b1b.tar.xz
dm cache: fix race condition in the writeback mode overwrite_bio optimisation
When a DM cache in writeback mode moves data between the slow and fast device it can often avoid a copy if the triggering bio either: i) covers the whole block (no point copying if we're about to overwrite it) ii) the migration is a promotion and the origin block is currently discarded Prior to this fix there was a race with case (ii). The discard status was checked with a shared lock held (rather than exclusive). This meant another bio could run in parallel and write data to the origin, removing the discard state. After the promotion the parallel write would have been lost. With this fix the discard status is re-checked once the exclusive lock has been aquired. If the block is no longer discarded it falls back to the slower full copy path. Fixes: b29d4986d ("dm cache: significant rework to leverage dm-bio-prison-v2") Cc: stable@vger.kernel.org # v4.12+ Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'lib/crc-ccitt.c')
0 files changed, 0 insertions, 0 deletions