Skip to content

Commit

Permalink
clusterer: fix possible inconsistent list handling
Browse files Browse the repository at this point in the history
The tags `active_msgs_sent` list might become inconsistent due to the
fact that the `ni->next` is being populated outside locks.
  • Loading branch information
razvancrainea committed Sep 5, 2024
1 parent e02b99b commit 3092ec2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/clusterer/sharing_tags.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,8 @@ int shtag_activate(str *tag_name, int cluster_id, char *reason, int reason_len)
return ret;
}
ni->node_id = node->node_id;
ni->next = tag->active_msgs_sent;
lock_switch_write(shtags_lock, lock_old_flag);
ni->next = tag->active_msgs_sent;
tag->active_msgs_sent = ni;
lock_switch_read(shtags_lock, lock_old_flag);
}
Expand Down Expand Up @@ -816,8 +816,8 @@ void shtag_flush_state(int c_id, int node_id)
return;
}
ni->node_id = node_id;
ni->next = tag->active_msgs_sent;
lock_switch_write(shtags_lock, lock_old_flag);
ni->next = tag->active_msgs_sent;
tag->active_msgs_sent = ni;
lock_switch_read(shtags_lock, lock_old_flag);
}
Expand Down

0 comments on commit 3092ec2

Please sign in to comment.