svn commit: r206605 - stable/8/sys/kern
John Baldwin
jhb at FreeBSD.org
Wed Apr 14 15:33:15 UTC 2010
Author: jhb
Date: Wed Apr 14 15:33:15 2010
New Revision: 206605
URL: http://svn.freebsd.org/changeset/base/206605
Log:
MFC 205886:
Defer freeing a kevent list until after dropping kqueue locks.
Modified:
stable/8/sys/kern/kern_event.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
Modified: stable/8/sys/kern/kern_event.c
==============================================================================
--- stable/8/sys/kern/kern_event.c Wed Apr 14 15:29:32 2010 (r206604)
+++ stable/8/sys/kern/kern_event.c Wed Apr 14 15:33:15 2010 (r206605)
@@ -1203,7 +1203,7 @@ static int
kqueue_expand(struct kqueue *kq, struct filterops *fops, uintptr_t ident,
int waitok)
{
- struct klist *list, *tmp_knhash;
+ struct klist *list, *tmp_knhash, *to_free;
u_long tmp_knhashmask;
int size;
int fd;
@@ -1211,6 +1211,7 @@ kqueue_expand(struct kqueue *kq, struct
KQ_NOTOWNED(kq);
+ to_free = NULL;
if (fops->f_isfd) {
fd = ident;
if (kq->kq_knlistsize <= fd) {
@@ -1222,13 +1223,13 @@ kqueue_expand(struct kqueue *kq, struct
return ENOMEM;
KQ_LOCK(kq);
if (kq->kq_knlistsize > fd) {
- free(list, M_KQUEUE);
+ to_free = list;
list = NULL;
} else {
if (kq->kq_knlist != NULL) {
bcopy(kq->kq_knlist, list,
kq->kq_knlistsize * sizeof list);
- free(kq->kq_knlist, M_KQUEUE);
+ to_free = kq->kq_knlist;
kq->kq_knlist = NULL;
}
bzero((caddr_t)list +
@@ -1250,11 +1251,12 @@ kqueue_expand(struct kqueue *kq, struct
kq->kq_knhash = tmp_knhash;
kq->kq_knhashmask = tmp_knhashmask;
} else {
- free(tmp_knhash, M_KQUEUE);
+ to_free = tmp_knhash;
}
KQ_UNLOCK(kq);
}
}
+ free(to_free, M_KQUEUE);
KQ_NOTOWNED(kq);
return 0;
More information about the svn-src-stable-8
mailing list