Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S271161AbTHCKFG (ORCPT ); Sun, 3 Aug 2003 06:05:06 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S271163AbTHCKFG (ORCPT ); Sun, 3 Aug 2003 06:05:06 -0400 Received: from ns.virtualhost.dk ([195.184.98.160]:22684 "EHLO virtualhost.dk") by vger.kernel.org with ESMTP id S271161AbTHCKFC (ORCPT ); Sun, 3 Aug 2003 06:05:02 -0400 Date: Sun, 3 Aug 2003 12:04:47 +0200 From: Jens Axboe To: Benjamin Herrenschmidt Cc: Alan Cox , Bartlomiej Zolnierkiewicz , linux-kernel mailing list Subject: Re: IDE locking problem Message-ID: <20030803100447.GO7920@suse.de> References: <1059900149.3524.84.camel@gaston> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1059900149.3524.84.camel@gaston> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1392 Lines: 33 On Sun, Aug 03 2003, Benjamin Herrenschmidt wrote: > Hi Alan & Bart ! > > While fixing my hotswap media-bay IDE controller for 2.6, I found > a locking problem with IDE (again ? :) in ide_unregister_hw. Basically > the problem is that it calls blk_cleanup_queue(), which is unsafe to > call with a lock held (it will call flush_workqueue() at one point). > Other side effect, flush_workqueue() will re-enable IRQs, thus allowing > us to get an IRQ while holding the spinlock -> double lock, but that's > just a side effect of calling flush_workqueue in that context. Irk someone made blk_cleanup_queue() non-atomic. I blame Andrew. And now it looks like it's impossible to make it atomic again :/. Not very nice, imo it's preferable to keep such unregister functions atomic. > So the call to blk_cleanup_queue() shall be moved outside of the > spinlock. I don't know much about the BIO details, is it possible > to first unregister_blkdev, then only call blk_cleanup_queue() ? That That should work, yes. > would help making sure we don't get a request sneaking in ? Hmm not really, there's still a chance that could happen. -- Jens Axboe - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/