From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758889Ab2IEPyX (ORCPT ); Wed, 5 Sep 2012 11:54:23 -0400 Received: from twin.jikos.cz ([89.185.236.188]:56293 "EHLO twin.jikos.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753801Ab2IEPyV (ORCPT ); Wed, 5 Sep 2012 11:54:21 -0400 Date: Wed, 5 Sep 2012 17:54:04 +0200 From: David Sterba To: Miao Xie Cc: Linux Kernel , Linux Btrfs , Linux Fsdevel , Linux Ext4 , viro , Christoph Hellwig , Kamal Mostafa Subject: Re: [PATCH 1/2 RESEND] vfs: re-implement writeback_inodes_sb(_nr)_if_idle() and rename them Message-ID: <20120905155403.GL17430@twin.jikos.cz> Reply-To: dave@jikos.cz Mail-Followup-To: Miao Xie , Linux Kernel , Linux Btrfs , Linux Fsdevel , Linux Ext4 , viro , Christoph Hellwig , Kamal Mostafa References: <503DB3E8.1000308@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <503DB3E8.1000308@cn.fujitsu.com> User-Agent: Mutt/1.5.21 (2011-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 29, 2012 at 02:17:12PM +0800, Miao Xie wrote: > writeback_inodes_sb(_nr)_if_idle() is re-implemented by replacing down_read() > with down_read_trylock() because > - If ->s_umount is write locked, then the sb is not idle. That is > writeback_inodes_sb(_nr)_if_idle() needn't wait for the lock. > - writeback_inodes_sb(_nr)_if_idle() grabs s_umount lock when it want to start > writeback, it may bring us deadlock problem when doing umount. > (Ex. Btrfs has such a problem, see the following URL > http://marc.info/?l=linux-btrfs&m=133540923510561&w=2) > > The name of these two functions is cumbersome, so rename them to > try_to_writeback_inodes_sb(_nr). > > This idea came from Christoph Hellwig. > Some code is from the patch of Kamal Mostafa. > > Signed-off-by: Miao Xie Tested-by: David Sterba > --- > Many users who use btrfs met the deadlock problem caused by writeback_inodes_sb(_nr)_if_idle(), > so I send this patch again and hope it will be received as soon as possible if nobody objects. Yes please, this makes testing of the 'autodefrag' mount option hard as the deadlock occurs frequently upon umount (when there's a background snapshot cleanup in progress). >>From the user's POV, the autodefrag improves performance, it's not yet on by default until it proves to be stable, the deadlocks were standing in the way for long. thanks, david