summaryrefslogtreecommitdiff
path: root/fs/f2fs
diff options
context:
space:
mode:
authorChao Yu <chao@kernel.org>2025-09-12 16:12:50 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-15 12:03:59 +0200
commita198668c3bbfc4371f86773ddc88937b627e04d6 (patch)
treef4527f5324cd81e26c44cba65180f9d8e76cf535 /fs/f2fs
parent419f8b904a4d1a3bfc650176d1c8ce358299662a (diff)
downloadlinux-a198668c3bbfc4371f86773ddc88937b627e04d6.tar.gz
linux-a198668c3bbfc4371f86773ddc88937b627e04d6.tar.bz2
linux-a198668c3bbfc4371f86773ddc88937b627e04d6.zip
f2fs: fix to update map->m_next_extent correctly in f2fs_map_blocks()
[ Upstream commit 869833f54e8306326b85ca3ed08979b7ad412a4a ] Script to reproduce: mkfs.f2fs -O extra_attr,compression /dev/vdb -f mount /dev/vdb /mnt/f2fs -o mode=lfs,noextent_cache cd /mnt/f2fs f2fs_io write 1 0 1024 rand dsync testfile xfs_io testfile -c "fsync" f2fs_io write 1 0 512 rand dsync testfile xfs_io testfile -c "fsync" cd / umount /mnt/f2fs mount /dev/vdb /mnt/f2fs f2fs_io precache_extents /mnt/f2fs/testfile umount /mnt/f2fs Tracepoint output: f2fs_update_read_extent_tree_range: dev = (253,16), ino = 4, pgofs = 0, len = 512, blkaddr = 1055744, c_len = 0 f2fs_update_read_extent_tree_range: dev = (253,16), ino = 4, pgofs = 513, len = 351, blkaddr = 17921, c_len = 0 f2fs_update_read_extent_tree_range: dev = (253,16), ino = 4, pgofs = 864, len = 160, blkaddr = 18272, c_len = 0 During precache_extents, there is off-by-one issue, we should update map->m_next_extent to pgofs rather than pgofs + 1, if last blkaddr is valid and not contiguous to previous extent. Fixes: c4020b2da4c9 ("f2fs: support F2FS_IOC_PRECACHE_EXTENTS") Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/data.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 7961e0ddfca3..838eae39d3b1 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1783,7 +1783,7 @@ sync_out:
map->m_len - ofs);
}
if (map->m_next_extent)
- *map->m_next_extent = pgofs + 1;
+ *map->m_next_extent = is_hole ? pgofs + 1 : pgofs;
}
f2fs_put_dnode(&dn);
unlock_out: