Page MenuHomeFreeBSD

D60162.diff
No OneTemporary

D60162.diff

diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c
--- a/sys/kern/subr_epoch.c
+++ b/sys/kern/subr_epoch.c
@@ -193,6 +193,7 @@
{
va_list ap;
struct stackentry se, *new;
+ bool dup;
stack_save(&se.se_stack);
@@ -205,10 +206,13 @@
bcopy(&se.se_stack, &new->se_stack, sizeof(struct stack));
mtx_lock(&epoch_stacks_lock);
- new = RB_INSERT(stacktree, &epoch_stacks, new);
+ dup = RB_INSERT(stacktree, &epoch_stacks, new) != NULL;
mtx_unlock(&epoch_stacks_lock);
- if (new != NULL)
+ if (dup) {
+ /* Lost a race; the other thread reports it. */
free(new, M_STACK);
+ return;
+ }
}
va_start(ap, fmt);

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 1, 11:06 PM (14 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40017224
Default Alt Text
D60162.diff (645 B)

Event Timeline