From 606af2d7c2a1f391d8d7f6850bd6685a2a887965 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 16 Sep 2010 10:53:13 +0200 Subject: [PATCH] - Small fix to virtio_console poll fix from upstream review --- kernel.spec | 3 +++ linux-2.6.35.4-virtio_console-fix-poll.patch | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/kernel.spec b/kernel.spec index f44f98d12..2b49341ce 100644 --- a/kernel.spec +++ b/kernel.spec @@ -1906,6 +1906,9 @@ fi # || || %changelog +* Thu Sep 16 2010 Hans de Goede +- Small fix to virtio_console poll fix from upstream review + * Wed Sep 15 2010 Hans de Goede - virtio_console: Fix poll/select blocking even though there is data to read diff --git a/linux-2.6.35.4-virtio_console-fix-poll.patch b/linux-2.6.35.4-virtio_console-fix-poll.patch index ff46eb41e..b87bdf077 100644 --- a/linux-2.6.35.4-virtio_console-fix-poll.patch +++ b/linux-2.6.35.4-virtio_console-fix-poll.patch @@ -1,4 +1,4 @@ -Subject: virtio_console: Fix poll blocking even though there is data to read (version 2) +Subject: virtio_console: Fix poll blocking even though there is data to read From: Hans de Goede I found this while working on a Linux agent for spice, the symptom I was @@ -10,9 +10,9 @@ read won't block. However if an application reads enough bytes from inbuf through port_fops_read, to empty the current port->inbuf, port->inbuf will be NULL even though there may be buffers left in the virtqueue. -This causes poll() to block even though there is data ready to be read, this -patch fixes this by using port_has_data(port) instead of the -port->inbuf != NULL check. +This causes poll() to block even though there is data to be read, this patch +fixes this by using the alredy defined will_read_block utility function +instead of the port->inbuf != NULL check. Signed-off-By: Hans de Goede diff -up linux-2.6.35.x86_64/drivers/char/virtio_console.c~ linux-2.6.35.x86_64/drivers/char/virtio_console.c @@ -23,7 +23,7 @@ diff -up linux-2.6.35.x86_64/drivers/char/virtio_console.c~ linux-2.6.35.x86_64/ ret = 0; - if (port->inbuf) -+ if (port_has_data(port)) ++ if (!will_read_block(port)) ret |= POLLIN | POLLRDNORM; if (!will_write_block(port)) ret |= POLLOUT;