From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [Jfs-discussion] Kernel oops when accessing to mounted, but unplugged JFS Date: Tue, 23 Nov 2010 09:37:53 +0100 Message-ID: <20101123083753.GA4808@lst.de> References: <20101121122008.GE4024__36829.3162588545$1290342860$gmane$org@localhost> <87lj4mv9u1.fsf@basil.nowhere.org> <1290442943.5315.7.camel@shaggy-w500> <20101122212044.GA2436@localhost> <1290483673.3739.5.camel@shaggy-w500> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Alexander Kolesen , jfs-discussion@lists.sourceforge.net, Jens Axboe , rjw@sisk.pl, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, Christoph Hellwig To: Dave Kleikamp Return-path: Received: from verein.lst.de ([213.95.11.210]:43850 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750794Ab0KWIiY (ORCPT ); Tue, 23 Nov 2010 03:38:24 -0500 Content-Disposition: inline In-Reply-To: <1290483673.3739.5.camel@shaggy-w500> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Nov 22, 2010 at 09:41:13PM -0600, Dave Kleikamp wrote: > I see three potential ways to fix this. > > 1. bdi_prune_sb() could set sb->s_bdi to &default_backing_dev_info > rather than NULL > 2. inode_to_bdi() could return &default_backing_dev_info (or > inode->i_mapping->backing_dev_info) if sb->s_bdi is NULL. > 3. the callers of inode_to_bdi() could check for s_bdi being NULL and > exit gracefully. > > It seems that Jens and Christoph have ideas about cleaning up the bdi > stuff, so this may be a short-term fix. It's a mess. The correct fix is to never unregister a bdi that still has a life filesystem on it. This seems to be solved by plain removing the unlink_gendisk call in unlink_gendisk. Unlink_gendisk just removes the gendisk from visibility, but it still lives on as long as we have references to it. We already have a bdi_destroy call in blk_release_queue that should unregister the BDI once it's reference count finally reaches zero.