[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4734A858.2010307@oracle.com>
Date: Fri, 09 Nov 2007 10:35:04 -0800
From: Zach Brown <zach.brown@...cle.com>
To: Chris Mason <chris.mason@...cle.com>
CC: Trond Myklebust <trond.myklebust@....uio.no>,
Peter Zijlstra <peterz@...radead.org>,
Jens Axboe <jens.axboe@...cle.com>,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
linux-aio@...ck.org
Subject: Re: dio_get_page() lockdep complaints
> Without getting into a huge patch, the best fix would just be switching
> to try lock. If the tail doesn't get packed, the world doesn't end.
So, something like this?
---
reiserfs: trylock i_mutex in file release when packing
The mmap_sem is nested under the i_mutex. reiserfs_file_release() wants
to acquire the i_mutex to pack the file but it can be called with the mmap_sem
held by munmap. This has produced lockdep warnings in testing.
http://lkml.org/lkml/2007/4/19/73
This acquires the i_mutex in reiserfs_file_release() with a trylock. If the
i_mutex is already held it simply won't pack. There are already a host of
conditions under which it won't pack.
Totally untested, but built.
Signed-off-by: Zach Brown <zach.brown@...cle.com>
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index a804903..40085f1 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -46,7 +46,13 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
return 0;
}
- mutex_lock(&inode->i_mutex);
+ /*
+ * We can be called from munmap while holding mmap_sem, but mmap_sem
+ * is nested inside i_mutex. If we can't get i_mutex then we just
+ * don't pack.
+ */
+ if (mutex_trylock(&inode->i_mutex) == 0)
+ return 0;
mutex_lock(&(REISERFS_I(inode)->i_mmap));
if (REISERFS_I(inode)->i_flags & i_ever_mapped)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists