On Wed, 14 Mar 2007, Jacob Yocom-Piatt wrote:

> Clint M. Sand wrote:
> > I know this is a dumb question but make install on a kernel build does:
> > 
> > rm -f /obsd
> > ln /bsd /obsd
> > cp bsd /nbsd
> > mv /nbsd /bsd
> > 
> > 
> > But I can't see the reasoning here. Why do we copy it then move it
> > rather than just copying it straight to /bsd?
> > 
> >   
> 
> 
> to prevent a poorly timed "act of god" from making the system unbootable.

Doesn't this method also keep the original file correctly mapped
by any processes (the running kernel? a debugger?)  that may have
it open for some reason or other?    Just "cp bsd /bsd" would perhaps
wreck such a process.  With the given method, the old version of /bsd
just leaves the namespace, but the vnode, if open, still maps the old
blocks, which won't be freed until close(2)d.  This is in addtion to
the other reason of providing an atomic action, and not messing with
the kernel until nearly all possibilities for the action to fail
(no space on /, blah blah) have been eliminated, as others have already
mentioned.

Dave

Reply via email to