[sheepdog-users] Possible bug when adding participants to vdi

Vedvyas shanbhogue vedvyas13686 at gmail.com
Sun Apr 17 05:20:18 CEST 2016


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.

        idx = entry->nr_participants++;
        memcpy(&entry->participants[idx], owner, sizeof(*owner));
        entry->participants_state[idx] =
                is_modified(entry) ?
                SHARED_LOCK_STATE_INVALIDATED : SHARED_LOCK_STATE_SHARED;

A fix may be:
        idx = entry->nr_participants+ 1;
        memcpy(&entry->participants[idx], owner, sizeof(*owner));
        entry->participants_state[idx] =
                is_modified(entry) ?
                SHARED_LOCK_STATE_INVALIDATED : SHARED_LOCK_STATE_SHARED;
        entry->nr_participants++;

Please tell me if this would be a good fix.

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..."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/sheepdog-users/attachments/20160416/97fc6c1d/attachment.html>


More information about the sheepdog-users mailing list