Skip to content

Commit 4091c82

Browse files
BoughChentytso
authored andcommitted
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: acf943e ("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
1 parent 6abfe10 commit 4091c82

3 files changed

Lines changed: 1 addition & 2 deletions

File tree

fs/ext4/ialloc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,6 @@ struct inode *__ext4_new_inode(struct mnt_idmap *idmap,
12931293
ei->i_csum_seed = ext4_chksum(csum, (__u8 *)&gen, sizeof(gen));
12941294
}
12951295

1296-
ext4_clear_state_flags(ei); /* Only relevant on 32-bit archs */
12971296
ext4_set_inode_state(inode, EXT4_STATE_NEW);
12981297

12991298
ei->i_extra_isize = sbi->s_want_extra_isize;

fs/ext4/inode.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5296,7 +5296,6 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
52965296
ei->i_projid = make_kprojid(&init_user_ns, i_projid);
52975297
set_nlink(inode, le16_to_cpu(raw_inode->i_links_count));
52985298

5299-
ext4_clear_state_flags(ei); /* Only relevant on 32-bit archs */
53005299
ei->i_inline_off = 0;
53015300
ei->i_dir_start_lookup = 0;
53025301
ei->i_dtime = le32_to_cpu(raw_inode->i_dtime);

fs/ext4/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
13961396

13971397
inode_set_iversion(&ei->vfs_inode, 1);
13981398
ei->i_flags = 0;
1399+
ext4_clear_state_flags(ei); /* Only relevant on 32-bit archs */
13991400
spin_lock_init(&ei->i_raw_lock);
14001401
ei->i_prealloc_node = RB_ROOT;
14011402
atomic_set(&ei->i_prealloc_active, 0);

0 commit comments

Comments
 (0)