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: d41307c162 ("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
This commit is contained in:
Bart Van Assche
2019-06-18 03:00:09 +00:00
parent 3749561e2f
commit 810e718997

View File

@@ -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;