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

rt: Fix data race #146

Merged
merged 1 commit into from
Oct 24, 2022
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
16 changes: 4 additions & 12 deletions src/driver/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,16 @@ where
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() {
inner.submit()?;
}

// Create the operation
let mut op = Op::new(data, inner, inner_rc);

// Configure the SQE
let sqe = f(op.data.as_mut().unwrap()).user_data(op.index as _);

{
let mut sq = inner.uring.submission();

// Push the new operation
if unsafe { sq.push(&sqe).is_err() } {
unimplemented!("when is this hit?");
}
// Push the new operation
while unsafe { inner.uring.submission().push(&sqe).is_err() } {
// If the submission queue is full, flush it to the kernel
inner.submit()?;
}

Ok(op)
Expand Down