lkml.org 
[lkml]   [2019]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: pivot_root(".", ".") and the fchdir() dance
From
Date
Hello Christian,

>> All: I plan to add the following text to the manual page:
>>
>> new_root and put_old may be the same directory. In particular,
>> the following sequence allows a pivot-root operation without need‐
>> ing to create and remove a temporary directory:
>>
>> chdir(new_root);
>> pivot_root(".", ".");
>> umount2(".", MNT_DETACH);
>
> Hm, should we mention that MS_PRIVATE or MS_SLAVE is usually needed
> before the umount2()? Especially for the container case... I think we
> discussed this briefly yesterday in person.
Thanks for noticing. That detail (more precisely: not MS_SHARED) is
already covered in the numerous other changes that I have pending
for this page:

The following restrictions apply:
...
- The propagation type of new_root and its parent mount must not
be MS_SHARED; similarly, if put_old is an existing mount point,
its propagation type must not be MS_SHARED.

Thanks,

Michael


--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

\
 
 \ /
  Last update: 2019-09-10 13:22    [W:0.058 / U:0.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site