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

op: fix 'already borrowed' panic #39

merged 2 commits into from
Aug 10, 2021

Conversation

carllerche
Copy link
Member

When failing to submit operation to kernel, an "already borrowed" panic
can happen. This ensures the RefCel borrow guard is dropped before
dropping resources.

Fixes #35

When failing to submit operation to kernel, an "already borrowed" panic
can happen. This ensures the `RefCel` borrow guard is dropped before
dropping resources.
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.

@carllerche carllerche merged commit 2c9fbea into master Aug 10, 2021
@carllerche carllerche deleted the fix-35 branch August 10, 2021 14:15
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.

Random panics at closing file descriptors
2 participants