tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

unmounting all filesystems (was Re: CVS commit: src/sys)



On Fri, Apr 17, 2009 at 08:49:08PM +0000, Andrew Doran wrote:
> On Fri, Apr 17, 2009 at 08:22:52PM +0000, David Young wrote:
> 
> > Module Name:        src
> > Committed By:       dyoung
> > Date:               Fri Apr 17 20:22:52 UTC 2009
> > 
> > Modified Files:
> >     src/sys/kern: vfs_subr.c
> >     src/sys/sys: mount.h
> > 
> > Log Message:
> > Make vfs_unmountall() return true if it was able to unmount any
> > filesystem at all, false otherwise.  This will support tearing down
> > stacks of filesystems, ccd(4), raid(4), and vnd(4).
> > 
> > Change the misleading variable name 'allerror' to 'any_error'.  Make it
> > a bool.
> 
> Hmm. What problem are you trying to solve? Note that MNT_FORCE is being
> used. If it's not used we still have at least init to worry about, and the
> kernel itself can maintain vnode refs, like its cwdinfo or an accounting
> file.

I am trying to tear down arbitrary stacks of block pseudo-devices and
filesystems.

I have some doubts about the algorithm that I outline in "new shutdown
order" on tech-kern@, especially where vnd(4) is concerned.

It seems safe to alternate between detaching devices and "gently" (i.e.,
w/o MNT_FORCE) unmounting filesystems, but because of init's and the
kernel's vnode refs, it will be necessary to get forceful at the end.
It is important to unmount *only* the filesystem at the *top* of a stack
such as this one,

        filesystem: /dev/vnd0a at /x/y/z
        disk: vnd0 at /q.img
        filesystem: / at wd0a

before trying to all of the detach devices again.

Maybe CIRCLEQ_LAST(&mountlist) is always the top filesystem, but I have
my doubts.

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933


Home | Main Index | Thread Index | Old Index