]> git.baikalelectronics.ru Git - kernel.git/commit
dm cache: fix access beyond end of origin device
authorHeinz Mauelshagen <heinzm@redhat.com>
Wed, 12 Mar 2014 15:13:39 +0000 (16:13 +0100)
committerMike Snitzer <snitzer@redhat.com>
Wed, 12 Mar 2014 17:52:00 +0000 (13:52 -0400)
commit66f571877ce7619a98e690b305b19353fac68e38
tree6743c251b72ea02946b5ed6db89f876a2024335c
parente25be288798444bb3ca8154be64836b14166f085
dm cache: fix access beyond end of origin device

In order to avoid wasting cache space a partial block at the end of the
origin device is not cached.  Unfortunately, the check for such a
partial block at the end of the origin device was flawed.

Fix accesses beyond the end of the origin device that occured due to
attempted promotion of an undetected partial block by:

- initializing the per bio data struct to allow cache_end_io to work properly
- recognizing access to the partial block at the end of the origin device
- avoiding out of bounds access to the discard bitset

Otherwise, users can experience errors like the following:

 attempt to access beyond end of device
 dm-5: rw=0, want=20971520, limit=20971456
 ...
 device-mapper: cache: promotion failed; couldn't copy block

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Acked-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
drivers/md/dm-cache-target.c