The knote objects attached by peer will still be linked in our list

if we are closed before the peer.  So, remove them.  It didn't matter
when pipe objects are directly returned to pool, but nowadays they
are cached.
This commit is contained in:
enami 2009-02-15 00:07:54 +00:00
parent 845915475d
commit 60ebbc4e81
1 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_pipe.c,v 1.107 2009/02/06 23:04:57 enami Exp $ */
/* $NetBSD: sys_pipe.c,v 1.108 2009/02/15 00:07:54 enami Exp $ */
/*-
* Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.107 2009/02/06 23:04:57 enami Exp $");
__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.108 2009/02/15 00:07:54 enami Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1281,6 +1281,13 @@ pipeclose(struct file *fp, struct pipe *pipe)
ppipe->pipe_peer = NULL;
}
/*
* Any knote objects still left in the list are
* the one attached by peer. Since no one will
* traverse this list, we just clear it.
*/
SLIST_INIT(&pipe->pipe_sel.sel_klist);
KASSERT((pipe->pipe_state & PIPE_LOCKFL) == 0);
mutex_exit(lock);