patch for ext2fs unmount problem at shutdown

Don Lewis truckman at
Tue Sep 6 03:50:44 PDT 2005

On  6 Sep, Poul-Henning Kamp wrote:
> In message <200509060841.j868fj1I032057 at>, Don Lewis writes:
>>I suspect both that is one possible reason, and another reason would be
>>to avoid marking the file system clean if any writes timed out.
> In that case the unmount should fail, otherwise the filesystem is
> buggy.

ext2fs is definitely buggy because it writes the superblock to mark the
file system clean before it writes some of the file system meta-data
(without error checking), but this is a different bug that won't get
caught by the nbusy check.  Both ext2fs and ufs rely on vflush(), which
essentially does a vgonel() on all the vnodes, which I don't think will
catch any stuck writes.  Ufs does quite a bit more error checking than
ext2fs, but I don't know if it is enough to avoid marking the file
system clean when it shouldn't be.

> Considering that our kernel presently tend to explode violently on
> disk errors I would say that the nbusy check should just be commented
> out for now and vfs_unmountall() always tried.

vfs_umountall() really needs to be made smart enough to properly unwind
all the dependencies between mounted file systems, swap devices, file
systems mounted on swap-backed or vnode-backed md's, and vnode-backed
swap devices as was discussed at length a while ago.  Perhaps the error
checking on unmount should be combined with the vfs_unmountall()

More information about the freebsd-current mailing list