]> www.infradead.org Git - users/jedix/linux-maple.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)
committerBrian Maly <brian.maly@oracle.com>
Tue, 21 Aug 2018 19:06:15 +0000 (15:06 -0400)
commitbd9f11d3fc5cd8ef566ae9a33eb5e99898b5962f
tree944a3c49e9789ff7089f5653f4dcc78c9bf58030
parentbd470eb52f337263018c7f08ecc3cbcd4bf72160
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>
(cherry picked from commit 2e81a4eeedcaa66e35f58b81e0755b87057ce392)

Orabug: 25718971

Signed-off-by: Shuning Zhang <sunny.s.zhang@oracle.com>
Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
fs/ext4/inode.c
fs/ext4/xattr.c