[Devel] [PATCH RHEL7] ploop: zero-out block device statistics at ploop_stop
Valeriy Vdovin
valeriy.vdovin at virtuozzo.com
Tue Sep 22 18:57:38 MSK 2020
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 <valeriy.vdovin at virtuozzo.com>
---
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
More information about the Devel
mailing list