Skip to contentSkip to conversation

Fix ckpt_obj_lookup_add() leak detection logic

PATCH In review Dan Smith 2 participants 2 messages Sep 17, 2009 – Sep 18, 2009 1 message not in the archive

lore
Share & tools
lore

Dan Smith

author
#0 lore raw

PATCH 1/1 Fix ckpt_obj_lookup_add() leak detection logic

Since first is a pointer, it's never NULL and thus leak detection will always be performed (of CHECKPOINT_SUBTREE is set). This fatally breaks the checkpoint process when that flag is enabled because any object (with a ref_users operation) that is added to the hash twice will be reported as a reverse leak.

---
 checkpoint/objhash.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
checkpoint/objhash.c +1 -1
index 8dfb0b0..b85aa77 100644
@@ -679,7 +679,7 @@ int ckpt_obj_lookup_add(struct ckpt_ctx *ctx, void *ptr,
 	ckpt_debug("%s objref %d first %d\n",
 		   obj->ops->obj_name, obj->objref, *first);
 
-	if (first && obj_reverse_leak(ctx, obj))
+	if (*first && obj_reverse_leak(ctx, obj))
 		return -EBUSY;
 
 	obj->flags |= CKPT_OBJ_VISITED;
Signature · 1 line
1.6.2.5

A message that is not in the archive (sent off-list or not yet received): 1253207274-7563-1-git-send-email-danms-r/[email protected]

#2 lore raw

Got it, thanks.

Quoted 24 lines · Dan Smith

Since first is a pointer, it's never NULL and thus leak detection will always be performed (of CHECKPOINT_SUBTREE is set). This fatally breaks the checkpoint process when that flag is enabled because any object (with a ref_users operation) that is added to the hash twice will be reported as a reverse leak.

---
 checkpoint/objhash.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
checkpoint/objhash.c +1 -1
index 8dfb0b0..b85aa77 100644
@@ -679,7 +679,7 @@ int ckpt_obj_lookup_add(struct ckpt_ctx *ctx, void *ptr,
 	ckpt_debug("%s objref %d first %d\n",
 		   obj->ops->obj_name, obj->objref, *first);
 
-	if (first && obj_reverse_leak(ctx, obj))
+	if (*first && obj_reverse_leak(ctx, obj))
 		return -EBUSY;
 
 	obj->flags |= CKPT_OBJ_VISITED;