[master] cc06c2278 Revert "Fix the order of HSH_Fail() and ObjSetState()"

Martin Blix Grydeland martin at varnish-software.com
Thu May 2 12:45:10 UTC 2019


commit cc06c2278f186bd4bc4c1aea80a8e31a7e2cc436
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Fri Apr 26 15:32:10 2019 +0200

    Revert "Fix the order of HSH_Fail() and ObjSetState()"
    
    This reverts commit 501246e939430dd60d44e8e3af40d6978f11186d.

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 5535e00b7..63738e1fe 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -809,6 +809,7 @@ vbf_stp_fail(struct worker *wrk, const struct busyobj *bo)
 
 	assert(bo->fetch_objcore->boc->state < BOS_FINISHED);
 	ObjSetState(wrk, bo->fetch_objcore, BOS_FAILED);
+	HSH_Fail(bo->fetch_objcore);
 	if (!(bo->fetch_objcore->flags & OC_F_BUSY))
 		HSH_Kill(bo->fetch_objcore);
 	return (F_STP_DONE);
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index d723975da..89bb0497d 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -84,7 +84,6 @@
 #include <stdlib.h>
 
 #include "cache_varnishd.h"
-#include "cache_objhead.h"
 #include "cache_obj.h"
 #include "vend.h"
 #include "storage/storage.h"
@@ -258,7 +257,8 @@ ObjWaitExtend(const struct worker *wrk, const struct objcore *oc, uint64_t l)
  */
 
 void
-ObjSetState(struct worker *wrk, struct objcore *oc, enum boc_state_e next)
+ObjSetState(struct worker *wrk, const struct objcore *oc,
+    enum boc_state_e next)
 {
 	const struct obj_methods *om;
 
@@ -275,13 +275,6 @@ ObjSetState(struct worker *wrk, struct objcore *oc, enum boc_state_e next)
 			om->objsetstate(wrk, oc, next);
 	}
 
-	if (next == BOS_FAILED) {
-		/* Signal to cache_hash.c that this object is failed. This
-		 * needs to happen before we signal the boc so that code
-		 * will see the OC_F_FAILED flag after ObjWaitState() */
-		HSH_Fail(oc);
-	}
-
 	Lck_Lock(&oc->boc->mtx);
 	oc->boc->state = next;
 	AZ(pthread_cond_broadcast(&oc->boc->cond));
diff --git a/bin/varnishd/cache/cache_varnishd.h b/bin/varnishd/cache/cache_varnishd.h
index fab80d6ba..b3f766080 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -293,7 +293,8 @@ int ObjGetSpace(struct worker *, struct objcore *, ssize_t *sz, uint8_t **ptr);
 void ObjExtend(struct worker *, struct objcore *, ssize_t l);
 uint64_t ObjWaitExtend(const struct worker *, const struct objcore *,
     uint64_t l);
-void ObjSetState(struct worker *, struct objcore *, enum boc_state_e next);
+void ObjSetState(struct worker *, const struct objcore *,
+    enum boc_state_e next);
 void ObjWaitState(const struct objcore *, enum boc_state_e want);
 void ObjTrimStore(struct worker *, struct objcore *);
 void ObjTouch(struct worker *, struct objcore *, vtim_real now);


More information about the varnish-commit mailing list