svn commit: r311996 - head/sys/kern
Ian Lepore
ian at FreeBSD.org
Thu Jan 12 21:18:45 UTC 2017
Author: ian
Date: Thu Jan 12 21:18:43 2017
New Revision: 311996
URL: https://svnweb.freebsd.org/changeset/base/311996
Log:
Restructure the tty_drain loop so that device-busy is checked one more time
after tty_timedwait() returns an error only if the error is EWOULDBLOCK;
other errors cause an immediate return. This fixes the case of the tty
disappearing while in tty_drain().
Reported by: pho
Modified:
head/sys/kern/tty.c
Modified: head/sys/kern/tty.c
==============================================================================
--- head/sys/kern/tty.c Thu Jan 12 20:26:02 2017 (r311995)
+++ head/sys/kern/tty.c Thu Jan 12 21:18:43 2017 (r311996)
@@ -166,11 +166,9 @@ tty_drain(struct tty *tp, int leaving)
return (error);
ttydevsw_outwakeup(tp);
error = tty_timedwait(tp, &tp->t_outwait, hz / 10);
- if (timeout_at == 0 && error == EWOULDBLOCK)
- error = 0;
- if (error != EWOULDBLOCK)
- continue;
- if (getsbinuptime() < timeout_at)
+ if (error != 0 && error != EWOULDBLOCK)
+ return (error);
+ else if (timeout_at == 0 || getsbinuptime() < timeout_at)
error = 0;
else if (leaving && ttyoutq_bytesused(&tp->t_outq) < bytes) {
/* In close, making progress, grant an extra second. */
More information about the svn-src-all
mailing list