dm writecache: handle DAX to partitions on persistent memory correctly
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 24 Aug 2020 15:09:47 +0000 (11:09 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Sep 2020 17:14:31 +0000 (19:14 +0200)
commitcc06bdfc211bec77cd43eeed5f4eed790748667c
tree7d5e0130d14314a8e4a0dde9dad777c65b6abaa9
parent67ba86179fc6e67e9a3303918a6cdd1a2a49f6ef
dm writecache: handle DAX to partitions on persistent memory correctly

commit f9e040efcc28309e5c592f7e79085a9a52e31f58 upstream.

The function dax_direct_access doesn't take partitions into account,
it always maps pages from the beginning of the device. Therefore,
persistent_memory_claim() must get the partition offset using
get_start_sect() and add it to the page offsets passed to
dax_direct_access().

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: 48debafe4f2f ("dm: add writecache target")
Cc: stable@vger.kernel.org # 4.18+
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-writecache.c