• Jan Kara's avatar
    ext4: avoid deadlock when expanding inode size · b329791b
    Jan Kara authored
    commit 2e81a4ee upstream.
    
    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.
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
    [bwh: Backported to 3.16: adjust context[
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    b329791b
xattr.c 46.4 KB