]> git.baikalelectronics.ru Git - kernel.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)
committerMike Snitzer <snitzer@redhat.com>
Thu, 27 Mar 2014 20:56:23 +0000 (16:56 -0400)
commit0977fa0496bd15ad1c02aae7c693a5b024943288
tree9e436740996dd835cf2d9fff2c148cc48cf7b9e9
parent21e7a00abda2e871e1ec2d9480ff3fb71690e35d
dm cache: prevent corruption caused by discard_block_size > cache_block_size

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>
Cc: stable@vger.kernel.org
drivers/md/dm-cache-target.c