]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
virtio: console: Unblock poll on port hot-unplug
authorAmit Shah <amit.shah@redhat.com>
Thu, 2 Sep 2010 12:41:44 +0000 (18:11 +0530)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 21 Oct 2010 07:14:01 +0000 (17:44 +1030)
When a port is hot-unplugged while an app is blocked on poll(), unblock
the poll() and return.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/char/virtio_console.c

index 92f1f65d57a923c338d117f036af30f0af054963..47b710ca4ab3320d1c4b7bea9fdb1af33df48984 100644 (file)
@@ -663,6 +663,10 @@ static unsigned int port_fops_poll(struct file *filp, poll_table *wait)
        port = filp->private_data;
        poll_wait(filp, &port->waitqueue, wait);
 
+       if (!port->guest_connected) {
+               /* Port got unplugged */
+               return POLLHUP;
+       }
        ret = 0;
        if (!will_read_block(port))
                ret |= POLLIN | POLLRDNORM;