Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jan 2009 16:47:15 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r187894 - head/sys/ufs/ffs
Message-ID:  <200901291647.n0TGlFHZ058776@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901291647.n0TGlFHZ058776>