On save failure, writing is cleared before dirty is restored. Another
worker can observe a clean, idle zone and stop retrying. If the failed
writer is exiting, it also stops retrying and the changes remain unsaved.
Set dirty first and add a memory barrier before clearing writing to
publish the need for another save before releasing the writer.
ngx_destroy_pool(pool);
+ dict->sh->dirty = 1;
+
+ ngx_memory_barrier();
+
/* no lock required */
dict->sh->writing = 0;
- dict->sh->dirty = 1;
return NGX_ERROR;
}