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
This commit is contained in:
Edward Tomasz Napierala 2009-02-23 21:09:28 +00:00
parent e02917222d
commit 4f560d7595
2 changed files with 5 additions and 5 deletions

View File

@ -779,12 +779,12 @@ msdosfs_unmount(struct mount *mp, int mntflags, struct thread *td)
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 mntflags, struct thread *td)
MNT_ILOCK(mp);
mp->mnt_flag &= ~MNT_LOCAL;
MNT_IUNLOCK(mp);
return (0);
return (error);
}
static int

View File

@ -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;
}