dm cache: fix corruption seen when using cache > 2TB
authorJoe Thornber <ejt@redhat.com>
Thu, 9 Feb 2017 16:46:18 +0000 (11:46 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Mar 2017 05:41:44 +0000 (06:41 +0100)
commit9987feba902cbd6429cf3b3a3b6614aa23a555c2
treee454ed307168a4bf74c13422d93df01c5f068166
parentfe8f92c7beba2f1c6b1235e52e199eafbe4aa39a
dm cache: fix corruption seen when using cache > 2TB

commit ca763d0a53b264a650342cee206512bc92ac7050 upstream.

A rounding bug due to compiler generated temporary being 32bit was found
in remap_to_cache().  A localized cast in remap_to_cache() fixes the
corruption but this preferred fix (changing from uint32_t to sector_t)
eliminates potential for future rounding errors elsewhere.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-cache-target.c