From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Bottomley Subject: Re: [PATCH] SCSI IOCTL: Check for device deletion [was Re: __elv_add_request OOPS] Date: Wed, 25 May 2011 15:20:18 -0500 Message-ID: <1306354818.1641.55.camel@mulgrave.site> References: <4DDB8BF6.2000304@fusionio.com> <4DDCB1C8.7040708@fusionio.com> <4DDD5240.2060308@fusionio.com> <4DDD55D6.1080909@fusionio.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Linus Torvalds Cc: Parag Warudkar , Jens Axboe , "linux-kernel@vger.kernel.org" , "akpm@linux-foundation.org" , Linux SCSI List List-Id: linux-scsi@vger.kernel.org On Wed, 2011-05-25 at 13:03 -0700, Linus Torvalds wrote: > On Wed, May 25, 2011 at 12:52 PM, Parag Warudkar wrote: > > > > +static inline int sdev_early_check(struct scsi_device *sdev) > > +{ > > + if (!sdev || sdev->sdev_state == SDEV_DEL > > + || sdev->sdev_state > SDEV_QUIESCE) > > + return -ENXIO; > > + return 0; > > +} > > Can somebody explain why it's those states, and nothing else? The states are definitely wrong. QUIESCE shouldn't cause an error. Can we back up a bit. I agree with Jens that sdev->request_queue looks to be NULL, but that *only* happens in the final sdev release, so this must be a refcounting problem higher up the stack. Something is holding an unrefcounted pointer to the sdev. James