Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
idnode: a better mechanism to not save idnode data in the destroy phase
  • Loading branch information
perexg committed Feb 11, 2016
1 parent dfaef76 commit 1cf3f2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/idnode.c
Expand Up @@ -161,7 +161,7 @@ idnode_unlink(idnode_t *in)
RB_REMOVE(in->in_domain, in, in_domain_link);
tvhtrace("idnode", "unlink node %s", idnode_uuid_as_str(in, ubuf));
idnode_notify(in, "delete");
assert(in->in_save == NULL);
assert(in->in_save == NULL || in->in_save == SAVEPTR_OUTOFSERVICE);
}

/**
Expand Down Expand Up @@ -1113,12 +1113,12 @@ idnode_save_check ( idnode_t *self, int weak )
char filename[PATH_MAX];
htsmsg_t *m;

if (self->in_save == NULL)
if (self->in_save == NULL || self->in_save == SAVEPTR_OUTOFSERVICE)
return;

TAILQ_REMOVE(&idnodes_save, self->in_save, ise_link);
free(self->in_save);
self->in_save = NULL;
self->in_save = SAVEPTR_OUTOFSERVICE;

if (weak)
return;
Expand Down
2 changes: 2 additions & 0 deletions src/idnode.h
Expand Up @@ -30,6 +30,8 @@ struct access;
typedef struct idnode idnode_t;
typedef struct idnode_save idnode_save_t;

#define SAVEPTR_OUTOFSERVICE ((void *)((intptr_t)-1LL))

/*
* Node set
*/
Expand Down

0 comments on commit 1cf3f2a

Please sign in to comment.