svn commit: r189229 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb ufs/ffs

Edward Tomasz Napierala trasz at FreeBSD.org
Sun Mar 1 03:20:37 PST 2009


Author: trasz
Date: Sun Mar  1 11:20:35 2009
New Revision: 189229
URL: http://svn.freebsd.org/changeset/base/189229

Log:
  MFC r188240:
  
  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

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/ufs/ffs/ffs_alloc.c

Modified: stable/7/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- stable/7/sys/ufs/ffs/ffs_alloc.c	Sun Mar  1 11:17:38 2009	(r189228)
+++ stable/7/sys/ufs/ffs/ffs_alloc.c	Sun Mar  1 11:20:35 2009	(r189229)
@@ -1858,7 +1858,7 @@ ffs_blkfree(ump, fs, devvp, bno, size, i
 	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, i
 	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 {


More information about the svn-src-all mailing list