From patchwork Fri Oct 5 13:53:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Monakhov X-Patchwork-Id: 189482 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 5535F2C0086 for ; Fri, 5 Oct 2012 23:53:42 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752782Ab2JENxk (ORCPT ); Fri, 5 Oct 2012 09:53:40 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:52887 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752721Ab2JENxk (ORCPT ); Fri, 5 Oct 2012 09:53:40 -0400 Received: by mail-lb0-f174.google.com with SMTP id n3so1368041lbo.19 for ; Fri, 05 Oct 2012 06:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=LZ/2pZ0yeEDtrZCVtO/2eqhCGOHCAPMRlwKYTMfWBlg=; b=ahq1Ox+sON0uYY/3D4tOVJkjaQJFHIfH7pam+UGXk7aqP1kbGhzSV0S+/Txl5PGo5a 0FLkcUpUkwNicH4Br5GiEzn0Ykn0TcIpnGa3cKhLyIEO24PJxdxYJ+hUnKnZmdwr1mwm 3kb0B1c93jr9lTDYvmUF2bIiOiBCC7Gb/S/d+YqWF6BQjqol688BetesJLBSjIOmK4fQ LQkZghweD/MPmjzIqLDf0GBLEZm+FVNPdbbT4aIGtMTd5TA5OlC2UvwNIJIgFxKRt2S1 ue3uYV8D/Nav2QQ7oEHuKg1w497ebBEOqQ2HfdE3eDTvK/0M+aWH8z9yZaU0vwiHCsF6 w50g== Received: by 10.112.99.106 with SMTP id ep10mr4009322lbb.49.1349445218701; Fri, 05 Oct 2012 06:53:38 -0700 (PDT) Received: from smtp.gmail.com (swsoft-msk-nat.sw.ru. [195.214.232.10]) by mx.google.com with ESMTPS id gd18sm3146816lab.1.2012.10.05.06.53.37 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 05 Oct 2012 06:53:37 -0700 (PDT) From: Dmitry Monakhov To: Theodore Ts'o Cc: linux-ext4@vger.kernel.org, jack@suse.cz Subject: Re: [PATCH] ext4: fix ext4_flush_completed_IO wait semantics In-Reply-To: <20121005132853.GC21358@thunk.org> References: <1349289807-18811-1-git-send-email-dmonakhov@openvz.org> <20121005124027.GA21358@thunk.org> <87a9w1ax91.fsf@openvz.org> <20121005132853.GC21358@thunk.org> User-Agent: Notmuch/0.6.1 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-redhat-linux-gnu) Date: Fri, 05 Oct 2012 17:53:36 +0400 Message-ID: <877gr5auu7.fsf@openvz.org> MIME-Version: 1.0 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, 5 Oct 2012 09:28:53 -0400, Theodore Ts'o wrote: > On Fri, Oct 05, 2012 at 05:01:30PM +0400, Dmitry Monakhov wrote: > > > This WARN_ON is triggering on the truncate path... > > Yeap, this is false positive one. We skip i_mutex on ext4_evict_inode > > This is strange xfsstress 269'th should caught that for me. > > I'll try to prepare workaround ASAP. > > This is the patch which I'm currently testing. If it passes I'll fold > it into your patch. Anyone see any problems with it? > > - Ted > > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c > index f18e786..cd171dd 100644 > --- a/fs/ext4/inode.c > +++ b/fs/ext4/inode.c > @@ -238,8 +238,10 @@ void ext4_evict_inode(struct inode *inode) > * protection against it > */ > sb_start_intwrite(inode->i_sb); > + mutex_lock(&inode->i_mutex); > handle = ext4_journal_start(inode, ext4_blocks_for_truncate(inode)+3); > if (IS_ERR(handle)) { > + mutex_unlock(&inode->i_mutex); I mutex is not needed for journal start. > ext4_std_error(inode->i_sb, PTR_ERR(handle)); > /* > * If we're going to skip the normal cleanup, we still need to > @@ -256,12 +258,14 @@ void ext4_evict_inode(struct inode *inode) > inode->i_size = 0; > err = ext4_mark_inode_dirty(handle, inode); > if (err) { > + mutex_unlock(&inode->i_mutex); > ext4_warning(inode->i_sb, > "couldn't mark inode dirty (err %d)", err); > goto stop_handle; > } > if (inode->i_blocks) > ext4_truncate(inode); > + mutex_unlock(&inode->i_mutex); Jiaying Zhang removed i_mutex from ext4_evict_inode here 8c0bec2151 because of false positive lockdep complains. Let's just learn warning about evict_inode From edcd1dd6d8c4c17af09d429cc89e370bdc1e737a Mon Sep 17 00:00:00 2001 From: Dmitry Monakhov Date: Fri, 5 Oct 2012 17:40:19 +0400 Subject: [PATCH] ext4: fix false positive warning ext4_evict_inode Signed-off-by: Dmitry Monakhov --- fs/ext4/page-io.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 1f5df21..68e896e 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c @@ -229,7 +229,8 @@ static void ext4_end_io_work(struct work_struct *work) int ext4_flush_unwritten_io(struct inode *inode) { int ret; - WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); + WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex) && + !(inode->i_state & I_FREEING)); ret = ext4_do_flush_completed_IO(inode, NULL); ext4_unwritten_wait(inode); return ret; -- 1.7.7.6