ploop block device is represented by a block device file in /dev, but
it's lifecycle is separated from the file itself by PLOOP_IOC_START and
PLOOP_IOC_STOP ioctls. This way ploop file in /dev can be an empty
placeholder after PLOOP_IOC_STOP ioctl and reinitialized later by a
PLOOP_IOC_START. Because of that some of the important data structures
stay allocated after stop and maintain old values until and after restart.
This situation is also true for block device statistics that remain unchanged
after end of ploop device lifecycle. Fresh-started ploop device is considered
a new entity with stats equal to zero. For that we zero out stats at ploop_stop.

https://jira.sw.ru/browse/PSBM-95605

Signed-off-by: Valeriy.Vdovin <[email protected]>
---
 drivers/block/ploop/dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index ac4d142..c54ff90 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4373,6 +4373,9 @@ static int ploop_stop(struct ploop_device * plo, struct 
block_device *bdev)
 
        clear_bit(PLOOP_S_RUNNING, &plo->state);
 
+       part_stat_set_all(&plo->disk->part0, 0);
+       memset(&plo->st, 0, sizeof(plo->st));
+
        del_timer_sync(&plo->mitigation_timer);
        del_timer_sync(&plo->freeze_timer);
 
-- 
1.8.3.1

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

Reply via email to