Skip to content

CA-402326: Fetch SM records from the pool in one go to avoid race #6127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Vincent-lau
Copy link
Contributor

Previously the SM feature check was done in two parts, fetch all the SM ref from the coordinator, and then fetch their information such as types and features from the coordinator basedon the refs. This can cause race conditions, where the previously fetched refs might have been deleted when we fetch the SM features. The deletion might happen due to the way SM registeration works for shared SRs such as GFS2, where each PBD.plug will trigger a deregister of existing SM and re-register (which will delete existing SMs), and create another (very likely) identical SM.

To avoid this race, instead of fetch SM refs and their features separately, do this in one go so we get a consistent snapshot of the db state.

@Vincent-lau Vincent-lau force-pushed the private/shul2/sm-feature-check2 branch 3 times, most recently from d8fcb68 to 4feb8c5 Compare November 19, 2024 12:13
@Vincent-lau
Copy link
Contributor Author

Testing in progress

@Vincent-lau Vincent-lau changed the title CA-402326: Fetch SM records from the pool in one go CA-402326: Fetch SM records from the pool in one go to avoid race Nov 19, 2024
@Vincent-lau Vincent-lau force-pushed the private/shul2/sm-feature-check2 branch from 4feb8c5 to 630aead Compare November 19, 2024 12:16
Previously the SM feature check was done in two parts, fetch all the SM
ref from the coordinator, and then fetch their information such as types
and features from the coordinator basedon the refs. This can cause race
conditions, where the previously fetched refs might have been deleted
when we fetch the SM features. The deletion might happen due to the way
SM registeration works for shared SRs such as GFS2, where each
`PBD.plug` will trigger a deregister of existing SM and re-register
(which will delete existing SMs), and create another (very likely) identical
SM.

To avoid this race, instead of fetch SM refs and their features
separately, do this in one go so we get a consistent snapshot of the db
state.

Also add a bit more debugging messages.

Signed-off-by: Vincent Liu <shuntian.liu2@cloud.com>
@Vincent-lau Vincent-lau added this pull request to the merge queue Nov 21, 2024
Merged via the queue into xapi-project:master with commit 7c62ede Nov 21, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants