Skip to content

Commit

Permalink
Document a pitfall with ObjWaitExtend()
Browse files Browse the repository at this point in the history
Maybe it should gain a boc_state_e * argument to return a consistent
state value?
  • Loading branch information
nigoroll committed May 21, 2024
1 parent 4eb2012 commit 7bccded
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/varnishd/storage/storage_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7bccded

Please sign in to comment.