This is a note to let you know that I've just added the patch titled ext4: initialize quota before expanding inode in setproject ioctl to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ext4-initialize-quota-before-expanding-inode-in-setproject-ioctl.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 1485f726c6dec1a1f85438f2962feaa3d585526f Mon Sep 17 00:00:00 2001 From: Jan Kara <jack@xxxxxxx> Date: Wed, 7 Dec 2022 12:59:27 +0100 Subject: ext4: initialize quota before expanding inode in setproject ioctl From: Jan Kara <jack@xxxxxxx> commit 1485f726c6dec1a1f85438f2962feaa3d585526f upstream. 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@xxxxxxx> Cc: stable@xxxxxxxxxx Link: https://lore.kernel.org/r/20221207115937.26601-1-jack@xxxxxxx Signed-off-by: Theodore Ts'o <tytso@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/ext4/ioctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -449,6 +449,10 @@ static int ext4_ioctl_setproject(struct if (ext4_is_quota_file(inode)) return err; + err = dquot_initialize(inode); + if (err) + return err; + err = ext4_get_inode_loc(inode, &iloc); if (err) return err; @@ -464,10 +468,6 @@ static int ext4_ioctl_setproject(struct brelse(iloc.bh); } - err = dquot_initialize(inode); - if (err) - return err; - handle = ext4_journal_start(inode, EXT4_HT_QUOTA, EXT4_QUOTA_INIT_BLOCKS(sb) + EXT4_QUOTA_DEL_BLOCKS(sb) + 3); Patches currently in stable-queue which might be from jack@xxxxxxx are queue-4.19/udf-avoid-double-brelse-in-udf_rename.patch queue-4.19/ext4-avoid-unaccounted-block-allocation-when-expanding-inode.patch queue-4.19/udf-do-not-bother-looking-for-prealloc-extents-if-i_lenextents-matches-i_size.patch queue-4.19/ext4-fix-bug_on-in-__es_tree_search-caused-by-bad-boot-loader-inode.patch queue-4.19/block-unhash-blkdev-part-inode-when-the-part-is-deleted.patch queue-4.19/ext4-fix-inode-leak-in-ext4_xattr_inode_create-on-an-error-path.patch queue-4.19/ext4-add-helper-to-check-quota-inums.patch queue-4.19/udf-fix-extending-file-within-last-block.patch queue-4.19/ext4-fix-corruption-when-online-resizing-a-1k-bigalloc-fs.patch queue-4.19/ext4-allocate-extended-attribute-value-in-vmalloc-area.patch queue-4.19/ext4-init-quota-for-old.inode-in-ext4_rename.patch queue-4.19/udf-fix-preallocation-discarding-at-indirect-extent-boundary.patch queue-4.19/ext4-avoid-bug_on-when-creating-xattrs.patch queue-4.19/udf-discard-preallocation-before-extending-file-with-a-hole.patch queue-4.19/ext4-initialize-quota-before-expanding-inode-in-setproject-ioctl.patch