Skip to content
Permalink
Browse files

Don't remove VSM_FLAG_CLUSTER too early

If a segment will be marked stale, it should not have its cluster flag
removed until its actually deleted.

This problem was observed in varnishtest as an assert. What happened was
that a VSM_Map() was executed on a stale segment inside a cluster, which
caused an assert when the cluster segment it pointed to was no longer
marked VSM_FLAG_CLUSTER.
  • Loading branch information...
mbgrydeland committed Aug 30, 2019
1 parent 1e7b50b commit 68a04aecdee977f5fac153779b65945feb201d04
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/libvarnishapi/vsm.c
@@ -253,11 +253,6 @@ vsm_delseg(struct vsm_seg *vg, int refsok)

CHECK_OBJ_NOTNULL(vg, VSM_SEG_MAGIC);

if (vg->flags & VSM_FLAG_CLUSTER) {
vg->flags &= ~VSM_FLAG_CLUSTER;
VTAILQ_REMOVE(&vg->set->clusters, vg, clist);
}

if (refsok && vg->refs) {
AZ(vg->flags & VSM_FLAG_STALE);
vg->flags |= VSM_FLAG_STALE;
@@ -269,6 +264,11 @@ vsm_delseg(struct vsm_seg *vg, int refsok)
if (vg->s != NULL)
vsm_unmapseg(vg);

if (vg->flags & VSM_FLAG_CLUSTER) {
vg->flags &= ~VSM_FLAG_CLUSTER;
VTAILQ_REMOVE(&vg->set->clusters, vg, clist);
}

if (vg->flags & VSM_FLAG_STALE)
VTAILQ_REMOVE(&vg->set->stale, vg, list);
else

0 comments on commit 68a04ae

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