Skip to content

Commit

Permalink
In HashTables, handle the error case if deferred work entry creation …
Browse files Browse the repository at this point in the history
…fails

Right now, if the deferred work entry creation fails, we do not take any
ation. This can result in, Hash bucket never being cleaned up, as there
is no work entry scheduled at all.

As a fix, reset the work entry 'scheduled' variable, so that, it gets
scheduled when the next hash entry is attemped for deletion in that
bucket

Change-Id: Ia66bd340177253ac1267aa667521c26838487dbe
partial-bug: #1618375
  • Loading branch information
divakardhar committed Sep 22, 2016
1 parent 0d4cbb1 commit 74698a2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions dp-core/vr_htable.c
Expand Up @@ -385,8 +385,17 @@ vr_htable_release_hentry(vr_htable_t htable, vr_hentry_t *ent)

/* Schedule the deletion on a cpu based on bucket index */
cpu_num = head_ent->hentry_index % vr_num_cpus;
vr_schedule_work(cpu_num, vr_htable_hentry_scheduled_delete,
(void *)delete_data);
if (vr_schedule_work(cpu_num, vr_htable_hentry_scheduled_delete,
(void *)delete_data)) {
/*
* We can only write back the status as not scheduled. There
* might be some entries that get marked as Deleted, but
* would not be pushed to free list as work queue is not
* scheduled. These marked entries would be deleted only if
* this hash bucket is revisisted
*/
(void)__sync_bool_compare_and_swap(&delete_data->hd_scheduled,1, 0);
}
}

return;
Expand Down

0 comments on commit 74698a2

Please sign in to comment.