Merge tag 'ata-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal...
[sfrench/cifs-2.6.git] / block / blk-core.c
index 5fb6856745b4ee49ad789a8a2a9136a9c4fa0c31..82b5b2c53f1ee8e91150a03d3b4fa0453cbfad06 100644 (file)
@@ -753,12 +753,16 @@ void submit_bio_noacct(struct bio *bio)
         * Filter flush bio's early so that bio based drivers without flush
         * support don't have to worry about them.
         */
-       if (op_is_flush(bio->bi_opf) &&
-           !test_bit(QUEUE_FLAG_WC, &q->queue_flags)) {
-               bio->bi_opf &= ~(REQ_PREFLUSH | REQ_FUA);
-               if (!bio_sectors(bio)) {
-                       status = BLK_STS_OK;
+       if (op_is_flush(bio->bi_opf)) {
+               if (WARN_ON_ONCE(bio_op(bio) != REQ_OP_WRITE &&
+                                bio_op(bio) != REQ_OP_ZONE_APPEND))
                        goto end_io;
+               if (!test_bit(QUEUE_FLAG_WC, &q->queue_flags)) {
+                       bio->bi_opf &= ~(REQ_PREFLUSH | REQ_FUA);
+                       if (!bio_sectors(bio)) {
+                               status = BLK_STS_OK;
+                               goto end_io;
+                       }
                }
        }