-
Notifications
You must be signed in to change notification settings - Fork 851
CID1508860: double lock confusion #10443
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
Conversation
iocore/aio/AIO.cc
Outdated
| num_requests--; | ||
| current_req->queued--; | ||
| ink_atomic_increment((int *)¤t_req->pending, 1); | ||
| ink_atomic_increment((int *)&my_aio_req->pending, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could get rid of the C-style cast.
| @@ -423,17 +423,15 @@ ink_aio_thread_num_set(int thread_num) | |||
| void * | |||
| AIOThreadInfo::aio_thread_main(AIOThreadInfo *thr_info) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not directly relevant to this PR, but thr_info is redundant, it's the same as the this pointer in this function.
|
The AIO code seems scary bad in general. |
iocore/aio/AIO.cc
Outdated
| ink_atomic_increment(¤t_req->requests_queued, -1); | ||
| ink_atomic_increment(&my_aio_req->requests_queued, -1); | ||
| #ifdef AIO_STATS | ||
| ink_atomic_increment((int *)¤t_req->pending, -1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It lives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I missed some inside the conditional code. Thanks!
| ink_atomic_increment((int *)¤t_req->pending, 1); | ||
| ink_atomic_increment((int *)&my_aio_req->pending, 1); | ||
| #endif | ||
| ink_mutex_release(&my_aio_req->aio_mutex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Releasing early looks OK.
* asf/master: (30 commits) add conveinience function to lookup name->IntType* (apache#10474) cmake: bigobj subdir has executables, not plugins (apache#10481) cmake: compile jsonrpc_protocol with -fPIC (apache#10478) Make sure new metrics are always considered (apache#10445) Refactor and rename restart metrics (apache#10472) Fix the SNI and HOST parsing properly (apache#10480) slice/Data.h: CID 1508924: Uninitialized scalar field (apache#10470) CID 1508882: initialize pointer (apache#10469) CID-1512726: Mute coverity, use explicit check for iterator use past end (apache#10467) Fix Coverity issue in inliner plugin. (apache#10442) Set the proper variable when find_package fails to find the package (apache#10468) CID1508860: double lock confusion (apache#10443) Stop using functions that are unavailable on the latest quiche (apache#10447) Add allow-plain server ports attribute (apache#9574) [Fuzzing] move build.sh in trafficserver (apache#10466) Some sort of "fix" to mute coverity. (apache#10451) CID-1512733: Fix coverity issue (apache#10452) Fix cmake autooptions (apache#10456) Cmake presets (apache#10457) This fixes CID 1518257 (apache#10404) ...
I wonder if coverity is confused by following the
current_reqpointer for the unlock call vsmy_aio_reqfor the lock. I removed thecurrent_reqvariable as it isn't necessary.I also moved the release call before incrementing metrics since the lock doesn't need to be held for that.
Fixes #10430