[6.0] 28dc4b07c Don't remove VSM_FLAG_CLUSTER too early
Martin Blix Grydeland
martin at varnish-software.com
Fri Oct 18 13:23:07 UTC 2019
commit 28dc4b07c3bbf39a8a19cd00757fa7eeab48365e
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Fri Aug 30 15:18:46 2019 +0200
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.
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index c7bded025..06f13af28 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -242,11 +242,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;
@@ -258,6 +253,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
More information about the varnish-commit
mailing list