]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ext4: clear i_state_flags when alloc inode
authorHaibo Chen <haibo.chen@nxp.com>
Tue, 4 Nov 2025 08:12:24 +0000 (16:12 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:09:49 +0000 (13:09 +0100)
commit 4091c8206cfd2e3bb529ef260887296b90d9b6a2 upstream.

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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/ialloc.c
fs/ext4/inode.c
fs/ext4/super.c

index 5841686e80b3a6f15e4913ffe899d83297c3b3d9..487bd445bd5e1632877f4b3a1c3a6534c9753487 100644 (file)
@@ -1301,7 +1301,6 @@ got:
                                              sizeof(gen));
        }
 
-       ext4_clear_state_flags(ei); /* Only relevant on 32-bit archs */
        ext4_set_inode_state(inode, EXT4_STATE_NEW);
 
        ei->i_extra_isize = sbi->s_want_extra_isize;
index ec2cc86c75139b38cf3fb6a6e026fb278b1ee3ce..89abac7efd191fa4bce10f20346f877421d95cc6 100644 (file)
@@ -4754,7 +4754,6 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
        ei->i_projid = make_kprojid(&init_user_ns, i_projid);
        set_nlink(inode, le16_to_cpu(raw_inode->i_links_count));
 
-       ext4_clear_state_flags(ei);     /* Only relevant on 32-bit archs */
        ei->i_inline_off = 0;
        ei->i_dir_start_lookup = 0;
        ei->i_dtime = le32_to_cpu(raw_inode->i_dtime);
index b677b7d14bc234b7d694a8ea1fea710b6d05590f..65fd42a2105dfe060841436fcef17256cd596c29 100644 (file)
@@ -1300,6 +1300,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
 
        inode_set_iversion(&ei->vfs_inode, 1);
        ei->i_flags = 0;
+       ext4_clear_state_flags(ei);     /* Only relevant on 32-bit archs */
        spin_lock_init(&ei->i_raw_lock);
        INIT_LIST_HEAD(&ei->i_prealloc_list);
        atomic_set(&ei->i_prealloc_active, 0);