From: Maxim Patlasov <mpatla...@openvz.org> map_extent_get_block() optimizes I/O by merging adjacent ext4 extents. However, it's useless to ask ext4 about layout beyond EOF because ploop always extends image file by fallocate() w/o FALLOC_FL_KEEP_SIZE flag.
And more than that -- it can be also dangerous because userspace merge utility may race with us extending image file by ordinary write-s resulting in (temporary) FIEMAP_EXTENT_DELALLOC extents. https://jira.sw.ru/browse/PSBM-26762 https://jira.sw.ru/browse/PSBM-39251 --- drivers/block/ploop/io_direct_map.c | 5 +++++ 1 file changed, 5 insertions(+)
From: Maxim Patlasov <mpatla...@virtuozzo.com> map_extent_get_block() optimizes I/O by merging adjacent ext4 extents. However, it's useless to ask ext4 about layout beyond EOF because ploop always extends image file by fallocate() w/o FALLOC_FL_KEEP_SIZE flag. And more than that -- it can be also dangerous because userspace merge utility may race with us extending image file by ordinary write-s resulting in (temporary) FIEMAP_EXTENT_DELALLOC extents. https://jira.sw.ru/browse/PSBM-26762 https://jira.sw.ru/browse/PSBM-39251 --- drivers/block/ploop/io_direct_map.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/block/ploop/io_direct_map.c b/drivers/block/ploop/io_direct_map.c index c1d889b..977adc2 100644 --- a/drivers/block/ploop/io_direct_map.c +++ b/drivers/block/ploop/io_direct_map.c @@ -776,6 +776,11 @@ struct extent_map *map_extent_get_block(struct ploop_io *io, * something bigger. */ do { + /* avoid race with userspace merge */ + if (em->end >= + ((sector_t)io->alloc_head << io->plo->cluster_log)) + break; + last = em->end; extent_put(em); em = __map_extent(io, mapping, last, len, create,
_______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel