public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Roland Dreier <roland@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linux-scsi@vger.kernel.org,
	Steffen Maier <maier@linux.vnet.ibm.com>,
	"Manvanthara B. Puttashankar" <manvanth@linux.vnet.ibm.com>,
	Tarak Reddy <tarak.reddy@in.ibm.com>,
	"Seshagiri N. Ippili" <sesh17@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: Check that queue is alive in blk_insert_cloned_request()
Date: Sat, 9 Jul 2011 11:05:38 +0200	[thread overview]
Message-ID: <20110709110538.35e1ea1e@stein> (raw)
In-Reply-To: <1310166270-23196-1-git-send-email-roland@kernel.org>

On Jul 08 Roland Dreier wrote:
> This fixes crashes such as the below that I see when the storage
> underlying a dm-multipath device is hot-removed.  The problem is that
> dm requeues a request to a device whose block queue has already been
> cleaned up, and blk_insert_cloned_request() doesn't check if the queue
> is alive, but rather goes ahead and tries to queue the request.  This
> ends up dereferencing the elevator that was already freed in
> blk_cleanup_queue().
[...]
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -1706,6 +1706,9 @@ int blk_insert_cloned_request(struct request_queue *q, struct request *rq)
>  		return -EIO;
>  #endif
>  
> +	if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
> +		return -EIO;
> +
>  	spin_lock_irqsave(q->queue_lock, flags);
>  
>  	/*

Not knowing the calling contexts or having tried to learn about them, I am
wondering:  What prevents the elevator to be freed right after the flag
was checked?
-- 
Stefan Richter
-=====-==-== -=== -=--=
http://arcgraph.de/sr/

  reply	other threads:[~2011-07-09  9:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAG4TOxMjuntpd3Q5jgn+xDa2tgB9tq+jLcDquM_eAdFHXLDrWA@mail.gmail.com>
2011-07-08 23:04 ` [PATCH] block: Check that queue is alive in blk_insert_cloned_request() Roland Dreier
2011-07-09  9:05   ` Stefan Richter [this message]
2011-07-11 22:40   ` Mike Snitzer
2011-07-12  0:52     ` Alan Stern
2011-07-12  1:22       ` Mike Snitzer
2011-07-12  1:46         ` Vivek Goyal
2011-07-12 15:24           ` Alan Stern
2011-07-12 17:10             ` Vivek Goyal
2011-07-12 14:58     ` [PATCH] dm mpath: manage reference on request queue of underlying devices Mike Snitzer
2011-07-12 17:06     ` [PATCH] block: Check that queue is alive in blk_insert_cloned_request() Vivek Goyal
2011-07-12 17:41       ` James Bottomley
2011-07-12 18:02         ` Vivek Goyal
2011-07-12 18:28           ` James Bottomley
2011-07-12 18:54             ` Vivek Goyal
2011-07-12 21:02             ` Alan Stern
2011-07-12  2:09   ` Vivek Goyal

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=20110709110538.35e1ea1e@stein \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=axboe@kernel.dk \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=maier@linux.vnet.ibm.com \
    --cc=manvanth@linux.vnet.ibm.com \
    --cc=roland@kernel.org \
    --cc=sesh17@linux.vnet.ibm.com \
    --cc=stern@rowland.harvard.edu \
    --cc=tarak.reddy@in.ibm.com \
    /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