]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ocfs2: use correct endian in ocfs2_dinode_has_extents
authorJoseph Qi <joseph.qi@linux.alibaba.com>
Sat, 25 Oct 2025 12:32:17 +0000 (20:32 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 12 Nov 2025 18:00:16 +0000 (10:00 -0800)
Fields in ocfs2_dinode is little endian, covert to host endian when
checking those contents.

Link: https://lkml.kernel.org/r/20251025123218.3997866-1-joseph.qi@linux.alibaba.com
Fixes: fdbb6cd96ed5 ("ocfs2: correct l_next_free_rec in online check")
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: Heming Zhao <heming.zhao@suse.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/inode.c

index fcc89856ab95b65619745135060744126d741e84..0a0a96054bfecb976dbd3d4ea2767f58ae380761 100644 (file)
@@ -201,13 +201,15 @@ bail:
 static int ocfs2_dinode_has_extents(struct ocfs2_dinode *di)
 {
        /* inodes flagged with other stuff in id2 */
-       if (di->i_flags & (OCFS2_SUPER_BLOCK_FL | OCFS2_LOCAL_ALLOC_FL |
-                          OCFS2_CHAIN_FL | OCFS2_DEALLOC_FL))
+       if (le32_to_cpu(di->i_flags) &
+           (OCFS2_SUPER_BLOCK_FL | OCFS2_LOCAL_ALLOC_FL | OCFS2_CHAIN_FL |
+            OCFS2_DEALLOC_FL))
                return 0;
        /* i_flags doesn't indicate when id2 is a fast symlink */
-       if (S_ISLNK(di->i_mode) && di->i_size && di->i_clusters == 0)
+       if (S_ISLNK(le16_to_cpu(di->i_mode)) && le64_to_cpu(di->i_size) &&
+           !le32_to_cpu(di->i_clusters))
                return 0;
-       if (di->i_dyn_features & OCFS2_INLINE_DATA_FL)
+       if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL)
                return 0;
 
        return 1;