From 24f97f9593fdc317d1617b7e9ea90d323b518589 Mon Sep 17 00:00:00 2001 From: Sebastian Sumpf Date: Tue, 6 May 2014 17:00:34 +0200 Subject: [PATCH] usb_drv: Check SCSI command queue state In case the storage-entry point dispatches more then one packet, wait for the previous command to finish before setting a new request. This has to be done because the 'queuecommand' does actually *not* queue things, but can only handle one request at the time. Fix #1143 --- repos/dde_linux/src/lib/usb/storage/storage.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/repos/dde_linux/src/lib/usb/storage/storage.cc b/repos/dde_linux/src/lib/usb/storage/storage.cc index 28c0076e2..6a8b27443 100644 --- a/repos/dde_linux/src/lib/usb/storage/storage.cc +++ b/repos/dde_linux/src/lib/usb/storage/storage.cc @@ -116,8 +116,9 @@ class Storage_device : public Genode::List::Element, cmnd->request = &req; /* send command to host driver */ - if (_sdev->host->hostt->queuecommand(_sdev->host, cmnd)) { - throw Request_congestion(); + while((_sdev->host->hostt->queuecommand(_sdev->host, cmnd)) != 0) { + Server::wait_and_dispatch_one_signal(); + __wait_event(); } } @@ -211,5 +212,6 @@ void Storage_device::_async_done(struct scsi_cmnd *cmnd) device->ack_packet(*packet); Genode::destroy(Genode::env()->heap(), packet); + scsi_free_buffer(cmnd); _scsi_free_command(cmnd); }