linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: majianpeng <majianpeng@gmail.com>
To: nab <nab@linux-iscsi.org>
Cc: linux-scsi <linux-scsi@vger.kernel.org>
Subject: [PATCH 5/6] scsi-mq: fix 'BUG_ON(count > sdb->table.nents)' in scsi_init_sgtable().
Date: Fri, 29 Nov 2013 16:42:39 +0800	[thread overview]
Message-ID: <2013112916422942442410@gmail.com> (raw)

Test cdrom on intel ahci, it will trigger this condition.
This is because scsi-mq don' test 'q->dma_drain_size &&
blk_rq_bytes(rq)' like in blk_peek_request().

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
 drivers/scsi/scsi-mq.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/scsi/scsi-mq.c b/drivers/scsi/scsi-mq.c
index 933ba0f..78b05c1 100644
--- a/drivers/scsi/scsi-mq.c
+++ b/drivers/scsi/scsi-mq.c
@@ -35,6 +35,16 @@ static int scsi_mq_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *rq)
 	sc->device = sdev;
 	sc->sense_buffer = sense_buf;
 	sc->mq_sgl = sg;
+
+	if (q->dma_drain_size && blk_rq_bytes(rq)) {
+		/*
+		 * make sure space for the drain appears we
+		 * know we can do this because max_hw_segments
+		 * has been adjusted to be one fewer than the
+		 * device can handle
+		 */
+		rq->nr_phys_segments++;
+	}
 	/*
 	 * Mark the end of the pre-allocated SGL based upon the
 	 * incoming number of physical segments from blk-mq
-- 
1.7.10.4

             reply	other threads:[~2013-11-29  8:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-29  8:42 majianpeng [this message]
2013-12-23  6:33 ` [PATCH 5/6] scsi-mq: fix 'BUG_ON(count > sdb->table.nents)' in scsi_init_sgtable() Nicholas A. Bellinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2013112916422942442410@gmail.com \
    --to=majianpeng@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).