Skip to content

Commit d11e615

Browse files
committed
xen-blkfront: If no barrier or flush is supported, use invalid operation.
Guard against issuing BLKIF_OP_WRITE_BARRIER or BLKIF_OP_FLUSH_CACHE by checking whether we successfully negotiated with the backend. The negotiation with the backend also sets the q->flush_flags which fortunately for us is also used when submitting an bio to us. If we don't support barriers or flushes it would be set to zero so we should never end up having to deal with REQ_FLUSH | REQ_FUA. However, other third party implementations of __make_request that might be stacked on top of us might not be so smart, so lets fix this up. Acked-by: Jan Beulich <[email protected]> Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
1 parent 8e6dc6f commit d11e615

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/block/xen-blkfront.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,9 @@ static void do_blkif_request(struct request_queue *rq)
380380

381381
blk_start_request(req);
382382

383-
if (req->cmd_type != REQ_TYPE_FS) {
383+
if ((req->cmd_type != REQ_TYPE_FS) ||
384+
((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) &&
385+
!info->flush_op)) {
384386
__blk_end_request_all(req, -EIO);
385387
continue;
386388
}

0 commit comments

Comments
 (0)