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

Configure Feed

Select the types of activity you want to include in your feed.

ext4: avoid BUG_ON when creating xattrs

Commit fb0a387dcdcd ("ext4: limit block allocations for indirect-block
files to < 2^32") added code to try to allocate xattr block with 32-bit
block number for indirect block based files on the grounds that these
files cannot use larger block numbers. It also added BUG_ON when
allocated block could not fit into 32 bits. This is however bogus
reasoning because xattr block is stored in inode->i_file_acl and
inode->i_file_acl_hi and as such even indirect block based files can
happily use full 48 bits for xattr block number. The proper handling
seems to be there basically since 64-bit block number support was added.
So remove the bogus limitation and BUG_ON.

Cc: Eric Sandeen <sandeen@redhat.com>
Fixes: fb0a387dcdcd ("ext4: limit block allocations for indirect-block files to < 2^32")
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20221121130929.32031-1-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org

authored by

Jan Kara and committed by
Theodore Ts'o
b40ebaf6 956510c0

-8
-8
fs/ext4/xattr.c
··· 2071 2071 2072 2072 goal = ext4_group_first_block_no(sb, 2073 2073 EXT4_I(inode)->i_block_group); 2074 - 2075 - /* non-extent files can't have physical blocks past 2^32 */ 2076 - if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) 2077 - goal = goal & EXT4_MAX_BLOCK_FILE_PHYS; 2078 - 2079 2074 block = ext4_new_meta_blocks(handle, inode, goal, 0, 2080 2075 NULL, &error); 2081 2076 if (error) 2082 2077 goto cleanup; 2083 - 2084 - if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) 2085 - BUG_ON(block > EXT4_MAX_BLOCK_FILE_PHYS); 2086 2078 2087 2079 ea_idebug(inode, "creating block %llu", 2088 2080 (unsigned long long)block);