diff --git a/fs/ext4/super.c b/fs/ext4/super.c index e72145c4ae5a..466aece8518f 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -338,7 +338,7 @@ ext4_fsblk_t ext4_inode_table(struct super_block *sb, __u32 ext4_free_group_clusters(struct super_block *sb, struct ext4_group_desc *bg) { - return le16_to_cpu(bg->bg_free_blocks_count_lo) | + return le16_to_cpu(READ_ONCE(bg->bg_free_blocks_count_lo)) | (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? (__u32)le16_to_cpu(bg->bg_free_blocks_count_hi) << 16 : 0); } @@ -394,7 +394,7 @@ void ext4_inode_table_set(struct super_block *sb, void ext4_free_group_clusters_set(struct super_block *sb, struct ext4_group_desc *bg, __u32 count) { - bg->bg_free_blocks_count_lo = cpu_to_le16((__u16)count); + WRITE_ONCE(bg->bg_free_blocks_count_lo, cpu_to_le16((__u16)count)); if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) bg->bg_free_blocks_count_hi = cpu_to_le16(count >> 16); }