Skip to content
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

Possible data race error due to missing locking #608

Open
anson-lo opened this issue Dec 14, 2021 · 1 comment
Open

Possible data race error due to missing locking #608

anson-lo opened this issue Dec 14, 2021 · 1 comment
Milestone

Comments

@anson-lo
Copy link

Hi, it seems treq->finished = false;(Line 279) is missing locking while other places (Line 289 and Line 264) are all locked.

struct timespec ts;
treq->finished = false;
result = pfn(c, req, req_async_lock_callback);
assert(result >= 0);
if (result == OCF_LOCK_ACQUIRED) {
return true;
}
pthread_mutex_lock(&treq->completion_mutex);
while (!treq->finished && !*finish) {
pthread_cond_wait(&treq->completion,
&treq->completion_mutex);
}
pthread_mutex_unlock(&treq->completion_mutex);

pthread_mutex_lock(&treq->completion_mutex);
treq->finished = true;
pthread_cond_signal(&treq->completion);
pthread_mutex_unlock(&treq->completion_mutex);

@karolinavelkaja
Copy link

Hello, thank you for finding this! We will take care of this.

@jfckm jfckm added this to the Future milestone Mar 7, 2022
@jfckm jfckm modified the milestones: Future, 22.9 Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants