X-Spam-Checker-Version: SpamAssassin 3.4.0-r929098 (2010-03-30) on oss.sgi.com X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.4.0-r929098 Received: from cuda.sgi.com (cuda2.sgi.com [192.48.176.25]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with SMTP id p3BIUq7m105774 for ; Mon, 11 Apr 2011 13:30:52 -0500 X-ASG-Debug-ID: 1302546852-15f7031d0000-NocioJ X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi Received: from bombadil.infradead.org (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id 548E53C3DB5 for ; Mon, 11 Apr 2011 11:34:12 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) by cuda.sgi.com with ESMTP id ViKHpVhXZGAkBplc for ; Mon, 11 Apr 2011 11:34:12 -0700 (PDT) X-ASG-Whitelist: Client X-ASG-Whitelist: Barracuda Reputation Received: from hch by bombadil.infradead.org with local (Exim 4.72 #1 (Red Hat Linux)) id 1Q9LwC-0000nB-IA; Mon, 11 Apr 2011 18:34:12 +0000 Date: Mon, 11 Apr 2011 14:34:12 -0400 From: Christoph Hellwig To: Dave Chinner Cc: xfs@oss.sgi.com, linux-fsdevel@vger.kernel.org X-ASG-Orig-Subj: Re: [PATCH 1/2] bdi: mark the bdi flusher busy when being forked Subject: Re: [PATCH 1/2] bdi: mark the bdi flusher busy when being forked Message-ID: <20110411183412.GC32346@infradead.org> References: <1302157196-1988-1-git-send-email-david@fromorbit.com> <1302157196-1988-2-git-send-email-david@fromorbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1302157196-1988-2-git-send-email-david@fromorbit.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html X-Barracuda-Connect: bombadil.infradead.org[18.85.46.34] X-Barracuda-Start-Time: 1302546853 X-Barracuda-Virus-Scanned: by cuda.sgi.com at sgi.com X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on oss.sgi.com X-Virus-Status: Clean On Thu, Apr 07, 2011 at 04:19:55PM +1000, Dave Chinner wrote: > From: Dave Chinner > > Recetn attempts to use writeback_inode_sb_nr_if_idle() in XFs from > memory reclaim context have caused deadlocks because memory reclaim > call be called from a failed allocation during forking a flusher > thread. The shrinker then attempts to trigger writeback and the bdi > is considered idle because writeback is not in progress yet and then > deadlocks because bdi_queue_work() blocks waiting for the > BDI_Pending bit to clear which will never happen because it needs > the fork to complete. > > To avoid this deadlock, consider writeback to be in progress if the > flusher thread is being created. This prevents reclaim from blocking > waiting for it be forked and hence avoids the deadlock. Looks good, Reviewed-by: Christoph Hellwig