tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kassert in vfs_bio.c



On Wed, Jun 25, 2008 at 01:17:20PM +0200, Christoph Egger wrote:
> > I'm running a kernel with the additionnal checks in attachment, but
> > they didn't detect anything wrong before the above panic.
> 
> Forgot to attach diff ?

Yes, sorry. Here it is.

> 
> > Any idea ? It could be related to running domUs, or vnd (the virtual disks
> > are backed by files, so the domUs access their data though
> > xbdback_xenbus -> vnd -> file in a ffs). I've a test box
> > with the same XEN3_DOM0 kernel which didn't panic this way yet, but it's
> > not running any domU.
> >
> > any idea ?
> 
> Does this help?
> http://www.netbsd.org/~cegger/xen_xbd.diff

No. I'm already running with it. And the problem here is that the BC_BUSY
flag is set when it should not, not the opposite.

-- 
Manuel Bouyer, LIP6, Universite Paris VI.           
Manuel.Bouyer%lip6.fr@localhost
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: vfs_bio.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_bio.c,v
retrieving revision 1.205
diff -u -r1.205 vfs_bio.c
--- vfs_bio.c   17 Jun 2008 19:14:14 -0000      1.205
+++ vfs_bio.c   25 Jun 2008 10:48:32 -0000
@@ -309,6 +309,7 @@
 binsheadfree(buf_t *bp, struct bqueue *dp)
 {
 
+       KASSERT(!ISSET(bp->b_cflags, BC_PRIV));
        KASSERT(bp->b_freelistindex == -1);
        TAILQ_INSERT_HEAD(&dp->bq_queue, bp, b_freelist);
        dp->bq_bytes += bp->b_bufsize;
@@ -319,6 +320,7 @@
 binstailfree(buf_t *bp, struct bqueue *dp)
 {
 
+       KASSERT(!ISSET(bp->b_cflags, BC_PRIV));
        KASSERT(bp->b_freelistindex == -1);
        TAILQ_INSERT_TAIL(&dp->bq_queue, bp, b_freelist);
        dp->bq_bytes += bp->b_bufsize;
@@ -332,6 +334,7 @@
        int bqidx = bp->b_freelistindex;
 
        KASSERT(mutex_owned(&bufcache_lock));
+       KASSERT(!ISSET(bp->b_cflags, BC_PRIV));
 
        KASSERT(bqidx != -1);
        dp = &bufqueues[bqidx];
@@ -972,6 +975,7 @@
        KASSERT(mutex_owned(&bufcache_lock));
        KASSERT(!cv_has_waiters(&bp->b_done));
        KASSERT(bp->b_refcnt > 0);
+       KASSERT(!ISSET(bp->b_cflags, BC_PRIV));
        
        SET(bp->b_cflags, set);
 
@@ -1314,6 +1318,7 @@
        if ((bp = TAILQ_FIRST(&bufqueues[BQ_AGE].bq_queue)) != NULL ||
            (bp = TAILQ_FIRST(&bufqueues[BQ_LRU].bq_queue)) != NULL) {
                KASSERT(!ISSET(bp->b_cflags, BC_BUSY));
+               KASSERT(!ISSET(bp->b_cflags, BC_PRIV));
                bremfree(bp);
 
                /* Buffer is no longer on free lists. */
@@ -1964,6 +1969,7 @@
        const int b_read = mbp->b_flags & B_READ;
        struct vnode *vp = mbp->b_vp;
 
+       KASSERT(!ISSET(bp->b_cflags, BC_PRIV));
        KASSERT(mbp->b_bcount >= offset + size);
        bp->b_vp = vp;
        bp->b_objlock = mbp->b_objlock;


Home | Main Index | Thread Index | Old Index