From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Chinner Subject: Re: [RESEND PATCH] writeback: Judge bdi->dev when set worker desc in bdi_writeback_workfn. Date: Fri, 27 Sep 2013 08:59:09 +1000 Message-ID: <20130926225909.GU26872@dastard> References: <201309100811409182210@gmail.com> <2013092516084285960311@gmail.com> <20130925224351.GJ26872@dastard> <20130926174702.GA12274@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: majianpeng , tj , axboe , linux-fsdevel To: Christoph Hellwig Return-path: Received: from ipmail07.adl2.internode.on.net ([150.101.137.131]:41340 "EHLO ipmail07.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754436Ab3IZW7Q (ORCPT ); Thu, 26 Sep 2013 18:59:16 -0400 Content-Disposition: inline In-Reply-To: <20130926174702.GA12274@infradead.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Sep 26, 2013 at 10:47:02AM -0700, Christoph Hellwig wrote: > On Thu, Sep 26, 2013 at 08:43:51AM +1000, Dave Chinner wrote: > > You're just papering over the larger problem, in that the writeback > > work is running concurrently with the bdi_unregister() function that > > is tearing the bdi down. You should try to fix the underlying race > > condition, as documented in bdi_destroy. > > The problem is even worse than that, and it's the lack of a proper > refcounting on the bdi as seen by gems like bdi_prune_sb and the moving > of writeback requests in bdi_destroy. The right fix is to dynamically > allocate the bdi (or at least the bdi_writeback), and make sure that we > keep it around as long as a filesystem and thus the writeback code > refers to. Then a block device going away can just set a flag to stop > writeback from trying instead of having the bdi ripped out underneath > it which is guaranteed to fail and historically has failed in a large > number of misterious ways. Yup, be nice to see this rat-hole cleaned up properly, especially those silly "pull disk, unplug-runs-sync_fs, fs hangs trying to do IO to the disk that just got unplugged" bugs we get reported every so often. Cheers, Dave. -- Dave Chinner david@fromorbit.com