Skip to content

Commit dea9d8f

Browse files
committed
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/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 1b29243 commit dea9d8f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/ext4/xattr.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,8 +2056,9 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
20562056
else {
20572057
u32 ref;
20582058

2059+
#ifdef EXT4_XATTR_DEBUG
20592060
WARN_ON_ONCE(dquot_initialize_needed(inode));
2060-
2061+
#endif
20612062
/* The old block is released after updating
20622063
the inode. */
20632064
error = dquot_alloc_block(inode,
@@ -2120,8 +2121,9 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
21202121
/* We need to allocate a new block */
21212122
ext4_fsblk_t goal, block;
21222123

2124+
#ifdef EXT4_XATTR_DEBUG
21232125
WARN_ON_ONCE(dquot_initialize_needed(inode));
2124-
2126+
#endif
21252127
goal = ext4_group_first_block_no(sb,
21262128
EXT4_I(inode)->i_block_group);
21272129
block = ext4_new_meta_blocks(handle, inode, goal, 0,

0 commit comments

Comments
 (0)