[master] 7bccded24 Document a pitfall with ObjWaitExtend()
Nils Goroll
nils.goroll at uplex.de
Tue May 21 12:32:06 UTC 2024
commit 7bccded24df0efd9200f44be111b8eacd486e5de
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Tue May 21 14:27:03 2024 +0200
Document a pitfall with ObjWaitExtend()
Maybe it should gain a boc_state_e * argument to return a consistent
state value?
diff --git a/bin/varnishd/storage/storage_simple.c b/bin/varnishd/storage/storage_simple.c
index ba658a8f7..6626d3a0d 100644
--- a/bin/varnishd/storage/storage_simple.c
+++ b/bin/varnishd/storage/storage_simple.c
@@ -368,6 +368,13 @@ sml_iterator(struct worker *wrk, struct objcore *oc,
break;
}
if (nl == ol) {
+ /*
+ * note: the unguarded boc->state read could be
+ * outdated, in which case we call ObjWaitExtend() again
+ * for error handling but otherwise cause no harm. When
+ * using this code as an example, DO NOT rely on
+ * boc->state to be consistent
+ */
if (boc->state == BOS_FINISHED)
break;
continue;
More information about the varnish-commit
mailing list