From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Chinner Subject: Re: [RFC PATCH 2/2] Btrfs: fix deadlock on umount by umount_prepare interface Date: Thu, 22 Mar 2012 15:39:36 +1100 Message-ID: <20120322043936.GD3592@dastard> References: <4F6A98CD.5090701@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Chris Mason , viro , Linux Btrfs , Linux Fsdevel To: Miao Xie Return-path: Received: from ipmail06.adl2.internode.on.net ([150.101.137.129]:29212 "EHLO ipmail06.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751738Ab2CVEjk (ORCPT ); Thu, 22 Mar 2012 00:39:40 -0400 Content-Disposition: inline In-Reply-To: <4F6A98CD.5090701@cn.fujitsu.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Mar 22, 2012 at 11:13:17AM +0800, Miao Xie wrote: > The reason the deadlock is that: > Task Btrfs-cleaner > umount() > down_write(&s->s_umount) > close_ctree() > wait for the end of > btrfs-cleaner > start_transaction > reserve space > shrink_delalloc() > writeback_inodes_sb_nr_if_idle() > down_read(&sb->s_umount) > So, the deadlock has happened. Every time a deadlock involving writeback_inodes_sb...if_idle() comes up, I give the same response. If the s_umount is write locked, then the sb is not idle. IOWs, writeback_inodes_sb...if_idle() should be doing down_read_trylock(), not down_read(). Cheers, Dave. -- Dave Chinner david@fromorbit.com