Pending patches

Rob Landley rob at landley.net
Sat Nov 1 00:58:31 UTC 2008


On Friday 31 October 2008 18:33:29 Denys Vlasenko wrote:
> On Friday 31 October 2008 11:56, Rob Landley wrote:
> > Just having _files_ open prevents umounting a mount without -f:
> >
> > sudo /bin/bash
> > mkdir walrus
> > mount -t ramfs walrus walrus
> > touch walrus/walrus
> > sleep 999 < walrus/walrus
> > umount walrus
> >
> > A process has a file open in it.  The filesystem is pinned until the
> > process closes that file, unless you want to force the unmount (so the
> > file starts getting a -ESOMETHINGOROTHER).
>
> This is not a problem.
> killall5 -KILL closes a lot of open files.

If any of the ancestral processes that execed your shutdown thingy didn't 
close a filehandle (and didn't set it close on exec), your shutdown thing 
could itself have a file open and not know about it.  PID 1 has no ancestors 
that have execed it, it came from the kernel.

There are lots and lots and lots of little ways the thing you're describing 
can fail.  There honestly _is_ a reason that people have spent all these 
years having PID 1 perform the shutdown.  Honest and truly.

> > > We do it not from process 1 but from it's children anyway.
> > > Not much difference.
> >
> > So instead of signaling PID 1 to do the work, you signal PID 1 to stop
> > respawning processes and have some other script do it.
>
> Yes. Or I have something else respawning processes, not init.
> It's easier to deal with it if you can kill it.

You're arguing from your conclusion.  (If PID 1 isn't in control of the 
shutdown, then it's easier not to have PID 1 be in control of the shutdown.)

> --
> vda

Rob



More information about the busybox mailing list