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

op: fix 'already borrowed' panic #39

Merged
merged 2 commits into from
Aug 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/driver/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ impl<T> Op<T> {
F: FnOnce() -> squeue::Entry,
{
driver::CURRENT.with(|inner_rc| {
let mut inner = inner_rc.borrow_mut();
let inner = &mut *inner;
let mut inner_ref = inner_rc.borrow_mut();
let inner = &mut *inner_ref;

// If the submission queue is full, flush it to the kernel
if inner.uring.submission().is_full() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inner.submit()?; at line 70.
Doesn't it meet the same problem?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't because the Op instance hasn't been created yet.

Expand All @@ -85,9 +85,12 @@ impl<T> Op<T> {
}
}

// Submit the new operation
inner.submit()?;

// Submit the new operation. At this point, the operation has been
// pushed onto the queue and the tail pointer has been updated, so
// the submission entry is visible to the kernel. If there is an
// error here (probably EAGAIN), we still return the operation. A
// future `io_uring_enter` will fully submit the event.
let _ = inner.submit();
Ok(op)
})
}
Expand Down