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
This commit is contained in:
parent
4f56243aad
commit
e046e8e680
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=311996
@ -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. */
|
||||
|
Loading…
Reference in New Issue
Block a user