Re: 2.6.19-rc2-mm1

From: Jiri Kosina
Date: Wed Oct 18 2006 - 18:58:09 EST


On Wed, 18 Oct 2006, Andrew Morton wrote:

> I simply dropped the debugging patch. Which is pretty sad, because it
> _is_ a really nasty and subtle-to-show bug. So I'd be OK with adding
> sufficient patches to -mm to make the false positives go away so we can
> re-add the check.

What about this one?

[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 <jikos@xxxxxxxx>

---

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;
diff --git a/fs/namei.c b/fs/namei.c

--
Jiri Kosina
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/