From: Christoph Hellwig <hch@lst.de>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: kvm@vger.kernel.org
Subject: [PATCH] virtio_blk: don't blindly derefence req->rq_disk
Date: Mon, 11 May 2009 10:35:19 +0200 [thread overview]
Message-ID: <20090511083519.GA20082@lst.de> (raw)
request->rq_disk is only set for FS requests or BLOCK_PC requests
originating from the generic block layer scsi ioctls. It's not set
for requests origination from other soures or internal cache flush
commands implemented by the patch I'll send after this.
So instead of using it to get at the private data in do_virtblk_request
setup queue->queuedata and use it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: xfs/drivers/block/virtio_blk.c
===================================================================
--- xfs.orig/drivers/block/virtio_blk.c 2009-05-11 10:09:59.833784412 +0200
+++ xfs/drivers/block/virtio_blk.c 2009-05-11 10:33:31.099659254 +0200
@@ -153,12 +153,11 @@ static bool do_req(struct request_queue
static void do_virtblk_request(struct request_queue *q)
{
- struct virtio_blk *vblk = NULL;
+ struct virtio_blk *vblk = q->queuedata;
struct request *req;
unsigned int issued = 0;
while ((req = elv_next_request(q)) != NULL) {
- vblk = req->rq_disk->private_data;
BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems);
/* If this request fails, stop queue and wait for something to
@@ -286,6 +285,7 @@ static int virtblk_probe(struct virtio_d
goto out_put_disk;
}
+ vblk->disk->queue->queuedata = vblk;
queue_flag_set_unlocked(QUEUE_FLAG_VIRT, vblk->disk->queue);
if (index < 26) {
next reply other threads:[~2009-05-11 8:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-11 8:35 Christoph Hellwig [this message]
2009-05-12 13:44 ` [PATCH] virtio_blk: don't blindly derefence req->rq_disk Rusty Russell
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=20090511083519.GA20082@lst.de \
--to=hch@lst.de \
--cc=kvm@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/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