[Devel] [PATCH hci-8.1 v4 3/6] drivers/md/push_backup: do not re-arm deadline timer in push_backup_write()

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 3 13:11:03 MSK 2026


On 11/3/26 11:03, Andrey Zhadchenko wrote:
> 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
> field.

Hi Andrey,

That holds only while the timer is pending whenever writes are delayed,
and at this point of the series it is not always so. Both arming sites
still decide under pb->lock and call mod_timer() after dropping it:

  CPU1 pb_timer_func()            CPU2 postpone_if_required_for_backup()
  lock; deadline = S64_MAX
  unlock
                                  lock; nr_delayed = 1
                                  deadline_jiffies = now + timeout
                                  unlock
                                  mod_timer(timeout)
  mod_timer(from S64_MAX)

The write is delayed with the timer parked for days. Before this patch
the next push_backup_write() that left requests delayed re-armed the
timer and repaired it. After it nothing does until nr_delayed drops to
zero or stop. 5/6 closes the race, so please put 5/6 before this patch
or fold the two, so that no bisect point carries the window.

> This is also the only place that arms the timer outside the window
> push_backup_stop() waits for with synchronize_rcu().

pb_timer_func() re-arms the timer outside that window too: a firing
that starts after synchronize_rcu() runs concurrently with
timer_delete_sync_try(). Please drop "the only place" here and in the
cover letter.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list