Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Feb 2009 21:09:28 +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: r188956 - in head/sys: fs/msdosfs ufs/ffs
Message-ID:  <200902232109.n1NL9Snh036220@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Mon Feb 23 21:09:28 2009
New Revision: 188956
URL: http://svn.freebsd.org/changeset/base/188956

Log:
  Right now, when trying to unmount a device that's already gone,
  msdosfs_unmount() and ffs_unmount() exit early after getting ENXIO.
  However, dounmount() treats ENXIO as a success and proceeds with
  unmounting.  In effect, the filesystem gets unmounted without closing
  GEOM provider etc.
  
  Reviewed by:	kib
  Approved by:	rwatson (mentor)
  Tested by:	dho
  Sponsored by:	FreeBSD Foundation

Modified:
  head/sys/fs/msdosfs/msdosfs_vfsops.c
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_vfsops.c	Mon Feb 23 21:07:20 2009	(r188955)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.c	Mon Feb 23 21:09:28 2009	(r188956)
@@ -779,12 +779,12 @@ msdosfs_unmount(struct mount *mp, int mn
 	if (mntflags & MNT_FORCE)
 		flags |= FORCECLOSE;
 	error = vflush(mp, 0, flags, td);
-	if (error)
+	if (error && error != ENXIO)
 		return error;
 	pmp = VFSTOMSDOSFS(mp);
 	if ((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0) {
 		error = markvoldirty(pmp, 0);
-		if (error) {
+		if (error && error != ENXIO) {
 			(void)markvoldirty(pmp, 1);
 			return (error);
 		}
@@ -835,7 +835,7 @@ msdosfs_unmount(struct mount *mp, int mn
 	MNT_ILOCK(mp);
 	mp->mnt_flag &= ~MNT_LOCAL;
 	MNT_IUNLOCK(mp);
-	return (0);
+	return (error);
 }
 
 static int

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c	Mon Feb 23 21:07:20 2009	(r188955)
+++ head/sys/ufs/ffs/ffs_vfsops.c	Mon Feb 23 21:09:28 2009	(r188956)
@@ -1079,7 +1079,7 @@ ffs_unmount(mp, mntflags, td)
 		error = softdep_flushfiles(mp, flags, td);
 	else
 		error = ffs_flushfiles(mp, flags, td);
-	if (error != 0)
+	if (error != 0 && error != ENXIO)
 		goto fail;
 
 	UFS_LOCK(ump);
@@ -1094,7 +1094,7 @@ ffs_unmount(mp, mntflags, td)
 	if (fs->fs_ronly == 0) {
 		fs->fs_clean = fs->fs_flags & (FS_UNCLEAN|FS_NEEDSFSCK) ? 0 : 1;
 		error = ffs_sbupdate(ump, MNT_WAIT, 0);
-		if (error) {
+		if (error && error != ENXIO) {
 			fs->fs_clean = 0;
 			goto fail;
 		}



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