1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

Kernel: Allow WorkQueue items allocation failures propagation

In most cases it's safe to abort the requested operation and go forward,
however, in some places it's not clear yet how to handle these failures,
therefore, we use the MUST() wrapper to force a kernel panic for now.
This commit is contained in:
Liav A 2022-03-06 22:07:04 +02:00 committed by Linus Groh
parent 02566d8091
commit 1462211ccf
9 changed files with 75 additions and 19 deletions

View file

@ -33,7 +33,7 @@ void NVMeInterruptQueue::complete_current_request(u16 status)
{
VERIFY(m_request_lock.is_locked());
g_io_work->queue([this, status]() {
auto work_item_creation_result = g_io_work->try_queue([this, status]() {
SpinlockLocker lock(m_request_lock);
auto current_request = m_current_request;
m_current_request.clear();
@ -53,5 +53,10 @@ void NVMeInterruptQueue::complete_current_request(u16 status)
current_request->complete(AsyncDeviceRequest::Success);
return;
});
if (work_item_creation_result.is_error()) {
auto current_request = m_current_request;
m_current_request.clear();
current_request->complete(AsyncDeviceRequest::OutOfMemory);
}
}
}