From: Amit Shah Date: Mon, 15 Apr 2013 02:30:15 +0000 (+0930) Subject: virtio: console: replace EMFILE with EBUSY for already-open port X-Git-Tag: v3.10-rc1~118^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=74ff582cd65ad01c45f1971feac28f23b7eb2687;p=profile%2Fcommon%2Fkernel-common.git virtio: console: replace EMFILE with EBUSY for already-open port Returning EMFILE (process has too many open files) is incorrect to indicate a port is already open by another process. Use EBUSY for that. This does change what we report to userspace, but I believe userspace can look at it this way: it gets EBUSY, a new error code, instead of EMFILE. It's still an error, and that's not changing. Reported-by: Mateusz Guzik Signed-off-by: Amit Shah Signed-off-by: Rusty Russell --- diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index f4f31fe..5ee7765 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1036,7 +1036,7 @@ static int port_fops_open(struct inode *inode, struct file *filp) spin_lock_irq(&port->inbuf_lock); if (port->guest_connected) { spin_unlock_irq(&port->inbuf_lock); - ret = -EMFILE; + ret = -EBUSY; goto out; }