Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ext4: only check dquot_initialize_needed() when debugging

ext4_xattr_block_set() relies on its caller to call dquot_initialize()
on the inode. To assure that this has happened there are WARN_ON
checks. Unfortunately, this is subject to false positives if there is
an antagonist thread which is flipping the file system at high rates
between r/o and rw. So only do the check if EXT4_XATTR_DEBUG is
enabled.

Link: https://lore.kernel.org/r/20230608044056.GA1418535@mit.edu
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

+4 -2
+4 -2
fs/ext4/xattr.c
··· 2056 2056 else { 2057 2057 u32 ref; 2058 2058 2059 + #ifdef EXT4_XATTR_DEBUG 2059 2060 WARN_ON_ONCE(dquot_initialize_needed(inode)); 2060 - 2061 + #endif 2061 2062 /* The old block is released after updating 2062 2063 the inode. */ 2063 2064 error = dquot_alloc_block(inode, ··· 2121 2120 /* We need to allocate a new block */ 2122 2121 ext4_fsblk_t goal, block; 2123 2122 2123 + #ifdef EXT4_XATTR_DEBUG 2124 2124 WARN_ON_ONCE(dquot_initialize_needed(inode)); 2125 - 2125 + #endif 2126 2126 goal = ext4_group_first_block_no(sb, 2127 2127 EXT4_I(inode)->i_block_group); 2128 2128 block = ext4_new_meta_blocks(handle, inode, goal, 0,