Commit b7779f71 authored by Geoff Simmons's avatar Geoff Simmons

Compatibility with Varnish 6.2.0 patched with commit bdf2f63.

- Use WS_Reserve() instead of WS_ReserveAll().
- Add HSH_Cancel() to the "foreign" code.
parent 00dba9de
......@@ -37,7 +37,7 @@ AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" != "xno"])
m4_ifndef([VARNISH_PREREQ], AC_MSG_ERROR([Need varnish.m4 -- see README.rst]))
VARNISH_PREREQ([trunk])
VARNISH_PREREQ([6.2.0])
VARNISH_VMODS([pesi])
VARNISH_COUNTERS([pesi])
......
......@@ -13,7 +13,9 @@ libvmod_pesi_la_SOURCES = \
node.c \
vmod_pesi.c \
vdp_pesi.c \
foreign/from_cache_esi_deliver.c
foreign/from_cache_esi_deliver.c \
foreign/from_cache_hash.h \
foreign/from_cache_hash.c
nodist_libvmod_pesi_la_SOURCES = \
vcc_if.c \
......@@ -29,6 +31,8 @@ vmod_pesi.c: vcc_if.h VSC_pesi.c VSC_pesi.h
vcc_if.h vmod_pesi.rst vmod_pesi.man.rst: vcc_if.c
foreign/from_cache_hash.c: foreign/from_cache_hash.h
vcc_if.c: vdp_pesi.vcc
$(AM_V_VMODTOOL) $(PYTHON) $(VMODTOOL) -o vcc_if $(srcdir)/vdp_pesi.vcc
......
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#include "config.h"
#include "from_cache_hash.h"
#include "cache/cache_objhead.h"
static void
hsh_abandon(struct objcore *oc)
{
struct objhead *oh;
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
oh = oc->objhead;
CHECK_OBJ(oh, OBJHEAD_MAGIC);
Lck_Lock(&oh->mtx);
oc->flags |= OC_F_ABANDON;
Lck_Unlock(&oh->mtx);
}
void
HSH_Cancel(struct worker *wrk, struct objcore *oc, struct boc *boc)
{
struct boc *bocref = NULL;
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
if ((oc->flags & (OC_F_PRIVATE | OC_F_HFM | OC_F_HFP)) == 0)
return;
/*
* NB: we use two distinct variables to only release the reference if
* we had to acquire one. The caller-provided boc is optional.
*/
if (boc == NULL)
bocref = boc = HSH_RefBoc(oc);
CHECK_OBJ_ORNULL(boc, BOC_MAGIC);
if (oc->flags & OC_F_HFP)
AN(oc->flags & OC_F_HFM);
if (boc != NULL) {
hsh_abandon(oc);
ObjWaitState(oc, BOS_FINISHED);
}
if (bocref != NULL)
HSH_DerefBoc(wrk, oc);
ObjSlim(wrk, oc);
}
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#include "config.h"
#ifndef CACHE_H_INCLUDED
#include "cache/cache_varnishd.h"
#endif
void HSH_Cancel(struct worker *wrk, struct objcore *oc, struct boc *boc);
......@@ -35,6 +35,7 @@
#include "cache/cache_filter.h"
#include "cache/cache_objhead.h"
#include "foreign/from_cache_esi_deliver.h"
#include "foreign/from_cache_hash.h"
#include "storage/storage.h"
#include "vend.h"
#include "vgz.h"
......@@ -154,7 +155,7 @@ node_fill_nodestock(struct ws *ws, struct node_head *head)
WS_Assert(ws);
AN(head);
spc = WS_ReserveAll(ws);
spc = WS_Reserve(ws, 0);
p = ws->f;
if (spc < ws_min_room)
......
......@@ -183,7 +183,7 @@ pesi_filter_on_ws(struct ws *ws, pesi_filter_list_t *func, void *arg)
AN(func);
AN(arg);
u = WS_ReserveAll(ws);
u = WS_Reserve(ws, 0);
if (u == 0) {
WS_Release(ws, 0);
WS_MarkOverflow(ws);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment