]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: avoid deadlock when expanding inode size
authorJan Kara <jack@suse.cz>
Thu, 11 Aug 2016 16:38:55 +0000 (12:38 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 11 Aug 2016 16:38:55 +0000 (12:38 -0400)
commitdacdb44f3f9a64c9a4c77a66bf87a22f12ea47e7
treec51fa9b5eb8a39ec51afcaf836b2a7ad597743cd
parent7478f1907cdbe31563c7265732fb41dfef1c9e33
ext4: avoid deadlock when expanding inode size

When we need to move xattrs into external xattr block, we call
ext4_xattr_block_set() from ext4_expand_extra_isize_ea(). That may end
up calling ext4_mark_inode_dirty() again which will recurse back into
the inode expansion code leading to deadlocks.

Protect from recursion using EXT4_STATE_NO_EXPAND inode flag and move
its management into ext4_expand_extra_isize_ea() since its manipulation
is safe there (due to xattr_sem) from possible races with
ext4_xattr_set_handle() which plays with it as well.

CC: stable@vger.kernel.org # 4.4.x
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/inode.c
fs/ext4/xattr.c