diff --git a/src/sync/wait_queue.rs b/src/sync/wait_queue.rs index 003e530270..7e2c21e2df 100644 --- a/src/sync/wait_queue.rs +++ b/src/sync/wait_queue.rs @@ -2,7 +2,7 @@ use alloc::collections::VecDeque; use syscall::{EAGAIN, EINTR}; use crate::{ - sync::{CleanLockToken, LockToken, Mutex, MutexGuard, WaitCondition, L1, L2}, + sync::{CleanLockToken, LockToken, Mutex, MutexGuard, WaitCondition, L1, L2, L3}, syscall::{ error::{Error, Result, EINVAL}, usercopy::UserSliceWo, @@ -11,7 +11,7 @@ use crate::{ #[derive(Debug)] pub struct WaitQueue { - incoming: Mutex>, + incoming: Mutex>, outgoing: Mutex>, pub condition: WaitCondition, } @@ -58,17 +58,16 @@ impl WaitQueue { return Ok(bytes_copied); } - let incoming_guard = unsafe { self.incoming.relock(token.token()) }; - let (mut incoming, mut split_token) = incoming_guard.into_split(); + let mut incoming = self.incoming.lock(token.token()); if incoming.is_empty() { if block { - drop(outgoing); + drop(incoming); // SAFETY: Uses wait_inner because this inner is L2. It's guaranteed there's no other // lock held at this point because clean token is provided from caller. if !self .condition - .wait_inner(incoming, reason, &mut split_token) + .wait_inner(outgoing, reason, &mut token.token()) { return Err(Error::new(EINTR)); }