• Nils Goroll's avatar
    Simplify vsl segment management, fixing spurious vsl overruns · 35cf7813
    Nils Goroll authored
    vsl sequence and segment updates didn't happen atomically, so
    vslc_vsm_check could report spurious overruns.
    
    Replace sequence and segment index with a counter (segment_n), which
    always increments (with overflow after UINT_MAX). The actual segment
    index will be segment_n % VSL_SEGMENTS. Overrun detection by
    calculation of the difference between two segment numbers becomes
    simple and safe because we only ever access/update a single integer.
    
    Update the shared memory log head.
    
    (struct VSLC_ptr).priv is now the the equivalent of segment_n from the
    reader side. It gets initialized once and is maintained independently.
    
    Patch prepared in collaboration with Martin Blix Grydeland
    <martin@varnish-software.com>
    
    Fixes: #1747
    35cf7813
vsl_int.h 3.65 KB