Subject: Re: Improving documentation of parent-ID field in /proc/PID/mountinfo

Hello Miklos,

On 20 November 2017 at 10:22, Miklos Szeredi <[email protected]> wrote:
> On Mon, Nov 20, 2017 at 10:07 AM, Michael Kerrisk (man-pages)
> <[email protected]> wrote:
>
>> But, the problem is that the existing description is at best misleading:
>>
>> (2) parent ID: the ID of the parent mount (or of self for
>> the top of the mount tree).
>>
>> That implies that we'll find one line in the list where field 1 and
>> field 2 are the same. But we don't, because the mountns rootfs entry
>> is not shown in mountinfo. On top of that, the reader is left
>> confused, because when they look at mountinfo, they see one entry
>> where the parent-ID doesn't exist in the list. So, something more than
>> the current text is required. After digging around in the kernel
>> source and noticing that chroot() will also cause this scenario, and
>> taking into account your comments, I revised the text to:
>>
>> (2) parent ID: the ID of the parent mount (or of self for
>> the root of this mount namespace's mount tree).
>>
>> If the parent mount point lies outside the process's
>> root directory (see chroot(2)), the ID shown here
>> won't have a corresponding record in mountinfo whose
>> mount ID (field 1) matches this parent mount ID
>> (because mount points that lie outside the process's
>> root directory are not shown in mountinfo). As a spe‐
>> cial case of this point, the process's root mount
>> point may have a parent mount (for the initramfs
>> filesystem) that lies outside the process's root
>> directory, and an entry for that mount point will not
>> appear in mountinfo.
>>
>> How does that seem?
>
> Perfect.

Thanks! And thanks for the fast review and response.

Cheers,

Michael


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

From 1584576372917864879@xxx Mon Nov 20 09:23:09 +0000 2017
X-GM-THRID: 1583929638158288060
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread