|  | 
| 1 | 1 | /* | 
| 2 |  | - * Copyright (c) 2012-2013 Cisco Systems, Inc. All rights reserved. | 
|  | 2 | + * Copyright (c) 2012-2016 Cisco Systems, Inc.  All rights reserved. | 
| 3 | 3 |  * Copyright (c) 2012      Los Alamos National Security, LLC. All rights reserved | 
| 4 | 4 |  * Copyright (c) 2015      Intel, Inc. All rights reserved. | 
| 5 | 5 |  * $COPYRIGHT$ | 
| @@ -245,7 +245,11 @@ static inline void opal_hotel_checkout(opal_hotel_t *hotel, int room_num) | 
| 245 | 245 |     room = &(hotel->rooms[room_num]); | 
| 246 | 246 |     if (OPAL_LIKELY(NULL != room->occupant)) { | 
| 247 | 247 |         room->occupant = NULL; | 
| 248 |  | -        if (NULL != hotel->evbase) { | 
|  | 248 | +        /* Only delete the eviction event if it has not already fired. | 
|  | 249 | +           Specifically: don't delete the event if this function was | 
|  | 250 | +           invoked by the eviction timeout! */ | 
|  | 251 | +        if (NULL != hotel->evbase && | 
|  | 252 | +            opal_event_evtimer_pending(&room->eviction_timer_event, NULL)) { | 
| 249 | 253 |             opal_event_del(&(room->eviction_timer_event)); | 
| 250 | 254 |         } | 
| 251 | 255 |         hotel->last_unoccupied_room++; | 
| @@ -282,7 +286,14 @@ static inline void opal_hotel_checkout_and_return_occupant(opal_hotel_t *hotel, | 
| 282 | 286 |         opal_output (10, "checking out occupant %p from room num %d", room->occupant, room_num); | 
| 283 | 287 |         *occupant = room->occupant; | 
| 284 | 288 |         room->occupant = NULL; | 
| 285 |  | -        if (NULL != hotel->evbase) { | 
|  | 289 | +        /* Only delete the eviction event if it has not already fired. | 
|  | 290 | +           Specifically: don't delete the event if this function was | 
|  | 291 | +           invoked by the eviction timeout! (this check is somewhat | 
|  | 292 | +           redundant because as of this writing, the eviction timeout | 
|  | 293 | +           does not call this function, but this is good defensive | 
|  | 294 | +           programming). */ | 
|  | 295 | +        if (NULL != hotel->evbase && | 
|  | 296 | +            opal_event_evtimer_pending(&room->eviction_timer_event, NULL)) { | 
| 286 | 297 |             opal_event_del(&(room->eviction_timer_event)); | 
| 287 | 298 |         } | 
| 288 | 299 |         hotel->last_unoccupied_room++; | 
|  | 
0 commit comments