pb_timer_func() checks pb->deadline_jiffies every time it fires, so we actually don't need to re-arm the timer after setting the filed.
This is also the only place that arms the timer outside the window push_backup_stop() waits for with synchronize_rcu(). Today it is harmless because write and stop are serialized by pb->ctl_rwsem, but it would re-arm the timer behind timer_delete_sync_try() once the write path is reachable without the rwsem (next patches). https://virtuozzo.atlassian.net/browse/VSTOR-152912 Signed-off-by: Andrey Zhadchenko <[email protected]> --- v2: no changes v3: no changes drivers/md/dm-push-backup.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/md/dm-push-backup.c b/drivers/md/dm-push-backup.c index 1ae4ccc208ffa..8ce84a1a696e5 100644 --- a/drivers/md/dm-push-backup.c +++ b/drivers/md/dm-push-backup.c @@ -467,8 +467,8 @@ static int push_backup_write(struct push_backup *pb, unsigned int clu, unsigned int nr) { u64 i, key, nr_clus = pb->nr_clus; - bool finished, has_more = false; LIST_HEAD(pbio_list); + bool finished; struct pb_bio *pbio; if (!pb) @@ -519,8 +519,7 @@ static int push_backup_write(struct push_backup *pb, } } - has_more = (pb->nr_delayed != 0); - if (has_more) + if (pb->nr_delayed) pb->deadline_jiffies = get_jiffies_64() + pb->timeout_in_jiffies; else pb->deadline_jiffies = S64_MAX; @@ -529,11 +528,8 @@ static int push_backup_write(struct push_backup *pb, if (finished) wake_up_interruptible(&pb->waitq); - if (!list_empty(&pbio_list)) { + if (!list_empty(&pbio_list)) resubmit_pbios(pb, &pbio_list); - if (has_more) - mod_timer(&pb->deadline_timer, pb->timeout_in_jiffies + 1); - } return 0; } -- 2.43.5 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
