[Devel] [PATCH hci-8.2] dm-ploop: allocate the mtfile array as pointers, not struct files
Denis V. Lunev
den at openvz.org
Thu Nov 19 14:47:29 MSK 2026
From: Denis V. Lunev <den at openvz.org>
ploop_add_delta() sizes each slot of the per-runner clone array with
sizeof(*file), a whole struct file, although the array holds struct
file pointers. With nkt_runners equal to nr_cpu_ids, a host with a few
hundred possible CPUs asks for a costly-order contiguous allocation,
which can fail under fragmentation and takes the table load down the
error path.
Size the slots by the element type.
https://virtuozzo.atlassian.net/browse/VSTOR-156035
Fixes: 762b90ec3324 ("dm-ploop: use filp per thread")
Feature: dm-ploop: ploop target driver
Signed-off-by: Denis V. Lunev <den at openvz.org>
---
Applies on top of "dm-ploop: fix a double fput of the delta file when
ploop_add_delta() fails".
drivers/md/dm-ploop-bat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-ploop-bat.c b/drivers/md/dm-ploop-bat.c
index a2799f4aeb17..3a44f7480ff2 100644
--- a/drivers/md/dm-ploop-bat.c
+++ b/drivers/md/dm-ploop-bat.c
@@ -504,8 +504,8 @@ int ploop_add_delta(struct ploop *ploop, u32 level, struct file *file, bool is_r
ploop_apply_delta_mappings(ploop, deltas, level, &md_root, nr_be);
- deltas[level].mtfile = kcalloc(ploop->nkt_runners, sizeof(*file),
- GFP_KERNEL);
+ deltas[level].mtfile = kcalloc(ploop->nkt_runners,
+ sizeof(*deltas[level].mtfile), GFP_KERNEL);
if (!deltas[level].mtfile) {
ret = -ENOMEM;
goto out;
--
2.55.0
More information about the Devel
mailing list