[Devel] [PATCH RHEL10 COMMIT] dm-ploop: fix inverted nr_deltas check disabling construction-time prealloc

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 15 17:16:14 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-211.16.1.12.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.16.1.el10
------>
commit 06271b8af591fb7aec6ee877df6d027bf4cc2fb2
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Wed Jun 3 23:56:37 2026 +0200

    dm-ploop: fix inverted nr_deltas check disabling construction-time prealloc
    
    The read-only guard added to ploop_ctr() also accidentally negated the
    existing nr_deltas clause:
    
            -       if (ploop->nr_deltas > 0)
            +       if (!ploop_is_ro(ploop) && !(ploop->nr_deltas > 0))
                            ploop_should_prealloc(ploop);
    
    At this point ploop->nr_deltas is always >= 1 (ploop_add_deltas_stack()
    just above returns -EINVAL for argc < 1 and otherwise sets nr_deltas =
    argc, and ploop_ctr() rejects argc <= 0 earlier), so "nr_deltas > 0" is
    always true and "!(nr_deltas > 0)" is always false. The whole condition
    is therefore always false and ploop_should_prealloc() is never called -
    for writable devices too, contrary to the commit's intent ("skip prealloc
    for read-only, keep it for RW").
    
    Drop the spurious inner negation so prealloc is enabled for RW devices
    with deltas and skipped only for read-only ones. (Runtime allocation-path
    prealloc was unaffected; this only restores eager construction-time
    preallocation.)
    
    Fixes: e0461bc2c152 ("dm-ploop: dont preallocate clusters for read only table")
    https://virtuozzo.atlassian.net/browse/VSTOR-132310
    Feature: dm-ploop: ploop target driver
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 drivers/md/dm-ploop-target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index af0925712194..0de0e84d440d 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -635,7 +635,7 @@ static int ploop_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	ti->num_discard_bios = 1;
 	ti->discards_supported = true;
 
-	if (!ploop_is_ro(ploop) && !(ploop->nr_deltas > 0))
+	if (!ploop_is_ro(ploop) && ploop->nr_deltas > 0)
 		ploop_should_prealloc(ploop);
 
 	return 0;


More information about the Devel mailing list