I looked more closely at the assumption that ext4_write_begin() holds
i_mutex. This is guaranteed by Documentation/filesystems/Locking,
which notes that write_begin() and write_end() functions hold i_mutex:
PageLocked(page) i_mutex
write_begin: locks the page yes
write_end: yes, unlocks yes
So the bug is that ext4_symlink() calls __page_symlink();
__page_symlink() calls pagecache_write_begin() which calls
write_begin(), without taking i_mutex.
So we can fix this by taking i_mutex in ext4_symlink(), but I think it
would be better to take the i_mutex in __page_symlink(), since it
would then address a violation of the locking rules for all file
systems.
Al, do you agree?
- Ted