mod_timer() takes an absolute jiffies value, but all callers pass a
relative one, which is always in the past. The timer fires and re-arms
on every tick while a write is delayed. It has worked so far because
pb_timer_func() checks pb->deadline_jiffies each time.
Fixes: 62e07487348e ("dm: Add push backup driver")
https://virtuozzo.atlassian.net/browse/VSTOR-152912
Feature: dm-backup: push backup target driver
Signed-off-by: Andrey Zhadchenko <[email protected]>
Reviewed-by: Alexander Ivanov <[email protected]>
---
v2: no changes
v3: no changes
v4: added Fixes: tag
v5: moved before "do not re-arm deadline timer", so it also fixes
the mod_timer() in push_backup_write(); commit message: the
relative expiry is always in the past, not only after 5 min
v6: subject prefix changed to dm/push_backup, added Feature: tag
drivers/md/dm-push-backup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/md/dm-push-backup.c b/drivers/md/dm-push-backup.c
index 5c4f3d625fb82..b6d1629245235 100644
--- a/drivers/md/dm-push-backup.c
+++ b/drivers/md/dm-push-backup.c
@@ -244,7 +244,7 @@ static void pb_timer_func(struct timer_list *timer)
spin_unlock_irqrestore(&pb->lock, flags);
if (unlikely(time_before64(now, deadline)))
- mod_timer(timer, deadline - now + 1);
+ mod_timer(timer, jiffies + (deadline - now) + 1);
else
queue_work(pb->wq, &pb->worker);
}
@@ -278,7 +278,7 @@ static int postpone_if_required_for_backup(struct
push_backup *pb,
spin_unlock_irqrestore(&pb->lock, flags);
if (queue_timer)
- mod_timer(&pb->deadline_timer, pb->timeout_in_jiffies + 1);
+ mod_timer(&pb->deadline_timer, jiffies + pb->timeout_in_jiffies
+ 1);
rcu_read_unlock();
if (queue_timer)
@@ -532,7 +532,7 @@ static int push_backup_write(struct push_backup *pb,
if (!list_empty(&pbio_list)) {
resubmit_pbios(pb, &pbio_list);
if (has_more)
- mod_timer(&pb->deadline_timer, pb->timeout_in_jiffies +
1);
+ mod_timer(&pb->deadline_timer, jiffies +
pb->timeout_in_jiffies + 1);
}
return 0;
--
2.43.5
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel