Author: marcel
Date: Sat Jul 26 15:46:41 2014
New Revision: 269126
URL: http://svnweb.freebsd.org/changeset/base/269126

Log:
  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.

Modified:
  head/sys/kern/tty.c

Modified: head/sys/kern/tty.c
==============================================================================
--- head/sys/kern/tty.c Sat Jul 26 15:33:20 2014        (r269125)
+++ head/sys/kern/tty.c Sat Jul 26 15:46:41 2014        (r269126)
@@ -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);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to