mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 15:32:25 +00:00
fs_rom: make read-packet handling more robust
With the introduction of the CONTENT_CHANGED notifications delivered via the packet stream, the assumption that no more than one READ packet is in flight at all times does no longer hold. If the fs server responds to a CONTENT_CHANGED packet while the fs_rom expects the completion of a read request, the '_update_dataspace' method would prematurely return, leaving the dataspace unpopulated. This patch solves the problem by specifically waiting for the completion of the read request.
This commit is contained in:
parent
0b580628cf
commit
bfcdab6079
@ -269,6 +269,10 @@ class Fs_rom::Rom_session_component :
|
||||
return;
|
||||
}
|
||||
|
||||
/* omit read if file is empty */
|
||||
if (_file_size == 0)
|
||||
return;
|
||||
|
||||
/* read content from file */
|
||||
Tx_source &source = *_fs.tx();
|
||||
while (_file_seek < _file_size) {
|
||||
@ -285,7 +289,13 @@ class Fs_rom::Rom_session_component :
|
||||
source.submit_packet(packet);
|
||||
}
|
||||
|
||||
/* process ack at the global signal handler */
|
||||
/*
|
||||
* Process the global signal handler until we got a response
|
||||
* for the read request (indicated by a change of the seek
|
||||
* position).
|
||||
*/
|
||||
size_t const orig_file_seek = _file_seek;
|
||||
while (_file_seek == orig_file_seek)
|
||||
_env.ep().wait_and_dispatch_one_io_signal();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user