Skip to content

Commit 35a1f12

Browse files
jankaratytso
authored andcommitted
ext4: avoid excessive credit estimate in ext4_tmpfile()
A user with minimum journal size (1024 blocks these days) complained about the following error triggered by generic/697 test in ext4_tmpfile(): run fstests generic/697 at 2024-02-28 05:34:46 JBD2: vfstest wants too many credits credits:260 rsv_credits:0 max:256 EXT4-fs error (device loop0) in __ext4_new_inode:1083: error 28 Indeed the credit estimate in ext4_tmpfile() is huge. EXT4_MAXQUOTAS_INIT_BLOCKS() is 219, then 10 credits from ext4_tmpfile() itself and then ext4_xattr_credits_for_new_inode() adds more credits needed for security attributes and ACLs. Now the EXT4_MAXQUOTAS_INIT_BLOCKS() is in fact unnecessary because we've already initialized quotas with dquot_init() shortly before and so EXT4_MAXQUOTAS_TRANS_BLOCKS() is enough (which boils down to 3 credits). Fixes: af51a2a ("ext4: ->tmpfile() support") Signed-off-by: Jan Kara <jack@suse.cz> Tested-by: Luis Henriques <lhenriques@suse.de> Tested-by: Disha Goel <disgoel@linux.ibm.com> Link: https://lore.kernel.org/r/20240307115320.28949-1-jack@suse.cz Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent ea7d09a commit 35a1f12

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/ext4/namei.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2897,7 +2897,7 @@ static int ext4_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
28972897
inode = ext4_new_inode_start_handle(idmap, dir, mode,
28982898
NULL, 0, NULL,
28992899
EXT4_HT_DIR,
2900-
EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb) +
2900+
EXT4_MAXQUOTAS_TRANS_BLOCKS(dir->i_sb) +
29012901
4 + EXT4_XATTR_TRANS_BLOCKS);
29022902
handle = ext4_journal_current_handle();
29032903
err = PTR_ERR(inode);

0 commit comments

Comments
 (0)