diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 38b7db452d37..5a92e5186313 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5945,6 +5945,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);