If we notice that time has gone backwards (that is, the current
time is older than the time of the last event we fired), then we
reschedule all pending events.
On Windows, immediately after we have resumed from a suspend, this
code path can be executed with an empty event tree, causing an
exception:
FAULTING_IP:
afsrpc!adjustTimes+cf [c:\src\openafs\openafs.git\repo\src\rx\rx_event.c @ 213]
00000000`
61041847 4c8b4030 mov r8,qword ptr [rax+30h]
EXCEPTION_RECORD:
ffffffffffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress:
0000000061041847 (afsrpc!adjustTimes+0x00000000000000cf)
ExceptionCode:
c0000005 (Access violation)
ExceptionFlags:
00000000
NumberParameters: 2
Parameter[0]:
0000000000000000
Parameter[1]:
0000000000000030
Attempt to read from address
0000000000000030
Resolve this by checking for an empty tree before we attempt to adjust
event times. If the tree is empty, we just zero the last event time
(so we don't keep running the adjustTimes routine), and continue as
normal.
Change-Id: I42a42ff1bd53a9d5c4733efc7ac5f629426b3aa1
Reviewed-on: http://gerrit.openafs.org/6425
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
clock_Sub(&adjTime, &now);
+ /* If there are no events in the tree, then there's nothing to adjust */
+ if (eventTree.first == NULL)
+ goto out;
+
node = opr_rbtree_first(&eventTree.head);
while(node) {
struct rxevent *event = opr_containerof(node, struct rxevent, node);