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: d41307c162 ("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
This commit is contained in:
Bart Van Assche
2019-06-18 14:18:17 +00:00
parent 7dcd0cc20e
commit 0f1a61ee60
+11 -1
View File
@@ -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;