<div dir="ltr"><div>This code increments the nr_participants but the participant state is not updated yet. The is_modified will now iterate over the updated nr_participants and can see bad state in participant_state array. </div><div><br></div><div>        idx = entry->nr_participants++;</div><div>        memcpy(&entry->participants[idx], owner, sizeof(*owner));</div><div>        entry->participants_state[idx] =</div><div>                is_modified(entry) ?</div><div>                SHARED_LOCK_STATE_INVALIDATED : SHARED_LOCK_STATE_SHARED;</div><div><br></div><div>A fix may be:</div><div><div>        idx = entry->nr_participants+ 1;</div><div>        memcpy(&entry->participants[idx], owner, sizeof(*owner));</div><div>        entry->participants_state[idx] =</div><div>                is_modified(entry) ?</div><div>                SHARED_LOCK_STATE_INVALIDATED : SHARED_LOCK_STATE_SHARED;</div></div><div>        entry->nr_participants++;<br></div><div><br></div><div>Please tell me if this would be a good fix.</div><div><br></div><div>I was investigating a panic from is_modified where is_valid_shared_state finds an invalid shared state - "invalid shared state, two (or more) nodes are owning VDI..."</div><div><br></div><div><br></div></div>