[master] ed645d2 Remove busyobj from objcore under oh-mtx
Poul-Henning Kamp
phk at varnish-cache.org
Tue Mar 20 08:17:34 CET 2012
commit ed645d241fd54c65bc07acab75ba88efdb4281b9
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Mar 20 07:17:21 2012 +0000
Remove busyobj from objcore under oh-mtx
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index d71a6cb..eb7b855 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -35,10 +35,11 @@
#include "cache.h"
+#include "hash/hash_slinger.h"
+
#include "cache_backend.h"
#include "vcli_priv.h"
#include "vct.h"
-#include "vmb.h"
#include "vtcp.h"
static unsigned fetchfrag;
@@ -675,11 +676,8 @@ FetchBody(struct worker *wrk, void *priv)
/* XXX: Atomic assignment, needs volatile/membar ? */
bo->state = BOS_FINISHED;
}
- if (obj->objcore != NULL) {
- VMB();
- obj->objcore->busyobj = NULL;
- VMB();
- }
+ if (obj->objcore != NULL)
+ HSH_Complete(obj->objcore);
bo->stats = NULL;
VBO_DerefBusyObj(wrk, &bo);
}
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index f9217eb..e746813 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -566,6 +566,24 @@ HSH_Drop(struct worker *wrk, struct object **oo)
}
/*---------------------------------------------------------------------
+ * Remove the busyobj from an objcore
+ */
+
+void
+HSH_Complete(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->busyobj = NULL;
+ Lck_Unlock(&oh->mtx);
+}
+
+/*---------------------------------------------------------------------
* Unbusy an objcore when the object is completely fetched.
*/
diff --git a/bin/varnishd/hash/hash_slinger.h b/bin/varnishd/hash/hash_slinger.h
index 628d080..17d67f9 100644
--- a/bin/varnishd/hash/hash_slinger.h
+++ b/bin/varnishd/hash/hash_slinger.h
@@ -94,6 +94,7 @@ struct objhead {
};
void HSH_Unbusy(struct dstat *, struct objcore *);
+void HSH_Complete(struct objcore *oc);
void HSH_DeleteObjHead(struct dstat *, struct objhead *oh);
int HSH_Deref(struct dstat *, struct objcore *oc, struct object **o);
#endif /* VARNISH_CACHE_CHILD */
More information about the varnish-commit
mailing list