[PATCH 4.19 051/140] dm writecache: handle REQ_FUA

From: Greg Kroah-Hartman
Date: Mon Dec 16 2019 - 13:05:04 EST


From: Maged Mokhtar <mmokhtar@xxxxxxxxxxx>

commit c1005322ff02110a4df7f0033368ea015062b583 upstream.

Call writecache_flush() on REQ_FUA in writecache_map().

Cc: stable@xxxxxxxxxxxxxxx # 4.18+
Signed-off-by: Maged Mokhtar <mmokhtar@xxxxxxxxxxx>
Acked-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>
Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/md/dm-writecache.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -1223,7 +1223,8 @@ bio_copy:
}
} while (bio->bi_iter.bi_size);

- if (unlikely(wc->uncommitted_blocks >= wc->autocommit_blocks))
+ if (unlikely(bio->bi_opf & REQ_FUA ||
+ wc->uncommitted_blocks >= wc->autocommit_blocks))
writecache_flush(wc);
else
writecache_schedule_autocommit(wc);