Skip to content

Commit 8994d11

Browse files
jankaratytso
authored andcommitted
ext4: avoid unaccounted block allocation when expanding inode
When expanding inode space in ext4_expand_extra_isize_ea() we may need to allocate external xattr block. If quota is not initialized for the inode, the block allocation will not be accounted into quota usage. Make sure the quota is initialized before we try to expand inode space. Reported-by: Pengfei Xu <[email protected]> Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Jan Kara <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 1485f72 commit 8994d11

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fs/ext4/inode.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5945,6 +5945,14 @@ static int __ext4_expand_extra_isize(struct inode *inode,
59455945
return 0;
59465946
}
59475947

5948+
/*
5949+
* We may need to allocate external xattr block so we need quotas
5950+
* initialized. Here we can be called with various locks held so we
5951+
* cannot affort to initialize quotas ourselves. So just bail.
5952+
*/
5953+
if (dquot_initialize_needed(inode))
5954+
return -EAGAIN;
5955+
59485956
/* try to expand with EAs present */
59495957
error = ext4_expand_extra_isize_ea(inode, new_extra_isize,
59505958
raw_inode, handle);

0 commit comments

Comments
 (0)