Date: Wed, 23 Feb 2000 21:56:35 -0800 (PST) From: Matthew Dillon <dillon@apollo.backplane.com> To: Matthew Dillon <dillon@apollo.backplane.com> Cc: Ian Dowse <iedowse@maths.tcd.ie>, nops@maths.tcd.ie, freebsd-current@FreeBSD.ORG, diablo-list@list.bart.nl Subject: Re: ffs_blkfree: freeing free block (was Re: Panic (pmap)) Message-ID: <200002240556.VAA34592@apollo.backplane.com> References: <200002232235.aa22335@salmon.maths.tcd.ie> <200002240227.SAA33299@apollo.backplane.com>
next in thread | previous in thread | raw e-mail | index | archive | help
>>> Ian's test script >>> mount_mfs -T fd1440 none /mnt cd /mnt dd if=/dev/zero bs=4k of=test seek=1036 count=1 dd if=/dev/zero bs=4k of=test1 count=1 dd if=/dev/zero bs=4k of=test2 rm test1 dd if=/dev/zero bs=4k of=test seek=8000 count=1 echo > test <<<<<<<<<<<<<<<<<<<<<<<<< Oops, here's a new version of my patch. This one survives Ian's test script. I was improperly blowing away an 'error' field. -Matt Index: ffs_balloc.c =================================================================== RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_balloc.c,v retrieving revision 1.25 diff -u -r1.25 ffs_balloc.c --- ffs_balloc.c 2000/01/11 08:27:00 1.25 +++ ffs_balloc.c 2000/02/24 05:44:59 @@ -77,6 +77,7 @@ ufs_daddr_t newb, *bap, pref; int deallocated, osize, nsize, num, i, error; ufs_daddr_t *allocib, *blkp, *allocblk, allociblk[NIADDR + 1]; + int unwindidx = -1; struct proc *p = curproc; /* XXX */ vp = ap->a_vp; @@ -272,6 +273,8 @@ } } bap[indirs[i - 1].in_off] = nb; + if (allocib == NULL && unwindidx < 0) + unwindidx = i - 1; /* * If required, write synchronously, otherwise use * delayed write. @@ -349,8 +352,28 @@ ffs_blkfree(ip, *blkp, fs->fs_bsize); deallocated += fs->fs_bsize; } - if (allocib != NULL) + if (allocib != NULL) { *allocib = 0; + } else if (unwindidx >= 0) { + int r; + + r = bread(vp, indirs[unwindidx].in_lbn, + (int)fs->fs_bsize, NOCRED, &bp); + if (r) { + panic("Could not unwind indirect block, error %d", error); + brelse(bp); + } else { + bap = (ufs_daddr_t *)bp->b_data; + bap[indirs[unwindidx].in_off] = 0; + if (flags & B_SYNC) { + bwrite(bp); + } else { + if (bp->b_bufsize == fs->fs_bsize) + bp->b_flags |= B_CLUSTEROK; + bdwrite(bp); + } + } + } if (deallocated) { #ifdef QUOTA /* To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200002240556.VAA34592>