Skip to content

Commit 1485f72

Browse files
jankaratytso
authored andcommitted
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 <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent dae9996 commit 1485f72

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/ext4/ioctl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,10 @@ static int ext4_ioctl_setproject(struct inode *inode, __u32 projid)
732732
if (ext4_is_quota_file(inode))
733733
return err;
734734

735+
err = dquot_initialize(inode);
736+
if (err)
737+
return err;
738+
735739
err = ext4_get_inode_loc(inode, &iloc);
736740
if (err)
737741
return err;
@@ -747,10 +751,6 @@ static int ext4_ioctl_setproject(struct inode *inode, __u32 projid)
747751
brelse(iloc.bh);
748752
}
749753

750-
err = dquot_initialize(inode);
751-
if (err)
752-
return err;
753-
754754
handle = ext4_journal_start(inode, EXT4_HT_QUOTA,
755755
EXT4_QUOTA_INIT_BLOCKS(sb) +
756756
EXT4_QUOTA_DEL_BLOCKS(sb) + 3);

0 commit comments

Comments
 (0)