From mboxrd@z Thu Jan 1 00:00:00 1970 From: tj Subject: Re: [RESEND PATCH] writeback: Judge bdi->dev when set worker desc in bdi_writeback_workfn. Date: Thu, 26 Sep 2013 09:35:05 -0400 Message-ID: <20130926133505.GB2480@htj.dyndns.org> References: <201309100811409182210@gmail.com> <2013092516084285960311@gmail.com> <20130925224351.GJ26872@dastard> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: majianpeng , axboe , linux-fsdevel To: Dave Chinner Return-path: Received: from mail-qe0-f46.google.com ([209.85.128.46]:45143 "EHLO mail-qe0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750945Ab3IZNfJ (ORCPT ); Thu, 26 Sep 2013 09:35:09 -0400 Received: by mail-qe0-f46.google.com with SMTP id x7so771053qeu.5 for ; Thu, 26 Sep 2013 06:35:08 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20130925224351.GJ26872@dastard> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hey, On Thu, Sep 26, 2013 at 08:43:51AM +1000, Dave Chinner wrote: > 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. Given that it's a fix for a reliably reproducible oops, I think papering over is better than nothing as long as it's clearly labeled as such. Jianpeng, can you please make it clear both in the description and patch that this is a bandaid for now and bdi shutdown sequence needs to be fixed properly later? Thanks. -- tejun