svn commit: r187894 - head/sys/ufs/ffs

Edward Tomasz Napierala trasz at FreeBSD.org
Thu Jan 29 08:47:16 PST 2009


Author: trasz
Date: Thu Jan 29 16:47:15 2009
New Revision: 187894
URL: http://svn.freebsd.org/changeset/base/187894

Log:
  Make sure the cdev doesn't go away while the filesystem is still mounted.
  Otherwise dev2udev() could return garbage.
  
  Reviewed by:	kib
  Approved by:	rwatson (mentor)
  Sponsored by:	FreeBSD Foundation

Modified:
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c	Thu Jan 29 16:18:49 2009	(r187893)
+++ head/sys/ufs/ffs/ffs_vfsops.c	Thu Jan 29 16:47:15 2009	(r187894)
@@ -641,6 +641,7 @@ ffs_mountfs(devvp, mp, td)
 	VOP_UNLOCK(devvp, 0);
 	if (error)
 		return (error);
+	dev_ref(dev);
 	if (devvp->v_rdev->si_iosize_max != 0)
 		mp->mnt_iosize_max = devvp->v_rdev->si_iosize_max;
 	if (mp->mnt_iosize_max > MAXPHYS)
@@ -921,6 +922,7 @@ out:
 		free(ump, M_UFSMNT);
 		mp->mnt_data = NULL;
 	}
+	dev_rel(dev);
 	return (error);
 }
 
@@ -1107,6 +1109,7 @@ ffs_unmount(mp, mntflags, td)
 	g_topology_unlock();
 	PICKUP_GIANT();
 	vrele(ump->um_devvp);
+	dev_rel(ump->um_dev);
 	mtx_destroy(UFS_MTX(ump));
 	if (mp->mnt_gjprovider != NULL) {
 		free(mp->mnt_gjprovider, M_UFSMNT);


More information about the svn-src-head mailing list