tech-userlevel archive

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

Re: swap-on-raidframe vs raidctl -P

On Tue, Jan 22, 2008 at 04:26:53PM -0600, Greg Oster wrote:
>  while(!done) {
>      foreach mounted filesystem
>        - attempt to unmount each
>      foreach configured device
>        - attempt to unconfigure each unused (unopened) device
>      if (no mounted filesystems and no configured drives)
>        - we're done

I am working on something like this for shutting down hardware devices.
I start with the leaves of the device tree and I move toward the root.
Devices that I cannot detach, I skip.  My goal is to return every device
to its condition before NetBSD took over from the BIOS, while respecting
each device's dependency others.

Perhaps disk pseudo-devices and filesystems deserve similar treatment at
shutdown.  Neither cgd(4) nor raid(4) pseudo-devices reside in the device
tree, now.  Perhaps they belong there, even if their parent is NULL.
Their use/open count will suffice to tell whether they are eligible for
detachment or not; if not, their detach routine should return EBUSY.
After a few times through the while-loop above, no disk pseudo-device
should be busy.

It may be a SMOP to integrate my shutdown code with unmounting
filesystems.  I can look into it.

One problem with the approach that I take to shutting down devices is
that interrupts need to remain enabled, and that is not so right now.
We may need to split MD cpu_reboot() into MI and MD parts as Joerg
suggests in the thread "shutdown hooks at panic" on tech-kern.


David Young             OJC Technologies      Urbana, IL * (217) 278-3933 ext 24

Home | Main Index | Thread Index | Old Index