diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 42fa3730e2d5..d7dbe1eb9da0 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5879,6 +5879,14 @@ static int __ext4_expand_extra_isize(struct inode *inode, return 0; } + /* + * We may need to allocate external xattr block so we need quotas + * initialized. Here we can be called with various locks held so we + * cannot affort to initialize quotas ourselves. So just bail. + */ + if (dquot_initialize_needed(inode)) + return -EAGAIN; + /* try to expand with EAs present */ error = ext4_expand_extra_isize_ea(inode, new_extra_isize, raw_inode, handle);