diff options
author | trasz <trasz@FreeBSD.org> | 2009-02-06 17:14:07 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2009-02-06 17:14:07 +0000 |
commit | e0aa6f81f98bad4fc91bab83c82424bcfd95feed (patch) | |
tree | af07407596266b880d46d691dc6fb197deb533d9 /sys/ufs/ffs | |
parent | 974ef5e843acb86e0f1c74876f81648171289117 (diff) | |
download | FreeBSD-src-e0aa6f81f98bad4fc91bab83c82424bcfd95feed.zip FreeBSD-src-e0aa6f81f98bad4fc91bab83c82424bcfd95feed.tar.gz |
When a device containing mounted UFS filesystem disappears, the type
of devvp becomes VBAD, which UFS incorrectly interprets as snapshot
vnode, which in turns causes panic. Fix it by replacing '!= VCHR'
with '== VREG'.
With this fix in place, you should no longer be able to panic the system
by removing a device with an UFS filesystem mounted from it - assuming
you don't use softupdates.
Reviewed by: kib
Tested by: pho
Approved by: rwatson (mentor)
Sponsored by: FreeBSD Foundation
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r-- | sys/ufs/ffs/ffs_alloc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index e21a484..4748f68 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -1858,7 +1858,7 @@ ffs_blkfree(ump, fs, devvp, bno, size, inum) struct cdev *dev; cg = dtog(fs, bno); - if (devvp->v_type != VCHR) { + if (devvp->v_type == VREG) { /* devvp is a snapshot */ dev = VTOI(devvp)->i_devvp->v_rdev; cgblkno = fragstoblks(fs, cgtod(fs, cg)); @@ -1903,7 +1903,7 @@ ffs_blkfree(ump, fs, devvp, bno, size, inum) if (size == fs->fs_bsize) { fragno = fragstoblks(fs, cgbno); if (!ffs_isfreeblock(fs, blksfree, fragno)) { - if (devvp->v_type != VCHR) { + if (devvp->v_type == VREG) { UFS_UNLOCK(ump); /* devvp is a snapshot */ brelse(bp); @@ -2056,7 +2056,7 @@ ffs_freefile(ump, fs, devvp, ino, mode) struct cdev *dev; cg = ino_to_cg(fs, ino); - if (devvp->v_type != VCHR) { + if (devvp->v_type == VREG) { /* devvp is a snapshot */ dev = VTOI(devvp)->i_devvp->v_rdev; cgbno = fragstoblks(fs, cgtod(fs, cg)); @@ -2122,7 +2122,7 @@ ffs_checkfreefile(fs, devvp, ino) u_int8_t *inosused; cg = ino_to_cg(fs, ino); - if (devvp->v_type != VCHR) { + if (devvp->v_type == VREG) { /* devvp is a snapshot */ cgbno = fragstoblks(fs, cgtod(fs, cg)); } else { |