exit+ttynew minor fixes
[unix-history] / usr / src / sys / kern / kern_physio.c
index 7851aa9..478323c 100644 (file)
@@ -1,4 +1,4 @@
-/*     kern_physio.c   3.4     %H%     */
+/*     kern_physio.c   3.12    %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -350,6 +350,7 @@ daddr_t blkno;
        if (bp->b_dev == NODEV)
                goto done;
        /* INLINE EXPANSION OF bunhash(bp) */
        if (bp->b_dev == NODEV)
                goto done;
        /* INLINE EXPANSION OF bunhash(bp) */
+       (void) spl6();
        i = BUFHASH(dbtofsb(bp->b_blkno));
        x = bp - buf;
        if (bufhash[i] == x) {
        i = BUFHASH(dbtofsb(bp->b_blkno));
        x = bp - buf;
        if (bufhash[i] == x) {
@@ -364,6 +365,7 @@ daddr_t blkno;
                panic("getblk");
        }
 done:
                panic("getblk");
        }
 done:
+       (void) spl0();
        /* END INLINE EXPANSION */
        bp->b_flags = B_BUSY;
        bp->b_back->b_forw = bp->b_forw;
        /* END INLINE EXPANSION */
        bp->b_flags = B_BUSY;
        bp->b_back->b_forw = bp->b_forw;
@@ -387,8 +389,7 @@ done:
 struct buf *
 geteblk()
 {
 struct buf *
 geteblk()
 {
-       register struct buf *bp, *dp, *ep;
-       register int i, x;
+       register struct buf *bp, *dp;
 
 loop:
        (void) spl6();
 
 loop:
        (void) spl6();
@@ -423,23 +424,26 @@ bunhash(bp)
        register struct buf *bp;
 {
        register struct buf *ep;
        register struct buf *bp;
 {
        register struct buf *ep;
-       register int i, x;
+       register int i, x, s;
 
        if (bp->b_dev == NODEV)
                return;
 
        if (bp->b_dev == NODEV)
                return;
+       s = spl6();
        i = BUFHASH(dbtofsb(bp->b_blkno));
        x = bp - buf;
        if (bufhash[i] == x) {
                bufhash[i] = bp->b_hlink;
        i = BUFHASH(dbtofsb(bp->b_blkno));
        x = bp - buf;
        if (bufhash[i] == x) {
                bufhash[i] = bp->b_hlink;
-               return;
+               goto ret;
        }
        for (ep = &buf[bufhash[i]]; ep != &buf[-1];
            ep = &buf[ep->b_hlink])
                if (ep->b_hlink == x) {
                        ep->b_hlink = bp->b_hlink;
        }
        for (ep = &buf[bufhash[i]]; ep != &buf[-1];
            ep = &buf[ep->b_hlink])
                if (ep->b_hlink == x) {
                        ep->b_hlink = bp->b_hlink;
-                       return;
+                       goto ret;
                }
        panic("bunhash");
                }
        panic("bunhash");
+ret:
+       splx(s);
 }
 
 /*
 }
 
 /*
@@ -488,6 +492,8 @@ register struct buf *bp;
 {
        register int s;
 
 {
        register int s;
 
+       if (bp->b_flags & B_DONE)
+               panic("dup iodone");
        bp->b_flags |= B_DONE;
        if (bp->b_flags & B_DIRTY) {
                if (bp->b_flags & B_ERROR)
        bp->b_flags |= B_DONE;
        if (bp->b_flags & B_DIRTY) {
                if (bp->b_flags & B_ERROR)
@@ -501,6 +507,7 @@ register struct buf *bp;
                if (bswlist.b_flags & B_WANTED)
                        wakeup((caddr_t)&proc[2]);
                splx(s);
                if (bswlist.b_flags & B_WANTED)
                        wakeup((caddr_t)&proc[2]);
                splx(s);
+               return;
        }
        if (bp->b_flags&B_ASYNC)
                brelse(bp);
        }
        if (bp->b_flags&B_ASYNC)
                brelse(bp);
@@ -585,14 +592,14 @@ swap(p, dblkno, addr, nbytes, rdflg, flag, dev, pfcent)
                bp->b_bcount = c;
                bp->b_blkno = dblkno;
                bp->b_dev = dev;
                bp->b_bcount = c;
                bp->b_blkno = dblkno;
                bp->b_dev = dev;
-               if (dev == swapdev)
-                       bp->b_blkno += swplo;
+               if (flag & B_DIRTY) {
+                       swpf[bp - swbuf] = pfcent;
+                       swsize[bp - swbuf] = nbytes;
+               }
                (*bdevsw[major(dev)].d_strategy)(bp);
                if (flag & B_DIRTY) {
                        if (c < nbytes)
                                panic("big push");
                (*bdevsw[major(dev)].d_strategy)(bp);
                if (flag & B_DIRTY) {
                        if (c < nbytes)
                                panic("big push");
-                       swsize[bp - swbuf] = nbytes;
-                       swpf[bp - swbuf] = pfcent;
                        return;
                }
                (void) spl6();
                        return;
                }
                (void) spl6();
@@ -642,7 +649,7 @@ swkill(p, rout)
         * done by user) after killing it so noone will try
         * to swap it out.
         */
         * done by user) after killing it so noone will try
         * to swap it out.
         */
-       psignal(p, SIGKIL);
+       psignal(p, SIGKILL);
        p->p_flag |= SULOCK;
 }
 
        p->p_flag |= SULOCK;
 }