mirror of
https://github.com/torvalds/linux.git
synced 2024-11-13 23:51:39 +00:00
ext4: initialize quota before expanding inode in setproject ioctl
Make sure we initialize quotas before possibly expanding inode space (and thus maybe needing to allocate external xattr block) in ext4_ioctl_setproject(). This prevents not accounting the necessary block allocation. Signed-off-by: Jan Kara <jack@suse.cz> Cc: stable@kernel.org Link: https://lore.kernel.org/r/20221207115937.26601-1-jack@suse.cz Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
dae999602e
commit
1485f726c6
@ -732,6 +732,10 @@ static int ext4_ioctl_setproject(struct inode *inode, __u32 projid)
|
|||||||
if (ext4_is_quota_file(inode))
|
if (ext4_is_quota_file(inode))
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
err = dquot_initialize(inode);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
err = ext4_get_inode_loc(inode, &iloc);
|
err = ext4_get_inode_loc(inode, &iloc);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
@ -747,10 +751,6 @@ static int ext4_ioctl_setproject(struct inode *inode, __u32 projid)
|
|||||||
brelse(iloc.bh);
|
brelse(iloc.bh);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = dquot_initialize(inode);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
handle = ext4_journal_start(inode, EXT4_HT_QUOTA,
|
handle = ext4_journal_start(inode, EXT4_HT_QUOTA,
|
||||||
EXT4_QUOTA_INIT_BLOCKS(sb) +
|
EXT4_QUOTA_INIT_BLOCKS(sb) +
|
||||||
EXT4_QUOTA_DEL_BLOCKS(sb) + 3);
|
EXT4_QUOTA_DEL_BLOCKS(sb) + 3);
|
||||||
|
Loading…
Reference in New Issue
Block a user