-mm: mm-only-i_size_write-debugging.patch
I think that the warning introduced by the patch mm-only-i_size_write-debugging.patch is incorrect in the case I ran into:
[in fs/inode.c]
+void i_size_write(struct inode *inode, loff_t i_size)
+{
+ WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex));
I can reprocude triggering this warning by copying files to a read+write mounted ext2 filesystem (without -o xip).
The stack chain looks like this:
BUG: warning at fs/inode.c:1389/i_size_write() Call Trace: ([<0000000000103502>] show_trace+0x166/0x16c) [<00000000001035ce>] show_stack+0xc6/0xf8 [<000000000010362e>] dump_stack+0x2e/0x3c [<00000000001b6484>] i_size_write+0x78/0x84 [<00000000001ca5ce>] generic_commit_write+0x62/0x84 [<00000000002296ec>] ext2_commit_chunk+0x64/0xbc [<0000000000229b70>] ext2_make_empty+0x1e8/0x21c [<000000000022eeb2>] ext2_mkdir+0xea/0x19c [<00000000001a66d8>] vfs_mkdir+0x10c/0x1c4 [<00000000001aa3ac>] sys_mkdirat+0xc8/0x120 [<00000000001aa436>] sys_mkdir+0x32/0x40 [<000000000010dc18>] sysc_tracego+0xe/0x14 [<000002000012a3fa>] 0x2000012a3fa
I believe ext2 is save to write without i_mutex here: The inode is newly created by ext2_new_inode, and is not accessible to other contexts at this time. On the other hand, ext2_mkdir could grab the i_mutex of the newly created inode.
Any advice would be helpful.