diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 8e6ebeca39239..a26e5ed6d61cc 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -6059,6 +6059,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);