Skip to content
Permalink
Browse files

Remove stale cluster segments when their refcount goes to zero

When a cluster is marked stale, there is no mechanism to actually remove
it once all its containing segments (which would also be marked stale)
goes away.

Fix this by executing vsm_delseg on the cluster in VSM_Unmap if it is marked
stale.
  • Loading branch information...
mbgrydeland committed Aug 30, 2019
1 parent 68a04ae commit 63dbc260a86aecb694a6483ddfb4a2818d884945
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/libvarnishapi/vsm.c
@@ -975,8 +975,13 @@ VSM_Unmap(struct vsm *vd, struct vsm_fantom *vf)
assert(vg->s == NULL);
assert(vg->sz == 0);
assert(vg->cluster->refs > 0);
if (--vg->cluster->refs == 0)
if (--vg->cluster->refs == 0) {
vsm_unmapseg(vg->cluster);
if (vg->cluster->flags & VSM_FLAG_STALE) {
AN(vg->flags & VSM_FLAG_STALE);
vsm_delseg(vg->cluster, 0);
}
}
vg->b = vg->e = NULL;
} else {
vsm_unmapseg(vg);

0 comments on commit 63dbc26

Please sign in to comment.
You can’t perform that action at this time.