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: Thu, 26 Sep 2013 08:43:51 +1000 Message-ID: <20130925224351.GJ26872@dastard> References: <201309100811409182210@gmail.com> <2013092516084285960311@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: tj , axboe , linux-fsdevel To: majianpeng Return-path: Received: from ipmail07.adl2.internode.on.net ([150.101.137.131]:41463 "EHLO ipmail07.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753653Ab3IYWn5 (ORCPT ); Wed, 25 Sep 2013 18:43:57 -0400 Content-Disposition: inline In-Reply-To: <2013092516084285960311@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, Sep 25, 2013 at 04:08:54PM +0800, majianpeng wrote: > Hi, > How about this patch? > This bug can easily to reproduce. > dd if=/dev/zero of=/dev/sdb bs=64k > For a while, remove the disk. At my machine, it at most 100% occured. ... > > > >This bug introduced by commit ef3b101925f2170c. > >I think the situation is like: > >remove disk flush_thread_work > >bdi_destroy() > > bdi_unregister() > > bdi->dev = NULL > > bdi_writeback_workfn() 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. Cheers, Dave. -- Dave Chinner david@fromorbit.com