Don't return ERESTART when the device is gone. In ttydev_leave() ERESTART

is the indication that draining got interrupted due to a revoke(2) and
that tty_drain() is to be called again for draining to complete. If the
device is flagged as gone, then waiting/draining is not possible. Only
return ERESTART when waiting is still possible.

Obtained from:	Juniper Networks, Inc.
This commit is contained in:
Marcel Moolenaar 2014-07-26 15:46:41 +00:00
parent 02b6306fb0
commit be836fab6c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=269126

View File

@ -1370,14 +1370,14 @@ tty_wait(struct tty *tp, struct cv *cv)
error = cv_wait_sig(cv, tp->t_mtx);
/* Restart the system call when we may have been revoked. */
if (tp->t_revokecnt != revokecnt)
return (ERESTART);
/* Bail out when the device slipped away. */
if (tty_gone(tp))
return (ENXIO);
/* Restart the system call when we may have been revoked. */
if (tp->t_revokecnt != revokecnt)
return (ERESTART);
return (error);
}