Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Kubecek <mkubecek@suse.cz>2018-12-05 22:36:16 +0100
committerMichal Kubecek <mkubecek@suse.cz>2018-12-05 22:36:16 +0100
commitf26dedd495599b7993beddb98051e869c5d3c58e (patch)
treea398370e63eb9014783e054ed29c2885f21c0d21
parent4c4d12f630edb5d9c54710da9d5438927e39d390 (diff)
blk-mq: fix corruption with direct issue (bko#201685).
-rw-r--r--block/blk-mq.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 3f91c6e5b17a..d8f518c6ea38 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1715,6 +1715,15 @@ static blk_status_t __blk_mq_issue_directly(struct blk_mq_hw_ctx *hctx,
break;
case BLK_STS_RESOURCE:
case BLK_STS_DEV_RESOURCE:
+ /*
+ * If direct dispatch fails, we cannot allow any merging on
+ * this IO. Drivers (like SCSI) may have set up permanent state
+ * for this request, like SG tables and mappings, and if we
+ * merge to it later on then we'll still only do IO to the
+ * original part.
+ */
+ rq->cmd_flags |= REQ_NOMERGE;
+
blk_mq_update_dispatch_busy(hctx, true);
__blk_mq_requeue_request(rq);
break;