pivot_root.2: Relocate details about kernel threads to NOTES

This text is a side point that somewhat distracts from the
flow in DESCRIPTION.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2019-07-30 13:47:12 +02:00
parent b647c4c93a
commit fc2f474d77
1 changed files with 14 additions and 8 deletions

View File

@ -52,14 +52,7 @@ changes the root directory and the current working directory
of each process or thread in the same mount namespace to
.I new_root
if they point to the old root directory.
This is necessary in order to prevent kernel threads from keeping the old
root directory busy with their root and current working directory,
even if they never access
the filesystem in any way.
Perhaps one day there may be a mechanism for
kernel threads to explicitly relinquish any access to the filesystem,
such that this fairly intrusive mechanism can be removed from
.BR pivot_root ().
See also NOTES.
.PP
Note that this also applies to the calling process:
.BR pivot_root ()
@ -195,6 +188,19 @@ the current root of all relevant processes or threads.
A modern use is to set up a root filesystem during
the creation of a container.
.PP
The fact that
.BR pivot_root ()
modifies process root and current working directories in the
manner noted in DESCRIPTION
is necessary in order to prevent kernel threads from keeping the old
root directory busy with their root and current working directory,
even if they never access
the filesystem in any way.
Perhaps one day there may be a mechanism for
kernel threads to explicitly relinquish any access to the filesystem,
such that this fairly intrusive mechanism can be removed from
.BR pivot_root ().
.PP
The rootfs (initial ramfs) cannot be
.BR pivot_root ()ed.
The recommended method of changing the root filesystem in this case is