diff options
author | trasz <trasz@FreeBSD.org> | 2009-02-23 21:09:28 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2009-02-23 21:09:28 +0000 |
commit | 644f63d68b32643bf09dda1bb1cd0e102f4fbf43 (patch) | |
tree | 1ffd9a69abd4a4a58bb85a49db7748e575561989 /sys | |
parent | de29f650e65ee47a3b0430555b28f248cbceb4da (diff) | |
download | FreeBSD-src-644f63d68b32643bf09dda1bb1cd0e102f4fbf43.zip FreeBSD-src-644f63d68b32643bf09dda1bb1cd0e102f4fbf43.tar.gz |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vfsops.c | 6 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index c6b5fb5..e8ed48e 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -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 diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index d930404..3e0760f 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -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; } |