Re: Lockdep problem involving sysfs_mutex in ext4 in linux-next

From: Theodore Tso
Date: Fri Mar 20 2009 - 18:45:23 EST


On Fri, Mar 20, 2009 at 06:25:22PM -0400, Theodore Tso wrote:
> So if I'm reading this right, the problem is happening because
> someplace in the kernel, fs/sysfs code is grabbing mmap_sem while it
> is holding sysfs_mutex, right? But I can't see where that might be
> happening...

Never mind, I see it. sysfs_readdir() calls filldir() while holding
sysfs_mutex, and filldir() in turn calls copy_to_user(), which can
grab mmap_sem.

The problem is that in other code paths, mmap_sem() is grabbed while
we grab inode->i_alloc_sem() (in ext4_page_mkwrite), and that in turns
has a dependency on jbd2_handle, which has a dependency on s_lock, and
hence lock_super(). Ugh. What a mess.

- Ted
--
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/