Re: [PATCH v3] man/man2/statmount.2: Document STATMOUNT_BY_FD

Askar Safin <[email protected]> Thu, 5 Mar 2026 03:13:37 +0300
Newsgroups dev.linux.lists.criu,org.kernel.vger.linux-man
Message-ID <[email protected]>
Alejandro Colomar <[email protected]>:
> Is this the same as a "mount object file descriptor" as describer in
> fsopen(2)?  If so, we should use the same language, I think.

The term "mount object file descriptor" is probably confusing. In fact
fsmount simply creates detached mount and returns O_PATH fd, referring
to the root of the new detached mount. (Note: I'm talking about fsmount here,
not fsopen.) This fd is similar to what open(O_PATH)
creates. So probably we should just replace this "mount object file
descriptor" in fsopen(2) with "O_PATH fd".

The only difference between fd, returned by fsmount, and normal O_PATH
descriptor is that fd, returned by fsmount, has FMODE_NEED_UNMOUNT flag
on file description:
https://elixir.bootlin.com/linux/v7.0-rc1/source/fs/namespace.c#L4495 .

This FMODE_NEED_UNMOUNT means that when we close fd, the mount is unmounted.


This statmount patch refers to any fd inside mount in question. I. e. any
fd referring to any file inside the mount. This may include O_PATH descriptors
and, yes, descriptors returned by fsmount. So, current wording in this
statmount patch is correct.

-- 
Askar Safin