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

ext4: clear i_state_flags when alloc inode

i_state_flags used on 32-bit archs, need to clear this flag when
alloc inode.
Find this issue when umount ext4, sometimes track the inode as orphan
accidently, cause ext4 mesg dump.

Fixes: acf943e9768e ("ext4: fix checks for orphan inodes")
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Message-ID: <20251104-ext4-v1-1-73691a0800f9@nxp.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org

authored by

Haibo Chen and committed by
Theodore Ts'o
4091c820 6abfe107

+1 -2
-1
fs/ext4/ialloc.c
··· 1293 1293 ei->i_csum_seed = ext4_chksum(csum, (__u8 *)&gen, sizeof(gen)); 1294 1294 } 1295 1295 1296 - ext4_clear_state_flags(ei); /* Only relevant on 32-bit archs */ 1297 1296 ext4_set_inode_state(inode, EXT4_STATE_NEW); 1298 1297 1299 1298 ei->i_extra_isize = sbi->s_want_extra_isize;
-1
fs/ext4/inode.c
··· 5296 5296 ei->i_projid = make_kprojid(&init_user_ns, i_projid); 5297 5297 set_nlink(inode, le16_to_cpu(raw_inode->i_links_count)); 5298 5298 5299 - ext4_clear_state_flags(ei); /* Only relevant on 32-bit archs */ 5300 5299 ei->i_inline_off = 0; 5301 5300 ei->i_dir_start_lookup = 0; 5302 5301 ei->i_dtime = le32_to_cpu(raw_inode->i_dtime);
+1
fs/ext4/super.c
··· 1396 1396 1397 1397 inode_set_iversion(&ei->vfs_inode, 1); 1398 1398 ei->i_flags = 0; 1399 + ext4_clear_state_flags(ei); /* Only relevant on 32-bit archs */ 1399 1400 spin_lock_init(&ei->i_raw_lock); 1400 1401 ei->i_prealloc_node = RB_ROOT; 1401 1402 atomic_set(&ei->i_prealloc_active, 0);