[Devel] [PATCH VZ9] dm-ploop: fix dirty data detection mechanism in ploop_allocate_cluster

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Thu Jul 10 09:02:40 MSK 2025


We use ploop_delta->file_preallocated_area_start when we allocate a new
cluster to determine if the place we allocate from is from preallocation
area or not. And depending on that we either zero the area or not, so
wrong detection can lead to garbage data to appear in the cluster which
was thought of as a zero cluster.

https://virtuozzo.atlassian.net/browse/VSTOR-110285
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index f21a3ae5ba4a..40eca0a6f83f 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1332,6 +1332,9 @@ static int ploop_allocate_cluster(struct ploop *ploop, u32 *dst_clu, struct file
 		}
 	}
 
+	if (end > top->file_preallocated_area_start)
+		top->file_preallocated_area_start = end;
+
 	spin_unlock_irqrestore(&ploop->bat_lock, flags);
 
 	return 0;
-- 
2.50.0



More information about the Devel mailing list