Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423142AbWJRXEv (ORCPT ); Wed, 18 Oct 2006 19:04:51 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1423144AbWJRXEv (ORCPT ); Wed, 18 Oct 2006 19:04:51 -0400 Received: from twin.jikos.cz ([213.151.79.26]:18128 "EHLO twin.jikos.cz") by vger.kernel.org with ESMTP id S1423142AbWJRXEu (ORCPT ); Wed, 18 Oct 2006 19:04:50 -0400 Date: Thu, 19 Oct 2006 01:04:42 +0200 (CEST) From: Jiri Kosina To: Andrew Morton cc: Gabriel C , linux-kernel@vger.kernel.org Subject: Re: 2.6.19-rc2-mm1 In-Reply-To: Message-ID: References: <20061016230645.fed53c5b.akpm@osdl.org> <453675A6.9080001@googlemail.com> <20061018152947.bb404481.akpm@osdl.org> <20061018154636.2317059a.akpm@osdl.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1746 Lines: 51 On Thu, 19 Oct 2006, Jiri Kosina wrote: > void i_size_write(struct inode *inode, loff_t i_size) > { > - WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); > + /* calling us without i_mutex is OK when not connected to dentry yet */ > + if (list_empty(&inode->i_dentry)) > + WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); > #if BITS_PER_LONG==32 && defined(CONFIG_SMP) > write_seqcount_begin(&inode->i_size_seqcount); > inode->i_size = i_size; > diff --git a/fs/namei.c b/fs/namei.c This if of course bogus, the one below should be better, sorry [PATCH] Fix spurious warning in i_size_write i_size_write() can be legitimately called without inode->i_mutex locked. This is OK in cases when the inode has not been yet linked into the parent dentry, so no race condition on i_size can occur. Signed-off-by: Jiri Kosina --- fs/inode.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index bb88835..11d8794 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1386,7 +1386,9 @@ void __init inode_init(unsigned long mem void i_size_write(struct inode *inode, loff_t i_size) { - WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); + /* calling us without i_mutex is OK when not connected to dentry yet */ + if (!list_empty(&inode->i_dentry)) + WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); #if BITS_PER_LONG==32 && defined(CONFIG_SMP) write_seqcount_begin(&inode->i_size_seqcount); inode->i_size = i_size; -- Jiri Kosina - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/