Re: [PATCH v3] man/man2/statmount.2: Document STATMOUNT_BY_FD
From: Alejandro Colomar <alx@kernel.org>
Date: 2026-03-05 00:43:02
Attachments
- signature.asc [application/pgp-signature] 833 bytes
From: Alejandro Colomar <alx@kernel.org>
Date: 2026-03-05 00:43:02
On 2026-03-05T03:13:37+0300, Askar Safin wrote:
Alejandro Colomar [off-list ref]:quoted
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".
Except for expanding fd by file descriptor, what you say sounds reasonable to me.
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.
Thanks for having a look! And thanks for confirming it's correct! Have a lovely night! Alex
-- Askar Safin
-- <https://www.alejandro-colomar.es>