[lkml]   [2000]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] root-hopping for pre-2.3.41-3
Followup to:  <>
By author: Guest section DW <>
In newsgroup:
> and Peter answered
> > > Right... everyone on the old / move to the new /, although I guess
> > > that's technically not 100% necessary.
> but I wonder.
> Usually in such a situation not many processes will be around, but still..
> It would be strange if the interpretation of paths suddenly changed for
> processes other than the one doing this pivot_root.
> So, I would prefer these old processes all to remain where they are,
> with the same root inode (that just got a new name, namely /old_root).
> Thus, the only process that would get the new / as root would be the
> process doing this pivot_root() (and perhaps init?).

I think this really is the right solution... usually the process doing
this will *be* init. There are other things that need to be done,
too, like replacing the console fd's after the remount (otherwise you
will hold initrd busy by virtue of having /dev/console open.)

I therefore conclude that doing automatic stuff is pointless and
probably harmful. The recommended sequence for root-switching will
then look something like (error checking omitted):

pivot_root("/newroot", "/oldroot");
new_console = open("/dev/console", O_RDWR);
dup2(new_console, 0);
dup2(new_console, 1);
dup2(new_console, 2);

execl("/sbin/init", "init", 0);
<> at work, <> in private!
"Unix gives you enough rope to shoot yourself in the foot."

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:56    [W:0.129 / U:46.380 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site