From: Nicolas Thery Date: Mon, 28 Jan 2008 07:19:06 +0000 (+0000) Subject: Fix spurious "softdep_deallocate_dependencies: dangling deps" panic occuring X-Git-Tag: v2.0.1~1250 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/389ee6be5ec057aa7edea264f883337feda155d3 Fix spurious "softdep_deallocate_dependencies: dangling deps" panic occuring on low memory condition. Add assertion to catch similar bugs automagically. Reported-by: Peter Avalos Reviewed-by: Matthew Dillon --- diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index f2d2186893..d18344394f 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -12,7 +12,7 @@ * John S. Dyson. * * $FreeBSD: src/sys/kern/vfs_bio.c,v 1.242.2.20 2003/05/28 18:38:10 alc Exp $ - * $DragonFly: src/sys/kern/vfs_bio.c,v 1.96 2008/01/10 07:34:01 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_bio.c,v 1.97 2008/01/28 07:19:06 nth Exp $ */ /* @@ -1085,7 +1085,8 @@ brelse(struct buf *bp) if (bp->b_flags & (B_DELWRI | B_LOCKED)) { bp->b_flags &= ~B_RELBUF; } else if (vm_page_count_severe()) { - buf_deallocate(bp); + if (LIST_FIRST(&bp->b_dep) != NULL) + buf_deallocate(bp); if (bp->b_flags & (B_DELWRI | B_LOCKED)) bp->b_flags &= ~B_RELBUF; else diff --git a/sys/sys/buf2.h b/sys/sys/buf2.h index b91f04b698..ed2a8502f1 100644 --- a/sys/sys/buf2.h +++ b/sys/sys/buf2.h @@ -37,7 +37,7 @@ * * @(#)buf.h 8.9 (Berkeley) 3/30/95 * $FreeBSD: src/sys/sys/buf.h,v 1.88.2.10 2003/01/25 19:02:23 dillon Exp $ - * $DragonFly: src/sys/sys/buf2.h,v 1.20 2007/11/07 00:46:38 dillon Exp $ + * $DragonFly: src/sys/sys/buf2.h,v 1.21 2008/01/28 07:19:06 nth Exp $ */ #ifndef _SYS_BUF2_H_ @@ -195,11 +195,15 @@ buf_dep_init(struct buf *bp) LIST_INIT(&bp->b_dep); } +/* + * Precondition: the buffer has some dependencies. + */ static __inline void buf_deallocate(struct buf *bp) { struct bio_ops *ops = bp->b_ops; + KKASSERT(! LIST_EMPTY(&bp->b_dep)); if (ops) ops->io_deallocate(bp); }