PIPE - Fix a panic introduced by the last commit.
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 8 Sep 2009 18:28:14 +0000 (11:28 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 8 Sep 2009 18:28:14 +0000 (11:28 -0700)
* Forgot to release a token on the Re-tests.

Reported-by: Tobias Weingartner <weingart@tepid.org>
sys/kern/sys_pipe.c

index 67eea50..bc7812a 100644 (file)
@@ -597,8 +597,10 @@ pipe_read(struct file *fp, struct uio *uio, struct ucred *cred, int fflags)
                 * Retest EOF - acquiring a new token can temporarily release
                 * tokens already held.
                 */
-               if (rpipe->pipe_state & PIPE_REOF)
+               if (rpipe->pipe_state & PIPE_REOF) {
+                       lwkt_reltoken(&wlock);
                        break;
+               }
 
                /*
                 * If there is no more to read in the pipe, reset its
@@ -908,6 +910,7 @@ pipe_write(struct file *fp, struct uio *uio, struct ucred *cred, int fflags)
                 * tokens already held.
                 */
                if (wpipe->pipe_state & PIPE_WEOF) {
+                       lwkt_reltoken(&rlock);
                        error = EPIPE;
                        break;
                }