dm writecache: flush origin device when writing and cache is full
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 15 Jun 2021 17:45:55 +0000 (13:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jul 2021 07:45:01 +0000 (09:45 +0200)
commit1b5918b087b1dd7bf193340f25ca63c50a277638
tree891da31d8ca87cf20967e7a45069b328588f17cf
parentcbc03ffec260c28cd177fee143f2fe74cc36ba00
dm writecache: flush origin device when writing and cache is full

commit ee55b92a7391bf871939330f662651b54be51b73 upstream.

Commit d53f1fafec9d086f1c5166436abefdaef30e0363 ("dm writecache: do
direct write if the cache is full") changed dm-writecache, so that it
writes directly to the origin device if the cache is full.
Unfortunately, it doesn't forward flush requests to the origin device,
so that there is a bug where flushes are being ignored.

Fix this by adding missing flush forwarding.

For PMEM mode, we fix this bug by disabling direct writes to the origin
device, because it performs better.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: d53f1fafec9d ("dm writecache: do direct write if the cache is full")
Cc: stable@vger.kernel.org # v5.7+
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-writecache.c