The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.8.x-ovz" and will appear 
at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.8.4
------>
commit ec4f6defee626918fb28b89b939fd239c97e7145
Author: Maxim Patlasov <[email protected]>
Date:   Thu Oct 8 18:40:43 2015 +0400

    ploop: do not use fiemap beyond eof
    
    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
    
    Signed-off-by: Maxim Patlasov <[email protected]>
---
 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
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to