From 0f1a61ee602b3ebd0c3d66188f2585c555dedf96 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 18 Jun 2019 14:18:17 +0000 Subject: [PATCH] scst_vdisk: Make flushing work with the rbd driver (merge r8430 from trunk) Some but not all block drivers support REQ_OP_FLUSH. Hence use REQ_OP_WRITE | REQ_PREFLUSH instead. See also https://github.com/bvanassche/scst/issues/16. Reported-by: Tomohiro Kusumi Fixes: d41307c162e7 ("scst: Port to Linux kernel v4.8") # r6991. git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@8432 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index a73888250..c74d1734f 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -6839,9 +6839,19 @@ static int vdisk_blockio_flush(struct block_device *bdev, gfp_t gfp_mask, #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) || \ (defined(CONFIG_SUSE_KERNEL) && \ LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) - bio_set_op_attrs(bio, REQ_OP_FLUSH, 0); + /* + * For the introduction of REQ_PREFLUSH, see also commit + * 28a8f0d317bf ("block, drivers, fs: rename REQ_FLUSH to + * REQ_PREFLUSH") # v4.8. + */ + bio_set_op_attrs(bio, REQ_OP_WRITE, REQ_PREFLUSH); submit_bio(bio); #else + /* + * For the introduction of WRITE_FLUSH, see also commit + * 4fed947cb311 ("block: implement REQ_FLUSH/FUA based + * interface for FLUSH/FUA requests") # v2.6.37. + */ submit_bio(WRITE_FLUSH, bio); #endif goto out;