]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
dm cache: prevent corruption caused by discard_block_size > cache_block_size
authorMike Snitzer <snitzer@redhat.com>
Thu, 20 Mar 2014 14:11:15 +0000 (10:11 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 May 2014 11:32:55 +0000 (13:32 +0200)
commit8e0bb904dfd1e98743b8b62301b5d903405cb123
tree4ca0510308c75c10e07704f39436e665cd9d3072
parente07b5528f1f4adf101968d8c730201fe38b9b514
dm cache: prevent corruption caused by discard_block_size > cache_block_size

commit d132cc6d9e92424bb9d4fd35f5bd0e55d583f4be upstream.

If the discard block size is larger than the cache block size we will
not properly quiesce IO to a region that is about to be discarded.  This
results in a race between a cache migration where no copy is needed, and
a write to an adjacent cache block that's within the same large discard
block.

Workaround this by limiting the discard_block_size to cache_block_size.
Also limit the max_discard_sectors to cache_block_size.

A more comprehensive fix that introduces range locking support in the
bio_prison and proper quiescing of a discard range that spans multiple
cache blocks is already in development.

Reported-by: Morgan Mears <Morgan.Mears@netapp.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Joe Thornber <ejt@redhat.com>
Acked-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-cache-target.c