Userspace might pass the optional argument fallo_new_clu
to the constructor even though the table is created in
read-only mode. Add a check for read-only ploop and skip
preallocation.

https://virtuozzo.atlassian.net/browse/VSTOR-123292
Signed-off-by: Vasileios Almpanis <[email protected]>

Feature: dm-ploop: ploop target driver
---
 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 6ab81a56707d..553ade08b0c4 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->nr_deltas > 0)
+       if (!ploop_is_ro(ploop) && !(ploop->nr_deltas > 0))
                ploop_should_prealloc(ploop);
 
        return 0;
-- 
2.43.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to