timerfd: Wake up on discontinuous jump
If a discontinous realtime clock change occurs and sets any TFD_JUMPED bits on the timerfd, then wake up waiting readers. This fixes failures from the timerfd_root__clock_change_notification test case. MFC after: 2 weeks
This commit is contained in:
+11
-3
@@ -118,6 +118,14 @@ timerfd_getboottime(struct timespec *ts)
|
|||||||
TIMEVAL_TO_TIMESPEC(&tv, ts);
|
TIMEVAL_TO_TIMESPEC(&tv, ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
timerfd_wakeup(struct timerfd *tfd)
|
||||||
|
{
|
||||||
|
wakeup(&tfd->tfd_count);
|
||||||
|
selwakeup(&tfd->tfd_sel);
|
||||||
|
KNOTE_LOCKED(&tfd->tfd_sel.si_note, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call when a discontinuous jump has occured in CLOCK_REALTIME and
|
* Call when a discontinuous jump has occured in CLOCK_REALTIME and
|
||||||
* update timerfd's cached boottime. A jump can be triggered using
|
* update timerfd's cached boottime. A jump can be triggered using
|
||||||
@@ -172,6 +180,8 @@ timerfd_jumped(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tfd->tfd_boottim = boottime;
|
tfd->tfd_boottim = boottime;
|
||||||
|
if ((tfd->tfd_jumped & TFD_JUMPED) != 0)
|
||||||
|
timerfd_wakeup(tfd);
|
||||||
mtx_unlock(&tfd->tfd_lock);
|
mtx_unlock(&tfd->tfd_lock);
|
||||||
}
|
}
|
||||||
mtx_unlock(&timerfd_list_lock);
|
mtx_unlock(&timerfd_list_lock);
|
||||||
@@ -418,9 +428,7 @@ timerfd_expire(void *arg)
|
|||||||
timespecclear(&tfd->tfd_time.it_value);
|
timespecclear(&tfd->tfd_time.it_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
wakeup(&tfd->tfd_count);
|
timerfd_wakeup(tfd);
|
||||||
selwakeup(&tfd->tfd_sel);
|
|
||||||
KNOTE_LOCKED(&tfd->tfd_sel.si_note, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
Reference in New Issue
Block a user