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
os/blestore/NVMEDevice: fix the I/O logic for read #13971
Conversation
4d3d127
to
ed7b015
Compare
This patch is not ready for review, need to be tested. Thanks. |
I have test this pr based on commit f46b327 of master branch. root@node3:ceph(master)$ ceph -s |
@liupan1111 @liuhongtong @yuyuyu101 I think that this patch can solve the rand read crash related issue |
src/os/bluestore/NVMEDevice.cc
Outdated
while (t->return_code > 0) | ||
ioc.cond.wait(l); | ||
while (t->return_code > 0) { | ||
ioc.aio_wait(); |
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.
this isn't a safe check. we may enter the loop while return_code == 0, but before wait other thread change this and signal. at last we are stuck into wait infinitely!
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.
I re-visited the code, and think that it is a safe check and will not cause the issue you mentioned.
std::unique_lock<std::mutex> l(ctx->lock); | ||
ctx->cond.notify_all(); | ||
// read submitted by AIO | ||
if(!task->return_code) { |
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.
why could judge whether is a AIO read by return_code?
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.
From the code. For AIO read, we set the initialized value of return_code to 0.
cdf40c7
to
dceb911
Compare
Aio_submit will submit both aio_read/write, and also there are synchronized read and random read, so we need to handle the read I/O completion in a correct way. Since random read has its own ioc, so the num_reading for ioc will be at most 1, which will be easy to handle in io_complete. And we need only to differentiate whethere it is an aio_read. Also fix the exception logic in command send, make the style consistent. Signed-off-by: optimistyzy <optimistyzy@gmail.com>
Aio_submit will submit both aio_read/write, and also there
are synchronized read and random read, so we need to
handle the read I/O completion in a correct way.
Also fix the exception logic in command send, make the style
consistent.
Signed-off-by: optimistyzy optimistyzy@gmail.com