public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Roland Dreier <roland@kernel.org>
Cc: James Bottomley <James.Bottomley@hansenpartnership.com>,
	Jens Axboe <jaxboe@fusionio.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>,
	Alan Stern <stern@rowland.harvard.edu>,
	dm-devel@redhat.com, Alasdair G Kergon <agk@redhat.com>
Subject: Re: [BUG] 2.6.39.1 crash in scsi_dispatch_cmd()
Date: Wed, 6 Jul 2011 11:25:00 +0200	[thread overview]
Message-ID: <20110706092459.GC2580@osiris.boeblingen.de.ibm.com> (raw)
In-Reply-To: <CAL1RGDXFER5v08=Wy4Pv7CX0s1RqAThJmEy_0rpDfFCP9xjTJA@mail.gmail.com>

On Wed, Jul 06, 2011 at 01:06:44AM -0700, Roland Dreier wrote:
>  > > I booted with slub_debug=FZUP and the 6b pattern in RAX pretty much
>  > > does prove that this is a use-after-free issue.  Any thoughts about
>  > > how to pin this down before I muddle on in my lowbrow way?
>  >
>  > Alan Stern came up with a patch that could fix this:
>  >
>  > http://marc.info/?l=linux-kernel&m=130963676907731&w=2
> 
> Thanks!  It seems my crash is actually a different problem (or perhaps
> the same problem in different code), since I'm not going through SCSI
> directly but rather a dm-multipath device on top of SCSI disks.  But
> it does seem that it is another case of the block queue elevator
> getting freed while requests can still be submitted.
> 
> In my case, to reproduce this I have to hold the multipath device file
> open with something like "cat > /dev/dm-X" and then kill the
> underlying drive.  What I think is happening (although I haven't
> traced all the layers to be sure) is that then the multipath daemon
> notices that all the paths to the disk are lost and tries to kill the
> multipath device, which ends up in dm.c:dm_destroy().
> 
> This ends up in blk_cleanup_queue() which frees q->elevator, which of
> course leads to the crash.

So it's the identical crash that I reported also (well, at least one of
the crashes I reported).

> What's not clear to me is how things are supposed to work.  It seems
> that the dm stuff at least is missing a lot of required reference
> counting, to make sure that some structure sticks around to reject IOs
> to the device after it is destroy but while it is still open.  But I
> don't understand why people don't hit this more since it is completely
> reproducible for me with a fairly normal setup (hot-remove a multipath
> device that some process has open).

cc'ing Alasdair as well, maybe he knows...

> Alan Stern's patch looks a bit fishy -- the scsi_free_queue() is moved
> earlier than the
> 
> 	/* cause the request function to reject all I/O requests */
> 	sdev->request_queue->queuedata = NULL;
> 
> which seems to leave a small window where the use-after-free can
> happen, and it's not clear to me why the scsi_free_queue() has to move
> at all.
> 
> Thanks,
>  - R.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15 11:20 [BUG] 2.6.39.1 crash in scsi_dispatch_cmd() Heiko Carstens
2011-06-16 16:01 ` Heiko Carstens
2011-06-16 16:37   ` James Bottomley
2011-06-16 18:40     ` Heiko Carstens
2011-06-20 15:30       ` Heiko Carstens
2011-07-01 18:07         ` Roland Dreier
2011-07-01 19:04           ` James Bottomley
2011-07-06  0:34             ` Roland Dreier
2011-07-06  6:47               ` Heiko Carstens
2011-07-06  8:06                 ` Roland Dreier
2011-07-06  9:25                   ` Heiko Carstens [this message]
2011-07-06 14:20                   ` Alan Stern
2011-07-06 14:24                     ` James Bottomley
2011-07-06 16:30                       ` Roland Dreier
2011-07-06 16:53                         ` Alan Stern
2011-07-06 18:07                           ` Roland Dreier
2011-07-06 18:49                             ` Alan Stern
2011-07-07 20:45                               ` James Bottomley
2011-07-07 21:07                                 ` Alan Stern
2011-07-08 17:04                                   ` James Bottomley
2011-07-08 19:43                                     ` Alan Stern
2011-07-08 20:41                                       ` James Bottomley
2011-07-08 22:08                                         ` Alan Stern
2011-07-08 22:25                                           ` James Bottomley
2011-07-08 20:47                                     ` Roland Dreier
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
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
2011-07-06 16:24                     ` [BUG] 2.6.39.1 crash in scsi_dispatch_cmd() Roland Dreier

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=20110706092459.GC2580@osiris.boeblingen.de.ibm.com \
    --to=heiko.carstens@de.ibm.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=jaxboe@fusionio.com \
    --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