Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Aug 2008 14:48:53 GMT
From:      Ed Schouten <ed@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 148191 for review
Message-ID:  <200808231448.m7NEmrpE005996@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=148191

Change 148191 by ed@ed_dull on 2008/08/23 14:48:07

	Because we now properly clean up blocks in the queues, move the
	copy error and tty_gone() check outside the actual copying code.
	Do a similar thing inside ttyoutq to keep them in sync.

Affected files ...

.. //depot/projects/mpsafetty/sys/kern/tty_inq.c#7 edit
.. //depot/projects/mpsafetty/sys/kern/tty_outq.c#8 edit

Differences ...

==== //depot/projects/mpsafetty/sys/kern/tty_inq.c#7 (text+ko) ====

@@ -209,11 +209,6 @@
 			    clen - flen, uio);
 			tty_lock(tp);
 
-			if (tty_gone(tp)) {
-				/* Something went bad - discard this block. */
-				uma_zfree(ttyinq_zone, tib);
-				return (ENXIO);
-			}
 			/* Block can now be readded to the list. */
 			if (ti->ti_quota <= ti->ti_nblocks) {
 				uma_zfree(ttyinq_zone, tib);
@@ -221,8 +216,6 @@
 				TAILQ_INSERT_TAIL(&ti->ti_list, tib, tib_list);
 				ti->ti_nblocks++;
 			}
-			if (error != 0)
-				return (error);
 		} else {
 			char ob[TTYINQ_DATASIZE - 1];
 			atomic_add_long(&ttyinq_nslow, 1);
@@ -238,12 +231,12 @@
 			tty_unlock(tp);
 			error = uiomove(ob, clen - flen, uio);
 			tty_lock(tp);
+		}
 
-			if (error != 0)
-				return (error);
-			if (tty_gone(tp))
-				return (ENXIO);
-		}
+		if (error != 0)
+			return (error);
+		if (tty_gone(tp))
+			return (ENXIO);
 	}
 
 	return (0);

==== //depot/projects/mpsafetty/sys/kern/tty_outq.c#8 (text+ko) ====

@@ -250,8 +250,6 @@
 				STAILQ_INSERT_TAIL(&to->to_list, tob, tob_list);
 				to->to_nblocks++;
 			}
-			if (error != 0)
-				return (error);
 		} else {
 			char ob[TTYOUTQ_DATASIZE - 1];
 			atomic_add_long(&ttyoutq_nslow, 1);
@@ -267,10 +265,9 @@
 			tty_unlock(tp);
 			error = uiomove(ob, clen, uio);
 			tty_lock(tp);
-
-			if (error != 0)
-				return (error);
 		}
+		if (error != 0)
+			return (error);
 	}
 
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808231448.m7NEmrpE005996>