From 810e718997017e4d0e95c2eb0c3e88476ecdc1a7 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 18 Jun 2019 03:00:09 +0000 Subject: [PATCH] scst_vdisk: Make flushing work with the rbd driver 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") # trunk r6991. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8430 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 3b3952e16..b9ae11c78 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -459,9 +459,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;