Messages in this thread Patch in this message | | | Date | Fri, 09 Nov 2007 10:35:04 -0800 | From | Zach Brown <> | 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@oracle.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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |