qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] rng backend: open backend in blocking mode
@ 2013-04-01  9:25 Amit Shah
  2013-04-01 14:02 ` Anthony Liguori
  0 siblings, 1 reply; 7+ messages in thread
From: Amit Shah @ 2013-04-01  9:25 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Amit Shah, qemu list

Opening backends in non-blocking mode isn't necessary, we don't do
anything while waiting for data.

This also excuses us from checking for EAGAIN, which for the default
random backend, is a very common return error type.  Starting the guest
with '-device virtio-rng-pci', issuing a 'cat /dev/hwrng' in the guest
while also doing 'cat /dev/random' on the host causes

backends/rng-random.c:44:entropy_available: assertion failed: (len != -1)

without this fix.

Reported-by: yunpingzheng <yunzheng@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 backends/rng-random.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backends/rng-random.c b/backends/rng-random.c
index acd20af..252139b 100644
--- a/backends/rng-random.c
+++ b/backends/rng-random.c
@@ -74,7 +74,7 @@ static void rng_random_opened(RngBackend *b, Error **errp)
         error_set(errp, QERR_INVALID_PARAMETER_VALUE,
                   "filename", "a valid filename");
     } else {
-        s->fd = qemu_open(s->filename, O_RDONLY | O_NONBLOCK);
+        s->fd = qemu_open(s->filename, O_RDONLY);
 
         if (s->fd == -1) {
             error_set(errp, QERR_OPEN_FILE_FAILED, s->filename);
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-04-08  6:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-01  9:25 [Qemu-devel] [PATCH 1/1] rng backend: open backend in blocking mode Amit Shah
2013-04-01 14:02 ` Anthony Liguori
2013-04-02 10:35   ` Amit Shah
2013-04-02 12:52     ` Anthony Liguori
2013-04-03  6:28       ` Amit Shah
2013-04-03 20:08         ` Anthony Liguori
2013-04-08  6:09           ` Amit Shah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).