Improving inode number documentation
Hello Alex,
I would like to ask you, could you improve documentation about inode numbers returned by readdir()/getdents() and stat()/statx() functions?
https://man7.org/linux/man-pages/man3/readdir.3.html
https://man7.org/linux/man-pages/man2/readdir.2.html
https://man7.org/linux/man-pages/man2/getdents.2.html
https://man7.org/linux/man-pages/man2/stat.2.html
https://man7.org/linux/man-pages/man2/statx.2.html
https://man7.org/linux/man-pages/man3/stat.3type.html
https://man7.org/linux/man-pages/man7/inode.7.html
The missing information in those documentations is the fact that the dirent.d_ino does not have to be same as stat.st_ino/statx.stx_ino for the same file or dir.
stat.st_ino number belongs to the stat.st_dev but dirent.d_ino belongs to the st_dev of the directory on which was called opendir().
So for the mount points these two numbers are different. readdir() returns the inode number of the underlying directory (which belongs to the parent filesystem), but the stat() returns the inode number of the root directory of the upper/mounted filesystem.
And I think same applies for mount-binded files, not just for mounted directories.
Note that this Linux behavior (when readdir and stat returns different inode numbers) is in POSIX readdir() specification called "historical" and is described in RATIONALE section of POSIX readdir:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/readdir.html
Therefore it would be nice to mention the fact in Linux readdir(3) documentation, that Linux conforms to POSIX "historical implementation".
Pali
Alejandro Colomar
maintainerHi Pali!
Quoted 4 lines · Pali Rohár
Hello Alex,
I would like to ask you, could you improve documentation about inode numbers returned by readdir()/getdents() and stat()/statx() functions?
I'd love to do that. I do not feel experienced enough in this matter to write the text myself, but I could try to learn about it. On the other hand, if you want to send patches yourself, we can go much faster. Would you mind sending some patches?
Have a lovely night!
Alex
Quoted 32 lines
https://man7.org/linux/man-pages/man3/readdir.3.html
https://man7.org/linux/man-pages/man2/readdir.2.html
https://man7.org/linux/man-pages/man2/getdents.2.html
https://man7.org/linux/man-pages/man2/stat.2.html
https://man7.org/linux/man-pages/man2/statx.2.html
https://man7.org/linux/man-pages/man3/stat.3type.html
https://man7.org/linux/man-pages/man7/inode.7.htmlThe missing information in those documentations is the fact that the dirent.d_ino does not have to be same as stat.st_ino/statx.stx_ino for the same file or dir.
stat.st_ino number belongs to the stat.st_dev but dirent.d_ino belongs to the
st_devof the directory on which was calledopendir().So for the mount points these two numbers are different.
readdir()returns the inode number of the underlying directory (which belongs to the parent filesystem), but thestat()returns the inode number of the root directory of the upper/mounted filesystem.And I think same applies for mount-binded files, not just for mounted directories.
Note that this Linux behavior (when readdir and stat returns different inode numbers) is in POSIX
readdir()specification called "historical" and is described in RATIONALE section of POSIX readdir:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/readdir.htmlTherefore it would be nice to mention the fact in Linux readdir(3) documentation, that Linux conforms to POSIX "historical implementation".
Pali
Signature · 1 line
<https://www.alejandro-colomar.es/>
Hello!
Quoted 5 lines · On Monday 26 May 2025 01:30:43 Alejandro Colomar wrote:
Hi Pali!
Quoted 2 lines · Pali Rohár
Hello Alex,
Quoted 7 lines
Quoted 2 lines
I would like to ask you, could you improve documentation about inode numbers returned by readdir()/getdents() and stat()/statx() functions?
I'd love to do that. I do not feel experienced enough in this matter to write the text myself, but I could try to learn about it. On the other hand, if you want to send patches yourself, we can go much faster. Would you mind sending some patches?
Well, as it affects at least 7 man pages, I do not know how such information should be ideally structured. Whether to be described just in the readdir(3) and referenced from all others. Or split across all of them. So I do not think that I'm the one who can prepare patches.
But I will try at least to propose how the changes could look like:
readdir(3) change:
d_ino - This is the inode number of the directory entry, which belongs to the filesystem st_dev of the directory on which was readdir() called. If the directory entry is the mount point then the d_ino differs from the stat's st_ino. d_ino is the inode number of the underlying mount point, rather than of the inode number of mounted file system. According to POSIX this Linux behavior is considered to be a bug but conforms as "historical implementations".
stat(3type) change:
st_ino - This field contains the file's inode number, which belongs to the st_dev. If the stat() was called on the mount point then st_ino differs from the readdir's d_ino. st_ino contains the inode number of mounted file system, whether readdir's d_ino contains the inode number of the underlying mount point.
So I suggest if somebody else look at it and prepare improvements including how should be this information structured.
Quoted 39 lines
Have a lovely night!
AlexQuoted 32 lines
https://man7.org/linux/man-pages/man3/readdir.3.html
https://man7.org/linux/man-pages/man2/readdir.2.html
https://man7.org/linux/man-pages/man2/getdents.2.html
https://man7.org/linux/man-pages/man2/stat.2.html
https://man7.org/linux/man-pages/man2/statx.2.html
https://man7.org/linux/man-pages/man3/stat.3type.html
https://man7.org/linux/man-pages/man7/inode.7.htmlThe missing information in those documentations is the fact that the dirent.d_ino does not have to be same as stat.st_ino/statx.stx_ino for the same file or dir.
stat.st_ino number belongs to the stat.st_dev but dirent.d_ino belongs to the
st_devof the directory on which was calledopendir().So for the mount points these two numbers are different.
readdir()returns the inode number of the underlying directory (which belongs to the parent filesystem), but thestat()returns the inode number of the root directory of the upper/mounted filesystem.And I think same applies for mount-binded files, not just for mounted directories.
Note that this Linux behavior (when readdir and stat returns different inode numbers) is in POSIX
readdir()specification called "historical" and is described in RATIONALE section of POSIX readdir:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/readdir.htmlTherefore it would be nice to mention the fact in Linux readdir(3) documentation, that Linux conforms to POSIX "historical implementation".
Pali
Signature · 1 line
<https://www.alejandro-colomar.es/>
Alejandro Colomar
maintainerHi Pali!
Quoted 15 lines · Pali Rohár
Quoted 7 lines
Quoted 2 lines
I would like to ask you, could you improve documentation about inode numbers returned by readdir()/getdents() and stat()/statx() functions?
I'd love to do that. I do not feel experienced enough in this matter to write the text myself, but I could try to learn about it. On the other hand, if you want to send patches yourself, we can go much faster. Would you mind sending some patches?
Well, as it affects at least 7 man pages, I do not know how such information should be ideally structured. Whether to be described just in the readdir(3) and referenced from all others. Or split across all of them. So I do not think that I'm the one who can prepare patches.
But I will try at least to propose how the changes could look like:
Quoted 7 lines
readdir(3) change:
d_ino- This is the inode number of the directory entry, which belongs to the filesystemst_devof the directory on which wasreaddir()called. If the directory entry is the mount point then thed_inodiffers from the stat'sst_ino.d_inois the inode number of the underlying mount point, rather than of the inode number of mounted file system.
I guess the last sentence applies only as a clarification of the previous one, right? If so, I'd separate the sentences with ':' instead of '.'.
Quoted 11 lines
According
to POSIX this Linux behavior is considered to be a bug but conforms as "historical implementations".stat(3type) change:
st_ino- This field contains the file's inode number, which belongs to thest_dev. If thestat()was called on the mount point thenst_inodiffers from the readdir'sd_ino.st_inocontains the inode number of mounted file system, whether readdir'sd_inocontains the inode number of the underlying mount point.
These two paragraphs in two pages sound reasonable. I've prepared a patch, and pushed a new branch to the git repo where we can continue working on it.
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/log/?h=ino>
Quoted 3 lines
So I suggest if somebody else look at it and prepare improvements including how should be this information structured.
Here's the change I propose based on your suggestions:
commit c27a2d7f80c7824918abe5958be6b5eb2dbe8278 (HEAD -> ino, korg/ino) Author: Alejandro Colomar <[email protected]> Date: Wed May 28 20:59:11 2025 +0200 man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino Suggested-by: Pali Rohár <[email protected]> Co-authored-by: Pali Rohár <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]> diff --git a/man/man3/readdir.3 b/man/man3/readdir.3 index b9150160b..ad9c76595 100644 --- a/man/man3/readdir.3 +++ b/man/man3/readdir.3 @@ -58,7 +58,27 @@ .SH DESCRIPTION structure are as follows: .TP .I .d_ino -This is the inode number of the file. +This is the inode number of the file, +which belongs to the filesystem +.I .st_dev +(see +.BR stat (3type)) +of the directory on which +.BR readdir () +was called. +If the directory entry is the mount point, +then +.I .d_ino +differs from +.IR .st_ino : +.I .d_ino +is the inode number of the underlying mount point, +while +.I .st_ino +is the inode number of the mounted file system. +According to POSIX, +this Linux behavior is considered to be a bug, +but is nevertheless conforming. .TP .I .d_off The value returned in diff --git a/man/man3type/stat.3type b/man/man3type/stat.3type index ee801bcec..835626775 100644 --- a/man/man3type/stat.3type +++ b/man/man3type/stat.3type @@ -66,7 +66,21 @@ .SH DESCRIPTION macros may be useful to decompose the device ID in this field.) .TP .I .st_ino -This field contains the file's inode number. +This field contains the file's inode number, +which belongs to the +.IR .st_dev . +If +.BR stat (2) +was called on the mount point, +then +.I .d_ino +differs from +.IR .st_ino : +.I .d_ino +is the inode number of the underlying mount point, +while +.I .st_ino +is the inode number of the mounted file system. .TP .I .st_mode This field contains the file type and mode.
Does it look good to you? Would you do anything else? Please sign the patch if it looks good to you.
Have a lovely day!
Alex
Signature · 1 line
<https://www.alejandro-colomar.es/>
Quoted 26 lines · On Wednesday 28 May 2025 21:03:04 Alejandro Colomar wrote:
Hi Pali!
Quoted 15 lines · Pali Rohár
Quoted 7 lines
Quoted 2 lines
I would like to ask you, could you improve documentation about inode numbers returned by readdir()/getdents() and stat()/statx() functions?
I'd love to do that. I do not feel experienced enough in this matter to write the text myself, but I could try to learn about it. On the other hand, if you want to send patches yourself, we can go much faster. Would you mind sending some patches?
Well, as it affects at least 7 man pages, I do not know how such information should be ideally structured. Whether to be described just in the readdir(3) and referenced from all others. Or split across all of them. So I do not think that I'm the one who can prepare patches.
But I will try at least to propose how the changes could look like:
Quoted 7 lines
readdir(3) change:
d_ino- This is the inode number of the directory entry, which belongs to the filesystemst_devof the directory on which wasreaddir()called. If the directory entry is the mount point then thed_inodiffers from the stat'sst_ino.d_inois the inode number of the underlying mount point, rather than of the inode number of mounted file system.
Quoted 3 lines
I guess the last sentence applies only as a clarification of the previous one, right? If so, I'd separate the sentences with ':' instead of '.'.
Yes, it is a clarification.
Quoted 26 lines
Quoted 11 lines
According
to POSIX this Linux behavior is considered to be a bug but conforms as "historical implementations".stat(3type) change:
st_ino- This field contains the file's inode number, which belongs to thest_dev. If thestat()was called on the mount point thenst_inodiffers from the readdir'sd_ino.st_inocontains the inode number of mounted file system, whether readdir'sd_inocontains the inode number of the underlying mount point.These two paragraphs in two pages sound reasonable. I've prepared a patch, and pushed a new branch to the git repo where we can continue working on it.
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/log/?h=ino>
Quoted 3 lines
So I suggest if somebody else look at it and prepare improvements including how should be this information structured.
Here's the change I propose based on your suggestions:
...
Quoted 9 lines
Does it look good to you? Would you do anything else? Please sign the patch if it looks good to you.
Have a lovely day!
AlexSignature · 1 line
<https://www.alejandro-colomar.es/>
As I said I'm not feeling comfortable with it. So I would really like if somebody else ideally more skilled recheck it and improve it. Maybe asking linux-fsdevel for help?
What is missing updating also the statx information (because this is also syscall which returns inode number) and updating also readdir(2) and getdents(2). In the first email I sent list of manpages which are affected. It could be quite surprising for people reading documentation why old stat syscall has something regarding to inodes and new statx syscall does not have.
Alejandro Colomar
maintainer[CC += linux-fsdevel@]
Hi Pali,
Quoted 66 lines · Pali Rohár
Quoted 26 lines · On Wednesday 28 May 2025 21:03:04 Alejandro Colomar wrote:
Hi Pali!
Quoted 15 lines · Pali Rohár
Quoted 7 lines
Quoted 2 lines
I would like to ask you, could you improve documentation about inode numbers returned by readdir()/getdents() and stat()/statx() functions?
I'd love to do that. I do not feel experienced enough in this matter to write the text myself, but I could try to learn about it. On the other hand, if you want to send patches yourself, we can go much faster. Would you mind sending some patches?
Well, as it affects at least 7 man pages, I do not know how such information should be ideally structured. Whether to be described just in the readdir(3) and referenced from all others. Or split across all of them. So I do not think that I'm the one who can prepare patches.
But I will try at least to propose how the changes could look like:
Quoted 7 lines
readdir(3) change:
d_ino- This is the inode number of the directory entry, which belongs to the filesystemst_devof the directory on which wasreaddir()called. If the directory entry is the mount point then thed_inodiffers from the stat'sst_ino.d_inois the inode number of the underlying mount point, rather than of the inode number of mounted file system.Quoted 3 lines
I guess the last sentence applies only as a clarification of the previous one, right? If so, I'd separate the sentences with ':' instead of '.'.
Yes, it is a clarification.
Quoted 33 lines
Quoted 11 lines
According
to POSIX this Linux behavior is considered to be a bug but conforms as "historical implementations".stat(3type) change:
st_ino- This field contains the file's inode number, which belongs to thest_dev. If thestat()was called on the mount point thenst_inodiffers from the readdir'sd_ino.st_inocontains the inode number of mounted file system, whether readdir'sd_inocontains the inode number of the underlying mount point.These two paragraphs in two pages sound reasonable. I've prepared a patch, and pushed a new branch to the git repo where we can continue working on it.
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/log/?h=ino>
Quoted 3 lines
So I suggest if somebody else look at it and prepare improvements including how should be this information structured.
Here's the change I propose based on your suggestions:
...Does it look good to you? Would you do anything else? Please sign the patch if it looks good to you.
Have a lovely day!
Alex
Quoted 6 lines
Quoted 2 lines
Signature · 1 line
<https://www.alejandro-colomar.es/>As I said I'm not feeling comfortable with it. So I would really like if somebody else ideally more skilled recheck it and improve it. Maybe asking linux-fsdevel for help?
Sure, let's add them to CC. I will send the patches as a response to this thread, so that they can comment. The full thread of this discussion can be found at
<https://lore.kernel.org/linux-man/20250528194105.dqc2bgfck6n3xfya@pali/T/#t>.
Quoted 7 lines
What is missing updating also the statx information (because this is also syscall which returns inode number) and updating also readdir(2) and getdents(2). In the first email I sent list of manpages which are affected. It could be quite surprising for people reading documentation why old stat syscall has something regarding to inodes and new statx syscall does not have.
We can improve it incrementally. As long as what we add is correct, we don't need to make it perfect at once. But I'll keep it in a branch for now, so we can iterate a bit without committing anything.
Have a lovely night!
Alex
Signature · 1 line
<https://www.alejandro-colomar.es/>
Alejandro Colomar
maintainerRFC 1/1 man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
--- man/man3/readdir.3 | 22 +++++++++++++++++++++- man/man3type/stat.3type | 16 +++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-)
man/man3/readdir.3 +21 -1
@@ -58,7 +58,27 @@ .SH DESCRIPTION structure are as follows: .TP .I .d_ino -This is the inode number of the file. +This is the inode number of the file, +which belongs to the filesystem +.I .st_dev +(see +.BR stat (3type)) +of the directory on which +.BR readdir () +was called. +If the directory entry is the mount point, +then +.I .d_ino +differs from +.IR .st_ino : +.I .d_ino +is the inode number of the underlying mount point, +while +.I .st_ino +is the inode number of the mounted file system. +According to POSIX, +this Linux behavior is considered to be a bug, +but is nevertheless conforming. .TP .I .d_off The value returned in
man/man3type/stat.3type +15 -1
@@ -66,7 +66,21 @@ .SH DESCRIPTION macros may be useful to decompose the device ID in this field.) .TP .I .st_ino -This field contains the file's inode number. +This field contains the file's inode number, +which belongs to the +.IR .st_dev . +If +.BR stat (2) +was called on the mount point, +then +.I .d_ino +differs from +.IR .st_ino : +.I .d_ino +is the inode number of the underlying mount point, +while +.I .st_ino +is the inode number of the mounted file system. .TP .I .st_mode This field contains the file type and mode.
Range-diff against v0:
-: --------- > 1: c27a2d7f8 man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Signature · 1 line
2.49.0
Re: [RFC v1] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
At 2025-05-28T23:31:29+0200, Alejandro Colomar wrote:
[snip]
Quoted 1 line
man/man3/readdir.3 +0
-0
[snip]
Quoted 6 lines
man/man3/readdir.3 +6
-0+If the directory entry is the mount point, +then +.I .d_ino +differs from +.IR .st_ino : +.I .d_ino
man/man3/readdir.3 .SH DESCRIPTION · line 84
Quoted 10 lines
man/man3/readdir.3 +7
-0+is the inode number of the underlying mount point, +while +.I .st_ino +is the inode number of the mounted file system. +According to POSIX, +this Linux behavior is considered to be a bug, +but is nevertheless conforming. .TP .I .d_off The value returned in
Can someone add a *roff comment supporting the claim in the second sentence? For example, could we have a citation to an Austin Group mailing list post or a ticket in the group's Mantis bug tracker?
I've followed the Austin Group mailing list for years and, to me, it sounds uncharacteristic of the POSIX developers to decree an implementation as "conforming but buggy".
I've checked Draft 4 (the final draft) of the 2024 standard, and see nothing to support this claim in its dirent.h or readdir() pages. Typically, if an implementation is "getting away with" something that the Austin Group finds objectionable, they anticipate and give notice of a potential change in semantics or of a planned interface removal in the "Future Directions" sections of their entries.
It's possible I overlooked something. I used text search rather than reading all 4,101 pages of the standard at a sitting. (I count only 9 total matches for d_ino; all are in the aforementioned 2 entries, or [new to Issue 8] posix_getdents().)
There may be something analogous to the mount point situation in the case of symbolic links, which the standard _does_ contemplate:
"The value of the [dirent] structure's _d_ino_ member shall be set to the file serial number of the file named by the _d_name_ member. If the _d_name_ member names a symbolic link, the value of the _d_ino_ member shall be set to the file serial number of the symbolic link itself." (p. 1858, lines 61297-61299)
...which leads me to wonder what an implementation--Linux, specifically--decides the right thing is when one readdir()s a symbolic link to a mount point.
Regards,
Branden
Alejandro Colomar
maintainerPATCH v2 1/1 man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
In reply to Alejandro Colomar---
Hi Jan,
Would you mind reviewing this? The thread started here:
<https://lore.kernel.org/linux-man/20250525103344.fe27ugiytfyoadz5@pali/T/#u>.
Hi Branden,
I wasn't able to do anything after your request from
<https://lore.kernel.org/linux-man/20250525103344.fe27ugiytfyoadz5@pali/T/#m1bd706844fd322b2b0f9090ceac68e7ba29200eb>.
Pali will probably be better placed to do that, since he authored that text.
Hi Pali,
Sorry for being so slow with this! I wasn't able to work on this until now.
Have a lovely night!
Alex
man/man3/readdir.3 | 22 +++++++++++++++++++++- man/man3type/stat.3type | 16 +++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-)
man/man3/readdir.3 +21 -1
@@ -58,7 +58,27 @@ .SH DESCRIPTION structure are as follows: .TP .I .d_ino -This is the inode number of the file. +This is the inode number of the file, +which belongs to the filesystem +.I .st_dev +(see +.BR stat (3type)) +of the directory on which +.BR readdir () +was called. +If the directory entry is the mount point, +then +.I .d_ino +differs from +.IR .st_ino : +.I .d_ino +is the inode number of the underlying mount point, +while +.I .st_ino +is the inode number of the mounted file system. +According to POSIX, +this Linux behavior is considered to be a bug, +but is nevertheless conforming. .TP .I .d_off The value returned in
man/man3type/stat.3type +15 -1
@@ -66,7 +66,21 @@ .SH DESCRIPTION macros may be useful to decompose the device ID in this field.) .TP .I .st_ino -This field contains the file's inode number. +This field contains the file's inode number, +which belongs to the +.IR .st_dev . +If +.BR stat (2) +was called on the mount point, +then +.I .d_ino +differs from +.IR .st_ino : +.I .d_ino +is the inode number of the underlying mount point, +while +.I .st_ino +is the inode number of the mounted file system. .TP .I .st_mode This field contains the file type and mode.
base-commit: abac986a3283e679b6b323f58ab6677bc49a05e0
Signature · 1 line
2.51.0
Re: [PATCH v2] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Quoted 12 lines · On Wednesday 29 October 2025 00:15:31 Alejandro Colomar wrote:
Hi Jan,
Would you mind reviewing this? The thread started here:
<https://lore.kernel.org/linux-man/20250525103344.fe27ugiytfyoadz5@pali/T/#u>.Hi Branden,
I wasn't able to do anything after your request from
<https://lore.kernel.org/linux-man/20250525103344.fe27ugiytfyoadz5@pali/T/#m1bd706844fd322b2b0f9090ceac68e7ba29200eb>.
Pali will probably be better placed to do that, since he authored that text.
Quoted 8 lines
Hi Pali,
Sorry for being so slow with this! I wasn't able to work on this until now.
Have a lovely night!
Alex
Hello Branden, I'm sorry but I have not received your message because I'm not subscribed to the list. Otherwise I would have replied to you earlier. If you are referring to the "bug" then it is written in informative part in RATIONALE section of readdir / POSIX.1-2024. I wrote in my first email in that email thread which Alejandro linked above.
Here is direct link to POSIX spec and below is quoted part:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/readdir.html
"When returning a directory entry for the root of a mounted file system, some historical implementations of readdir() returned the file serial number of the underlying mount point, rather than of the root of the mounted file system. This behavior is considered to be a bug, since the underlying file serial number has no significance to applications."
That part is in the "informative" section. I have not found anything in normative sections which would disallow usage of that "historical" behavior, so my understanding was that "historical" behavior is conforming too.
Please correct me if I'm wrong here, or if it should be understood in different way.
Also I have not read all those 4000 pages, so maybe there is something hidden. It is quite hard to find information about this topic and that is why I think this should be documented in Linux manpages.
Pali
Re: [PATCH v2] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Hi Pali,
Thanks for following up.
Quoted 3 lines · Pali Rohár
Hello Branden, I'm sorry but I have not received your message because I'm not subscribed to the list. Otherwise I would have replied to you earlier.
No worries--it's a risk I take when forgetting to CC people's accounts.
Quoted 7 lines
If you are referring to the "bug" then it is written in informative part in RATIONALE section of readdir / POSIX.1-2024. I wrote in my first email in that email thread which Alejandro linked above.
Here is direct link to POSIX spec and below is quoted part:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/readdir.html
Quoted 6 lines
"When returning a directory entry for the root of a mounted file system, some historical implementations of
readdir()returned the file serial number of the underlying mount point, rather than of the root of the mounted file system. This behavior is considered to be a bug, since the underlying file serial number has no significance to applications."
Thanks--this is precisely what I was asking for!
Quoted 7 lines
That part is in the "informative" section. I have not found anything in normative sections which would disallow usage of that "historical" behavior, so my understanding was that "historical" behavior is conforming too.
Please correct me if I'm wrong here, or if it should be understood in different way.
I can't speak for the Austin Group, but I don't read the text quite the same way. I interpret it as saying that some historical implementations of readdir() would _not_ "return a pointer to a structure representing the directory entry at the current position in the directory stream specified by the argument dirp, and position the directory stream at the next entry." But I suspect that's not what it _intends_ to say.
Instead, these implementations "returned [sic] the file serial number of the underlying mount point", which I interpret to mean that they would return a pointer to a _dirent_ struct whose _d_ino_ member was not the file serial number of the file (of directory type) named by the _d_name_ member but a pointer to a _dirent_ struct whose _d_ino_ member was the file serial number of the underlying mount point.
I think there are two conclusions we can reach here.
1. POSIX.1-2024 might be a little sloppy in the wording of its "RATIONALE" for this interface. Presumably no historical implementation's readdir() returned a _d_ino_ number directly. (Though with all the exuberant integer/pointer punning that used to go in Unix, I'd wouldn't bet a lot of money that *no* implementation ever did.) I'll wager a nickel that readdir() has always, on every implementation, returned a pointer to a _dirent_ struct, and it is only the value of the _d_ino_ member of the pointed-to struct that some implementations have populated inconsistently when the entry is a directory that is a mount point.
If I'm right, this is an example of the common linguistic error of
synecdoche: confusing a container with (a subset of) its contents.
2. The behavior POSIX describes as buggy is, in fact, nonconforming.
Quoted 3 lines
Also I have not read all those 4000 pages, so maybe there is something hidden. It is quite hard to find information about this topic and that is why I think this should be documented in Linux manpages.
I reckon someone should open a Mantis ticket with the Austin Group's issue tracker to get clarity on what I characterized as "sloppy" wording. Either it is and we can get the standard clarified, or I'm wrong and an authority can point out how. (Maybe both!)
I'm subscribed to the austin-group-l reflector and will take an action item to file this ticket. I'll try to do within a week. (I have a lot of old Unix books and would like to rummage around in them for any documented land mines in this area.)
Regards,
Branden
Re: [PATCH v2] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Hello Branden,
Quoted 62 lines · On Wednesday 29 October 2025 02:00:39 G. Branden Robinson wrote:
Hi Pali,
Thanks for following up.
Quoted 3 lines · Pali Rohár
Hello Branden, I'm sorry but I have not received your message because I'm not subscribed to the list. Otherwise I would have replied to you earlier.
No worries--it's a risk I take when forgetting to CC people's accounts.
Quoted 7 lines
If you are referring to the "bug" then it is written in informative part in RATIONALE section of readdir / POSIX.1-2024. I wrote in my first email in that email thread which Alejandro linked above.
Here is direct link to POSIX spec and below is quoted part:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/readdir.htmlQuoted 6 lines
"When returning a directory entry for the root of a mounted file system, some historical implementations of
readdir()returned the file serial number of the underlying mount point, rather than of the root of the mounted file system. This behavior is considered to be a bug, since the underlying file serial number has no significance to applications."Thanks--this is precisely what I was asking for!
Quoted 7 lines
That part is in the "informative" section. I have not found anything in normative sections which would disallow usage of that "historical" behavior, so my understanding was that "historical" behavior is conforming too.
Please correct me if I'm wrong here, or if it should be understood in different way.
I can't speak for the Austin Group, but I don't read the text quite the same way. I interpret it as saying that some historical implementations of
readdir()would _not_ "return a pointer to a structure representing the directory entry at the current position in the directory stream specified by the argument dirp, and position the directory stream at the next entry." But I suspect that's not what it _intends_ to say.Instead, these implementations "returned [sic] the file serial number of the underlying mount point", which I interpret to mean that they would return a pointer to a _dirent_ struct whose _d_ino_ member was not the file serial number of the file (of directory type) named by the _d_name_ member but a pointer to a _dirent_ struct whose _d_ino_ member was the file serial number of the underlying mount point.
I think there are two conclusions we can reach here.
1. POSIX.1-2024 might be a little sloppy in the wording of its "RATIONALE" for this interface. Presumably no historical implementation's
readdir()returned a _d_ino_ number directly. (Though with all the exuberant integer/pointer punning that used to go in Unix, I'd wouldn't bet a lot of money that *no* implementation ever did.) I'll wager a nickel thatreaddir()has always, on every implementation, returned a pointer to a _dirent_ struct, and it is only the value of the _d_ino_ member of the pointed-to struct that some implementations have populated inconsistently when the entry is a directory that is a mount point.
Quoted 4 lines
If I'm right, this is an example of the common linguistic error of
synecdoche: confusing a container with (a subset of) its contents.2. The behavior POSIX describes as buggy is, in fact, nonconforming.
Only two? I can image that somebody come up with another conclusion. (just a joke)
Anyway, I think that it is important to document the existing Linux behavior and whether it is POSIX-conforming or not is then second step. We can drop the information about POSIX conformity from manpage until we figure out how it is.
Quoted 9 lines
Quoted 3 lines
Also I have not read all those 4000 pages, so maybe there is something hidden. It is quite hard to find information about this topic and that is why I think this should be documented in Linux manpages.
I reckon someone should open a Mantis ticket with the Austin Group's issue tracker to get clarity on what I characterized as "sloppy" wording. Either it is and we can get the standard clarified, or I'm wrong and an authority can point out how. (Maybe both!)
Quoted 7 lines
I'm subscribed to the austin-group-l reflector and will take an action item to file this ticket. I'll try to do within a week. (I have a lot of old Unix books and would like to rummage around in them for any documented land mines in this area.)
Regards,
Branden
Thanks for taking that part. It would be really nice if austin group can clarify how the whole situation is in a non-confusing way.
Anyway, inode number is always connected to the specific mounted filesystem. So when the application is doing something with inodes, it always needs a pair (dev_t, ino_t) unless inodes belongs to same fs dev.
readdir() and getdents() returns just ino_t, and without knowledge of dev_t, applications cannot use returned ino_t for anything useful. On "historical" implementations, the dev_t can be fetched for example by one fstat(dir_fd, &st) call as dev_t would be same for all readdir and getdents entries. But on non-"historical" implementation, it would be needed to call stat() on every one entry. For example /mnt/ directory which usually contains just mountpoints, will contain entries where each one has inode number 2 (common inode number for root of fs).
I looked into archives and I have found that this problem was already discussed in the past. Here are some email threads from coreutils:
https://lore.kernel.org/lkml/[email protected]/t/#u
https://public-inbox.org/bug-coreutils/[email protected]/t/#u
https://public-inbox.org/bug-coreutils/[email protected]/t/#u
https://public-inbox.org/bug-coreutils/[email protected]/
https://public-inbox.org/bug-coreutils/022320061637.4398.43FDE4D7000110830000112E22007507440A050E040D0C079D0A@comcast.net/
Maybe they could be a good reference for future discussion by austin group.
Just my personal idea: If there would be some xgetdents syscall (like there statx over stat), it could return both inode numbers with dev_t and application can take which it wants.
For example, NFS4's readdir can return both inode numbers (depending what is client asking). NFSv4.1 spec has nicely documented this problem with UNIX background of mount point crossing:
https://www.rfc-editor.org/rfc/rfc8881.html#section-5.8.2.23
Pali
Re: [PATCH v2] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Quoted 125 lines · On Wednesday 29 October 2025 20:34:13 Pali Rohár wrote:
Hello Branden,
Quoted 62 lines · On Wednesday 29 October 2025 02:00:39 G. Branden Robinson wrote:
Hi Pali,
Thanks for following up.
Quoted 3 lines · Pali Rohár
Hello Branden, I'm sorry but I have not received your message because I'm not subscribed to the list. Otherwise I would have replied to you earlier.
No worries--it's a risk I take when forgetting to CC people's accounts.
Quoted 7 lines
If you are referring to the "bug" then it is written in informative part in RATIONALE section of readdir / POSIX.1-2024. I wrote in my first email in that email thread which Alejandro linked above.
Here is direct link to POSIX spec and below is quoted part:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/readdir.htmlQuoted 6 lines
"When returning a directory entry for the root of a mounted file system, some historical implementations of
readdir()returned the file serial number of the underlying mount point, rather than of the root of the mounted file system. This behavior is considered to be a bug, since the underlying file serial number has no significance to applications."Thanks--this is precisely what I was asking for!
Quoted 7 lines
That part is in the "informative" section. I have not found anything in normative sections which would disallow usage of that "historical" behavior, so my understanding was that "historical" behavior is conforming too.
Please correct me if I'm wrong here, or if it should be understood in different way.
I can't speak for the Austin Group, but I don't read the text quite the same way. I interpret it as saying that some historical implementations of
readdir()would _not_ "return a pointer to a structure representing the directory entry at the current position in the directory stream specified by the argument dirp, and position the directory stream at the next entry." But I suspect that's not what it _intends_ to say.Instead, these implementations "returned [sic] the file serial number of the underlying mount point", which I interpret to mean that they would return a pointer to a _dirent_ struct whose _d_ino_ member was not the file serial number of the file (of directory type) named by the _d_name_ member but a pointer to a _dirent_ struct whose _d_ino_ member was the file serial number of the underlying mount point.
I think there are two conclusions we can reach here.
1. POSIX.1-2024 might be a little sloppy in the wording of its "RATIONALE" for this interface. Presumably no historical implementation's
readdir()returned a _d_ino_ number directly. (Though with all the exuberant integer/pointer punning that used to go in Unix, I'd wouldn't bet a lot of money that *no* implementation ever did.) I'll wager a nickel thatreaddir()has always, on every implementation, returned a pointer to a _dirent_ struct, and it is only the value of the _d_ino_ member of the pointed-to struct that some implementations have populated inconsistently when the entry is a directory that is a mount point.Quoted 4 lines
If I'm right, this is an example of the common linguistic error of
synecdoche: confusing a container with (a subset of) its contents.2. The behavior POSIX describes as buggy is, in fact, nonconforming.
Only two? I can image that somebody come up with another conclusion. (just a joke)
Anyway, I think that it is important to document the existing Linux behavior and whether it is POSIX-conforming or not is then second step. We can drop the information about POSIX conformity from manpage until we figure out how it is.
Quoted 9 lines
Quoted 3 lines
Also I have not read all those 4000 pages, so maybe there is something hidden. It is quite hard to find information about this topic and that is why I think this should be documented in Linux manpages.
I reckon someone should open a Mantis ticket with the Austin Group's issue tracker to get clarity on what I characterized as "sloppy" wording. Either it is and we can get the standard clarified, or I'm wrong and an authority can point out how. (Maybe both!)
Quoted 7 lines
I'm subscribed to the austin-group-l reflector and will take an action item to file this ticket. I'll try to do within a week. (I have a lot of old Unix books and would like to rummage around in them for any documented land mines in this area.)
Regards,
BrandenThanks for taking that part. It would be really nice if austin group can clarify how the whole situation is in a non-confusing way.
Anyway, inode number is always connected to the specific mounted filesystem. So when the application is doing something with inodes, it always needs a pair (
dev_t,ino_t) unless inodes belongs to same fs dev.
readdir()andgetdents()returns justino_t, and without knowledge ofdev_t, applications cannot use returnedino_tfor anything useful. On "historical" implementations, thedev_tcan be fetched for example by onefstat(dir_fd, &st)call asdev_twould be same for all readdir and getdents entries. But on non-"historical" implementation, it would be needed to callstat()on every one entry. For example/mnt/directory which usually contains just mountpoints, will contain entries where each one has inode number 2 (common inode number for root of fs).I looked into archives and I have found that this problem was already discussed in the past. Here are some email threads from coreutils:
https://lore.kernel.org/lkml/[email protected]/t/#u
https://public-inbox.org/bug-coreutils/[email protected]/t/#u
https://public-inbox.org/bug-coreutils/[email protected]/t/#u
https://public-inbox.org/bug-coreutils/[email protected]/
https://public-inbox.org/bug-coreutils/022320061637.4398.43FDE4D7000110830000112E22007507440A050E040D0C079D0A@comcast.net/Maybe they could be a good reference for future discussion by austin group.
Just my personal idea: If there would be some xgetdents syscall (like there statx over stat), it could return both inode numbers with
dev_tand application can take which it wants.
Quoted 6 lines
For example, NFS4's readdir can return both inode numbers (depending what is client asking). NFSv4.1 spec has nicely documented this problem with UNIX background of mount point crossing:
https://www.rfc-editor.org/rfc/rfc8881.html#section-5.8.2.23Pali
Hello Branden, did you have a time fill a ticket to austin group? If the ticket system is public, could you send a link for reference? Pali
Re: [PATCH v2] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Hi Pali,
Quoted 17 lines · Pali Rohár
Quoted 16 lines · On Wednesday 29 October 2025 20:34:13 Pali Rohár wrote:
Quoted 15 lines · On Wednesday 29 October 2025 02:00:39 G. Branden Robinson wrote:
Quoted 14 lines · Pali Rohár
If you are referring to the "bug" then it is written in informative part in RATIONALE section of readdir / POSIX.1-2024. I wrote in my first email in that email thread which Alejandro linked above.
Here is direct link to POSIX spec and below is quoted part:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/readdir.html"When returning a directory entry for the root of a mounted file system, some historical implementations of
readdir()returned the file serial number of the underlying mount point, rather than of the root of the mounted file system. This behavior is considered to be a bug, since the underlying file serial number has no significance to applications."
[...]
Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
Quoted 7 lines
That part is in the "informative" section. I have not found anything in normative sections which would disallow usage of that "historical" behavior, so my understanding was that "historical" behavior is conforming too.
Please correct me if I'm wrong here, or if it should be understood in different way.
I can't speak for the Austin Group, but I don't read the text quite the same way. I interpret it as saying that some historical implementations of
readdir()would _not_ "return a pointer to a structure representing the directory entry at the current position in the directory stream specified by the argument dirp, and position the directory stream at the next entry." But I suspect that's not what it _intends_ to say.Instead, these implementations "returned [sic] the file serial number of the underlying mount point", which I interpret to mean that they would return a pointer to a _dirent_ struct whose _d_ino_ member was not the file serial number of the file (of directory type) named by the _d_name_ member but a pointer to a _dirent_ struct whose _d_ino_ member was the file serial number of the underlying mount point.
I think there are two conclusions we can reach here.
1. POSIX.1-2024 might be a little sloppy in the wording of its "RATIONALE" for this interface. Presumably no historical implementation's
readdir()returned a _d_ino_ number directly. (Though with all the exuberant integer/pointer punning that used to go in Unix, I'd wouldn't bet a lot of money that *no* implementation ever did.) I'll wager a nickel thatreaddir()has always, on every implementation, returned a pointer to a _dirent_ struct, and it is only the value of the _d_ino_ member of the pointed-to struct that some implementations have populated inconsistently when the entry is a directory that is a mount point.If I'm right, this is an example of the common linguistic error of synecdoche: confusing a container with (a subset of) its contents.
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
2. The behavior POSIX describes as buggy is, in fact, nonconforming.
Only two? I can image that somebody come up with another conclusion. (just a joke)
I wouldn't bet against your joke proving out in reality. ;-)
Quoted 6 lines
Quoted 6 lines
Anyway, I think that it is important to document the existing Linux behavior and whether it is POSIX-conforming or not is then second step. We can drop the information about POSIX conformity from manpage until we figure out how it is.
Quoted 1 line
Quoted 1 line
Also I have not read all those 4000 pages,
Pity the person who has. :) And mastery of all 4000+ pages should not be necessary for an implementor to make sense of a reference entry for a single function, command, or data object.
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 3 lines
so maybe there is something hidden. It is quite hard to find information about this topic and that is why I think this should be documented in Linux manpages.
I reckon someone should open a Mantis ticket with the Austin Group's issue tracker to get clarity on what I characterized as "sloppy" wording. Either it is and we can get the standard clarified, or I'm wrong and an authority can point out how. (Maybe both!)
I'm subscribed to the austin-group-l reflector and will take an action item to file this ticket. I'll try to do within a week. (I have a lot of old Unix books and would like to rummage around in them for any documented land mines in this area.)
[...]
Quoted 34 lines
Quoted 34 lines
Thanks for taking that part. It would be really nice if austin group can clarify how the whole situation is in a non-confusing way.
Anyway, inode number is always connected to the specific mounted filesystem. So when the application is doing something with inodes, it always needs a pair (
dev_t,ino_t) unless inodes belongs to same fs dev.
readdir()andgetdents()returns justino_t, and without knowledge ofdev_t, applications cannot use returnedino_tfor anything useful. On "historical" implementations, thedev_tcan be fetched for example by onefstat(dir_fd, &st)call asdev_twould be same for all readdir and getdents entries. But on non-"historical" implementation, it would be needed to callstat()on every one entry. For example/mnt/directory which usually contains just mountpoints, will contain entries where each one has inode number 2 (common inode number for root of fs).I looked into archives and I have found that this problem was already discussed in the past. Here are some email threads from coreutils:
https://lore.kernel.org/lkml/[email protected]/t/#u
https://public-inbox.org/bug-coreutils/[email protected]/t/#u
https://public-inbox.org/bug-coreutils/[email protected]/t/#u
https://public-inbox.org/bug-coreutils/[email protected]/
https://public-inbox.org/bug-coreutils/022320061637.4398.43FDE4D7000110830000112E22007507440A050E040D0C079D0A@comcast.net/Maybe they could be a good reference for future discussion by austin group.
Just my personal idea: If there would be some xgetdents syscall (like there statx over stat), it could return both inode numbers with
dev_tand application can take which it wants.
Quoted 8 lines
Quoted 6 lines
For example, NFS4's readdir can return both inode numbers (depending what is client asking). NFSv4.1 spec has nicely documented this problem with UNIX background of mount point crossing:
https://www.rfc-editor.org/rfc/rfc8881.html#section-5.8.2.23Pali
Hello Branden, did you have a time fill a ticket to austin group?
Not yet--I procrastinated and got preoccupied by exciting new undefined or ambiguously interpretable behavior of GNU troff.
https://www.mail-archive.com/[email protected]/msg20834.html
Quoted 1 line
If the ticket system is public, could you send a link for reference?
It is public...
https://austingroupbugs.net/view_all_bug_page.php
...but to file a ticket or comment on one, I believe you need to create an account. If you file a ticket yourself because you tire of waiting on me (which I'll understand), please let me know when you do so I can take this item off my to do list.
Regards,
Branden
Re: [PATCH v2] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Quoted 151 lines · On Friday 21 November 2025 17:39:57 G. Branden Robinson wrote:
Hi Pali,
Quoted 17 lines · Pali Rohár
Quoted 16 lines · On Wednesday 29 October 2025 20:34:13 Pali Rohár wrote:
Quoted 15 lines · On Wednesday 29 October 2025 02:00:39 G. Branden Robinson wrote:
Quoted 14 lines · Pali Rohár
If you are referring to the "bug" then it is written in informative part in RATIONALE section of readdir / POSIX.1-2024. I wrote in my first email in that email thread which Alejandro linked above.
Here is direct link to POSIX spec and below is quoted part:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/readdir.html"When returning a directory entry for the root of a mounted file system, some historical implementations of
readdir()returned the file serial number of the underlying mount point, rather than of the root of the mounted file system. This behavior is considered to be a bug, since the underlying file serial number has no significance to applications."[...]
Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
Quoted 7 lines
That part is in the "informative" section. I have not found anything in normative sections which would disallow usage of that "historical" behavior, so my understanding was that "historical" behavior is conforming too.
Please correct me if I'm wrong here, or if it should be understood in different way.
I can't speak for the Austin Group, but I don't read the text quite the same way. I interpret it as saying that some historical implementations of
readdir()would _not_ "return a pointer to a structure representing the directory entry at the current position in the directory stream specified by the argument dirp, and position the directory stream at the next entry." But I suspect that's not what it _intends_ to say.Instead, these implementations "returned [sic] the file serial number of the underlying mount point", which I interpret to mean that they would return a pointer to a _dirent_ struct whose _d_ino_ member was not the file serial number of the file (of directory type) named by the _d_name_ member but a pointer to a _dirent_ struct whose _d_ino_ member was the file serial number of the underlying mount point.
I think there are two conclusions we can reach here.
1. POSIX.1-2024 might be a little sloppy in the wording of its "RATIONALE" for this interface. Presumably no historical implementation's
readdir()returned a _d_ino_ number directly. (Though with all the exuberant integer/pointer punning that used to go in Unix, I'd wouldn't bet a lot of money that *no* implementation ever did.) I'll wager a nickel thatreaddir()has always, on every implementation, returned a pointer to a _dirent_ struct, and it is only the value of the _d_ino_ member of the pointed-to struct that some implementations have populated inconsistently when the entry is a directory that is a mount point.If I'm right, this is an example of the common linguistic error of synecdoche: confusing a container with (a subset of) its contents.
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
2. The behavior POSIX describes as buggy is, in fact, nonconforming.
Only two? I can image that somebody come up with another conclusion. (just a joke)
I wouldn't bet against your joke proving out in reality. ;-)
Quoted 6 lines
Quoted 6 lines
Anyway, I think that it is important to document the existing Linux behavior and whether it is POSIX-conforming or not is then second step. We can drop the information about POSIX conformity from manpage until we figure out how it is.
Quoted 1 line
Quoted 1 line
Also I have not read all those 4000 pages,
Pity the person who has. :) And mastery of all 4000+ pages should not be necessary for an implementor to make sense of a reference entry for a single function, command, or data object.
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 3 lines
so maybe there is something hidden. It is quite hard to find information about this topic and that is why I think this should be documented in Linux manpages.
I reckon someone should open a Mantis ticket with the Austin Group's issue tracker to get clarity on what I characterized as "sloppy" wording. Either it is and we can get the standard clarified, or I'm wrong and an authority can point out how. (Maybe both!)
I'm subscribed to the austin-group-l reflector and will take an action item to file this ticket. I'll try to do within a week. (I have a lot of old Unix books and would like to rummage around in them for any documented land mines in this area.)
[...]
Quoted 34 lines
Quoted 34 lines
Thanks for taking that part. It would be really nice if austin group can clarify how the whole situation is in a non-confusing way.
Anyway, inode number is always connected to the specific mounted filesystem. So when the application is doing something with inodes, it always needs a pair (
dev_t,ino_t) unless inodes belongs to same fs dev.
readdir()andgetdents()returns justino_t, and without knowledge ofdev_t, applications cannot use returnedino_tfor anything useful. On "historical" implementations, thedev_tcan be fetched for example by onefstat(dir_fd, &st)call asdev_twould be same for all readdir and getdents entries. But on non-"historical" implementation, it would be needed to callstat()on every one entry. For example/mnt/directory which usually contains just mountpoints, will contain entries where each one has inode number 2 (common inode number for root of fs).I looked into archives and I have found that this problem was already discussed in the past. Here are some email threads from coreutils:
https://lore.kernel.org/lkml/[email protected]/t/#u
https://public-inbox.org/bug-coreutils/[email protected]/t/#u
https://public-inbox.org/bug-coreutils/[email protected]/t/#u
https://public-inbox.org/bug-coreutils/[email protected]/
https://public-inbox.org/bug-coreutils/022320061637.4398.43FDE4D7000110830000112E22007507440A050E040D0C079D0A@comcast.net/Maybe they could be a good reference for future discussion by austin group.
Just my personal idea: If there would be some xgetdents syscall (like there statx over stat), it could return both inode numbers with
dev_tand application can take which it wants.Quoted 8 lines
Quoted 6 lines
For example, NFS4's readdir can return both inode numbers (depending what is client asking). NFSv4.1 spec has nicely documented this problem with UNIX background of mount point crossing:
https://www.rfc-editor.org/rfc/rfc8881.html#section-5.8.2.23Pali
Hello Branden, did you have a time fill a ticket to austin group?
Not yet--I procrastinated and got preoccupied by exciting new undefined or ambiguously interpretable behavior of GNU troff.
https://www.mail-archive.com/[email protected]/msg20834.html
Quoted 1 line
If the ticket system is public, could you send a link for reference?
It is public...
Quoted 7 lines
...but to file a ticket or comment on one, I believe you need to create an account. If you file a ticket yourself because you tire of waiting on me (which I'll understand), please let me know when you do so I can take this item off my to do list.
Regards,
Branden
You are experienced with austin group, so I will let this to you. I'm fine with waiting here.
Jan Kara
reviewerRe: [PATCH v2] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
In reply to Alejandro ColomarQuoted 10 lines · Alejandro Colomar
Suggested-by Pali Rohár <[email protected]>Co-authored-by Pali Rohár <[email protected]>Cc "G. Branden Robinson" <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>---
Hi Jan,
Would you mind reviewing this? The thread started here:
<https://lore.kernel.org/linux-man/20250525103344.fe27ugiytfyoadz5@pali/T/#u>.
The changes look correct to me but the wording is a bit confusing. Let me try to suggest some improvements.
...
Quoted 20 lines
man/man3/readdir.3 +11
-1@@ -58,7 +58,27 @@ .SH DESCRIPTION structure are as follows: .TP .I .d_ino -This is the inode number of the file. +This is the inode number of the file, +which belongs to the filesystem +.I .st_dev +(see +.BR stat (3type)) +of the directory on which +.BR readdir () +was called. +If the directory entry is the mount point, +then +.I .d_ino
man/man3/readdir.3 .SH DESCRIPTION · line 81
Quoted 10 lines
man/man3/readdir.3 +10
-0+differs from +.IR .st_ino : +.I .d_ino +is the inode number of the underlying mount point, +while +.I .st_ino +is the inode number of the mounted file system. +According to POSIX, +this Linux behavior is considered to be a bug, +but is nevertheless conforming.
I'd suggest:
This is the inode number of the file in the file system containing the directory on which readdir() was called. If the directory entry is the mount point, then .d_ino differs from .st_ino returned by stat(3type) on this file: .d_ino is the inode number of the mount point, while .st_ino is the inode number of the root directory of the mounted file system. According to POSIX, this Linux behavior is considered to be a bug, but is nevertheless conforming.
Quoted 14 lines
man/man3type/stat.3type +5
-1@@ -66,7 +66,21 @@ .SH DESCRIPTION macros may be useful to decompose the device ID in this field.) .TP .I .st_ino -This field contains the file's inode number. +This field contains the file's inode number, +which belongs to the +.IR .st_dev . +If +.BR stat (2)
man/man3type/stat.3type .SH DESCRIPTION · line 83
Quoted 10 lines
man/man3type/stat.3type +10
-0+was called on the mount point, +then +.I .d_ino +differs from +.IR .st_ino : +.I .d_ino +is the inode number of the underlying mount point, +while +.I .st_ino +is the inode number of the mounted file system.
Here I'd suggest:
This field contains the file's inode number in the file system on .st_dev. If stat(2) was called on the mount point, then .st_ino differs from .d_ino returned by readdir(3) for the corresponding directory entry in the parent directory. In this case .st_ino is the inode number of the root directory of the mounted file system while .d_ino is the inode number of the mount point in the parent file system.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Alejandro Colomar
maintainerPATCH v3 1/1 man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
In reply to Alejandro Colomar---
Hi Jan,
I've put your suggestions into the patch. I've also removed the sentence about POSIX, as Pali discussed with Branden.
At the bottom of the email is the range-diff against the previous version.
Have a lovely day!
Alex
man/man3/readdir.3 | 19 ++++++++++++++++++- man/man3type/stat.3type | 20 +++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-)
man/man3/readdir.3 +18 -1
@@ -58,7 +58,24 @@ .SH DESCRIPTION structure are as follows: .TP .I .d_ino -This is the inode number of the file. +This is the inode number of the file +in the filesystem containing +the directory on which +.BR readdir () +was called. +If the directory entry is the mount point, +then +.I .d_ino +differs from +.I .st_ino +returned by +.BR stat (2) +on this file: +.I .d_ino +is the inode number of the mount point, +while +.I .st_ino +is the inode number of the root directory of the mounted filesystem. .TP .I .d_off The value returned in
man/man3type/stat.3type +19 -1
@@ -66,7 +66,25 @@ .SH DESCRIPTION macros may be useful to decompose the device ID in this field.) .TP .I .st_ino -This field contains the file's inode number. +This field contains the file's inode number +in the filesystem on +.IR .st_dev . +If +.BR stat (2) +was called on the mount point, +then +.I .st_ino +differs from +.I .d_ino +returned by +.BR readdir (3) +for the corresponding directory entry in the parent directory. +In this case, +.I .st_ino +is the inode number of the root directory of the mounted filesystem, +while +.I .d_ino +is the inode number of the mount point in the parent filesystem. .TP .I .st_mode This field contains the file type and mode.
Range-diff against v2:
1: d3eeebe81 ! 1: bfa7e72ea man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
@@ Commit message
+ Co-authored-by: Jan Kara <[email protected]>
@@ man/man3/readdir.3: .SH DESCRIPTION
.TP
.I .d_ino
-This is the inode number of the file.
-+This is the inode number of the file,
-+which belongs to the filesystem
-+.I .st_dev
-+(see
-+.BR stat (3type))
-+of the directory on which
++This is the inode number of the file
++in the filesystem containing
++the directory on which
+.BR readdir ()
+was called.
+If the directory entry is the mount point,
+then
+.I .d_ino
+differs from
-+.IR .st_ino :
++.I .st_ino
++returned by
++.BR stat (2)
++on this file:
+.I .d_ino
-+is the inode number of the underlying mount point,
++is the inode number of the mount point,
+while
+.I .st_ino
-+is the inode number of the mounted file system. -+According to POSIX,
-+this Linux behavior is considered to be a bug,
-+but is nevertheless conforming.
++is the inode number of the root directory of the mounted filesystem.
.TP
.I .d_off
The value returned in
@@ man/man3type/stat.3type: .SH DESCRIPTION
.TP
.I .st_ino
-This field contains the file's inode number.
-+This field contains the file's inode number,
-+which belongs to the
++This field contains the file's inode number
++in the filesystem on
+.IR .st_dev .
+If
+.BR stat (2)
+was called on the mount point,
+then
-+.I .d_ino
-+differs from
-+.IR .st_ino :
-+.I .d_ino
-+is the inode number of the underlying mount point, -+while
+.I .st_ino
-+is the inode number of the mounted file system. ++differs from
++.I .d_ino
++returned by
++.BR readdir (3)
++for the corresponding directory entry in the parent directory. ++In this case,
++.I .st_ino
++is the inode number of the root directory of the mounted filesystem, ++while
++.I .d_ino
++is the inode number of the mount point in the parent filesystem.
.TP
.I .st_mode
This field contains the file type and mode.
base-commit: f305f7647d5cf62e7e764fb7a25c4926160c594f
Signature · 1 line
2.51.0
Re: [PATCH v3] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Quoted 8 lines · Alejandro Colomar
Suggested-by Pali Rohár <[email protected]>Co-authored-by Pali Rohár <[email protected]>Co-authored-by Jan Kara <[email protected]>Cc "G. Branden Robinson" <[email protected]>Cc <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>---
Quoted 7 lines
Hi Jan,
I've put your suggestions into the patch. I've also removed the sentence about POSIX, as Pali discussed with Branden.
At the bottom of the email is the range-diff against the previous version.
Thanks! The patch looks good. Feel free to add:
Honza
Quoted 158 lines
Have a lovely day!
Alexman/man3/readdir.3 | 19 ++++++++++++++++++- man/man3type/stat.3type | 20 +++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-)man/man3/readdir.3 +18
-1@@ -58,7 +58,24 @@ .SH DESCRIPTION structure are as follows: .TP .I .d_ino -This is the inode number of the file. +This is the inode number of the file +in the filesystem containing +the directory on which +.BR readdir () +was called. +If the directory entry is the mount point, +then +.I .d_ino +differs from +.I .st_ino +returned by +.BR stat (2) +on this file: +.I .d_ino +is the inode number of the mount point, +while +.I .st_ino +is the inode number of the root directory of the mounted filesystem. .TP .I .d_off The value returned inman/man3type/stat.3type +19
-1@@ -66,7 +66,25 @@ .SH DESCRIPTION macros may be useful to decompose the device ID in this field.) .TP .I .st_ino -This field contains the file's inode number. +This field contains the file's inode number +in the filesystem on +.IR .st_dev . +If +.BR stat (2) +was called on the mount point, +then +.I .st_ino +differs from +.I .d_ino +returned by +.BR readdir (3) +for the corresponding directory entry in the parent directory. +In this case, +.I .st_ino +is the inode number of the root directory of the mounted filesystem, +while +.I .d_ino +is the inode number of the mount point in the parent filesystem. .TP .I .st_mode This field contains the file type and mode.Range-diff against v2:
1:d3eeebe81! 1:bfa7e72eaman/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
@@ Commit messageSuggested-by Pali Rohár <[email protected]>Co-authored-by Pali Rohár <[email protected]>+ Co-authored-by: Jan Kara <[email protected]>
Cc "G. Branden Robinson" <[email protected]>Cc <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>@@ man/man3/readdir.3: .SH DESCRIPTION
.TP
.I .d_ino
-This is the inode number of the file.
-+This is the inode number of the file,
-+which belongs to the filesystem
-+.I .st_dev
-+(see
-+.BR stat (3type))
-+of the directory on which
++This is the inode number of the file
++in the filesystem containing
++the directory on which
+.BR readdir ()
+was called.
+If the directory entry is the mount point,
+then
+.I .d_ino
+differs from
-+.IR .st_ino :
++.I .st_ino
++returned by
++.BR stat (2)
++on this file:
+.I .d_ino
-+is the inode number of the underlying mount point,
++is the inode number of the mount point,
+while
+.I .st_ino
-+is the inode number of the mounted file system. -+According to POSIX,
-+this Linux behavior is considered to be a bug,
-+but is nevertheless conforming.
++is the inode number of the root directory of the mounted filesystem.
.TP
.I .d_off
The value returned in
@@ man/man3type/stat.3type: .SH DESCRIPTION
.TP
.I .st_ino
-This field contains the file's inode number.
-+This field contains the file's inode number,
-+which belongs to the
++This field contains the file's inode number
++in the filesystem on
+.IR .st_dev .
+If
+.BR stat (2)
+was called on the mount point,
+then
-+.I .d_ino
-+differs from
-+.IR .st_ino :
-+.I .d_ino
-+is the inode number of the underlying mount point, -+while
+.I .st_ino
-+is the inode number of the mounted file system. ++differs from
++.I .d_ino
++returned by
++.BR readdir (3)
++for the corresponding directory entry in the parent directory. ++In this case,
++.I .st_ino
++is the inode number of the root directory of the mounted filesystem, ++while
++.I .d_ino
++is the inode number of the mount point in the parent filesystem.
.TP
.I .st_mode
This field contains the file type and mode.base-commit:
f305f7647d5cf62e7e764fb7a25c4926160c594fSignature · 1 line
2.51.0
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Alejandro Colomar
maintainerRe: [PATCH v3] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Hi Jan, Pali,
Quoted 14 lines · Jan Kara
Quoted 13 lines · Alejandro Colomar
Suggested-by Pali Rohár <[email protected]>Co-authored-by Pali Rohár <[email protected]>Co-authored-by Jan Kara <[email protected]>Cc "G. Branden Robinson" <[email protected]>Cc <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>---
Hi Jan,
I've put your suggestions into the patch. I've also removed the sentence about POSIX, as Pali discussed with Branden.
Quoted 6 lines
Quoted 2 lines
At the bottom of the email is the range-diff against the previous version.
Thanks! The patch looks good. Feel free to add:
Reviewed-by Jan Kara <[email protected]>
Thanks!
Pali, would you mind signing the patch? One you do, I'll merge.
Cheers,
Alex
Quoted 164 lines
Honza
Quoted 158 lines
Have a lovely day!
Alexman/man3/readdir.3 | 19 ++++++++++++++++++- man/man3type/stat.3type | 20 +++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-)man/man3/readdir.3 +18
-1@@ -58,7 +58,24 @@ .SH DESCRIPTION structure are as follows: .TP .I .d_ino -This is the inode number of the file. +This is the inode number of the file +in the filesystem containing +the directory on which +.BR readdir () +was called. +If the directory entry is the mount point, +then +.I .d_ino +differs from +.I .st_ino +returned by +.BR stat (2) +on this file: +.I .d_ino +is the inode number of the mount point, +while +.I .st_ino +is the inode number of the root directory of the mounted filesystem. .TP .I .d_off The value returned inman/man3type/stat.3type +19
-1@@ -66,7 +66,25 @@ .SH DESCRIPTION macros may be useful to decompose the device ID in this field.) .TP .I .st_ino -This field contains the file's inode number. +This field contains the file's inode number +in the filesystem on +.IR .st_dev . +If +.BR stat (2) +was called on the mount point, +then +.I .st_ino +differs from +.I .d_ino +returned by +.BR readdir (3) +for the corresponding directory entry in the parent directory. +In this case, +.I .st_ino +is the inode number of the root directory of the mounted filesystem, +while +.I .d_ino +is the inode number of the mount point in the parent filesystem. .TP .I .st_mode This field contains the file type and mode.Range-diff against v2:
1:d3eeebe81! 1:bfa7e72eaman/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
@@ Commit messageSuggested-by Pali Rohár <[email protected]>Co-authored-by Pali Rohár <[email protected]>+ Co-authored-by: Jan Kara <[email protected]>
Cc "G. Branden Robinson" <[email protected]>Cc <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>@@ man/man3/readdir.3: .SH DESCRIPTION
.TP
.I .d_ino
-This is the inode number of the file.
-+This is the inode number of the file,
-+which belongs to the filesystem
-+.I .st_dev
-+(see
-+.BR stat (3type))
-+of the directory on which
++This is the inode number of the file
++in the filesystem containing
++the directory on which
+.BR readdir ()
+was called.
+If the directory entry is the mount point,
+then
+.I .d_ino
+differs from
-+.IR .st_ino :
++.I .st_ino
++returned by
++.BR stat (2)
++on this file:
+.I .d_ino
-+is the inode number of the underlying mount point,
++is the inode number of the mount point,
+while
+.I .st_ino
-+is the inode number of the mounted file system. -+According to POSIX,
-+this Linux behavior is considered to be a bug,
-+but is nevertheless conforming.
++is the inode number of the root directory of the mounted filesystem.
.TP
.I .d_off
The value returned in
@@ man/man3type/stat.3type: .SH DESCRIPTION
.TP
.I .st_ino
-This field contains the file's inode number.
-+This field contains the file's inode number,
-+which belongs to the
++This field contains the file's inode number
++in the filesystem on
+.IR .st_dev .
+If
+.BR stat (2)
+was called on the mount point,
+then
-+.I .d_ino
-+differs from
-+.IR .st_ino :
-+.I .d_ino
-+is the inode number of the underlying mount point, -+while
+.I .st_ino
-+is the inode number of the mounted file system. ++differs from
++.I .d_ino
++returned by
++.BR readdir (3)
++for the corresponding directory entry in the parent directory. ++In this case,
++.I .st_ino
++is the inode number of the root directory of the mounted filesystem, ++while
++.I .d_ino
++is the inode number of the mount point in the parent filesystem.
.TP
.I .st_mode
This field contains the file type and mode.base-commit:
f305f7647d5cf62e7e764fb7a25c4926160c594fSignature · 1 line
2.51.0Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Signature · 2 lines
<https://www.alejandro-colomar.es> Use port 80 (that is, <...:80/>).
Pali Rohár
Reviewed-byRe: [PATCH v3] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Quoted 20 lines · On Friday 31 October 2025 12:31:41 Alejandro Colomar wrote:
Hi Jan, Pali,
Quoted 17 lines · Jan Kara
Quoted 15 lines · Alejandro Colomar
Suggested-by Pali Rohár <[email protected]>Co-authored-by Pali Rohár <[email protected]>Co-authored-by Jan Kara <[email protected]>Cc "G. Branden Robinson" <[email protected]>Cc <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>---
Hi Jan,
I've put your suggestions into the patch. I've also removed the sentence about POSIX, as Pali discussed with Branden.
At the bottom of the email is the range-diff against the previous version.
Quoted 7 lines
Quoted 3 lines
Thanks! The patch looks good. Feel free to add:
Reviewed-by Jan Kara <[email protected]>Thanks!
Pali, would you mind signing the patch? One you do, I'll merge.
Hello, yes, that this fine.
For future improvements, it would be nice to adjust also other manpages which refers to inode numbers:
git grep -E '\<st_ino\>|\<stx_ino\>|\<d_ino\>'
Quoted 172 lines
Cheers,
AlexQuoted 164 lines
Honza
Quoted 158 lines
Have a lovely day!
Alexman/man3/readdir.3 | 19 ++++++++++++++++++- man/man3type/stat.3type | 20 +++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-)man/man3/readdir.3 +18
-1@@ -58,7 +58,24 @@ .SH DESCRIPTION structure are as follows: .TP .I .d_ino -This is the inode number of the file. +This is the inode number of the file +in the filesystem containing +the directory on which +.BR readdir () +was called. +If the directory entry is the mount point, +then +.I .d_ino +differs from +.I .st_ino +returned by +.BR stat (2) +on this file: +.I .d_ino +is the inode number of the mount point, +while +.I .st_ino +is the inode number of the root directory of the mounted filesystem. .TP .I .d_off The value returned inman/man3type/stat.3type +19
-1@@ -66,7 +66,25 @@ .SH DESCRIPTION macros may be useful to decompose the device ID in this field.) .TP .I .st_ino -This field contains the file's inode number. +This field contains the file's inode number +in the filesystem on +.IR .st_dev . +If +.BR stat (2) +was called on the mount point, +then +.I .st_ino +differs from +.I .d_ino +returned by +.BR readdir (3) +for the corresponding directory entry in the parent directory. +In this case, +.I .st_ino +is the inode number of the root directory of the mounted filesystem, +while +.I .d_ino +is the inode number of the mount point in the parent filesystem. .TP .I .st_mode This field contains the file type and mode.Range-diff against v2:
1:d3eeebe81! 1:bfa7e72eaman/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
@@ Commit messageSuggested-by Pali Rohár <[email protected]>Co-authored-by Pali Rohár <[email protected]>+ Co-authored-by: Jan Kara <[email protected]>
Cc "G. Branden Robinson" <[email protected]>Cc <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>@@ man/man3/readdir.3: .SH DESCRIPTION
.TP
.I .d_ino
-This is the inode number of the file.
-+This is the inode number of the file,
-+which belongs to the filesystem
-+.I .st_dev
-+(see
-+.BR stat (3type))
-+of the directory on which
++This is the inode number of the file
++in the filesystem containing
++the directory on which
+.BR readdir ()
+was called.
+If the directory entry is the mount point,
+then
+.I .d_ino
+differs from
-+.IR .st_ino :
++.I .st_ino
++returned by
++.BR stat (2)
++on this file:
+.I .d_ino
-+is the inode number of the underlying mount point,
++is the inode number of the mount point,
+while
+.I .st_ino
-+is the inode number of the mounted file system. -+According to POSIX,
-+this Linux behavior is considered to be a bug,
-+but is nevertheless conforming.
++is the inode number of the root directory of the mounted filesystem.
.TP
.I .d_off
The value returned in
@@ man/man3type/stat.3type: .SH DESCRIPTION
.TP
.I .st_ino
-This field contains the file's inode number.
-+This field contains the file's inode number,
-+which belongs to the
++This field contains the file's inode number
++in the filesystem on
+.IR .st_dev .
+If
+.BR stat (2)
+was called on the mount point,
+then
-+.I .d_ino
-+differs from
-+.IR .st_ino :
-+.I .d_ino
-+is the inode number of the underlying mount point, -+while
+.I .st_ino
-+is the inode number of the mounted file system. ++differs from
++.I .d_ino
++returned by
++.BR readdir (3)
++for the corresponding directory entry in the parent directory. ++In this case,
++.I .st_ino
++is the inode number of the root directory of the mounted filesystem, ++while
++.I .d_ino
++is the inode number of the mount point in the parent filesystem.
.TP
.I .st_mode
This field contains the file type and mode.base-commit:
f305f7647d5cf62e7e764fb7a25c4926160c594fSignature · 1 line
2.51.0Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CRSignature · 2 lines
<https://www.alejandro-colomar.es> Use port 80 (that is, <...:80/>).
Re: [PATCH v3] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
In reply to Alejandro ColomarQuoted 29 lines · Alejandro Colomar
Suggested-by Pali Rohár <[email protected]>Co-authored-by Pali Rohár <[email protected]>Co-authored-by Jan Kara <[email protected]>Cc "G. Branden Robinson" <[email protected]>Cc <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>---
Hi Jan,
I've put your suggestions into the patch. I've also removed the sentence about POSIX, as Pali discussed with Branden.
At the bottom of the email is the range-diff against the previous version.
Have a lovely day!
Alexman/man3/readdir.3 | 19 ++++++++++++++++++- man/man3type/stat.3type | 20 +++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-)man/man3/readdir.3 +0
-0
man/man3/readdir.3 .SH DESCRIPTION · line 66
Quoted 10 lines
man/man3/readdir.3 +6
-1@@ -58,7 +58,24 @@ .SH DESCRIPTION structure are as follows: .TP .I .d_ino -This is the inode number of the file. +This is the inode number of the file +in the filesystem containing +the directory on which +.BR readdir () +was called. +If the directory entry is the mount point,
nitpicking english:
"...is a mount point," ?
--D
Quoted 135 lines
man/man3/readdir.3 +12
-0+then +.I .d_ino +differs from +.I .st_ino +returned by +.BR stat (2) +on this file: +.I .d_ino +is the inode number of the mount point, +while +.I .st_ino +is the inode number of the root directory of the mounted filesystem. .TP .I .d_off The value returned inman/man3type/stat.3type +19
-1@@ -66,7 +66,25 @@ .SH DESCRIPTION macros may be useful to decompose the device ID in this field.) .TP .I .st_ino -This field contains the file's inode number. +This field contains the file's inode number +in the filesystem on +.IR .st_dev . +If +.BR stat (2) +was called on the mount point, +then +.I .st_ino +differs from +.I .d_ino +returned by +.BR readdir (3) +for the corresponding directory entry in the parent directory. +In this case, +.I .st_ino +is the inode number of the root directory of the mounted filesystem, +while +.I .d_ino +is the inode number of the mount point in the parent filesystem. .TP .I .st_mode This field contains the file type and mode.Range-diff against v2:
1:d3eeebe81! 1:bfa7e72eaman/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
@@ Commit messageSuggested-by Pali Rohár <[email protected]>Co-authored-by Pali Rohár <[email protected]>+ Co-authored-by: Jan Kara <[email protected]>
Cc "G. Branden Robinson" <[email protected]>Cc <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>@@ man/man3/readdir.3: .SH DESCRIPTION
.TP
.I .d_ino
-This is the inode number of the file.
-+This is the inode number of the file,
-+which belongs to the filesystem
-+.I .st_dev
-+(see
-+.BR stat (3type))
-+of the directory on which
++This is the inode number of the file
++in the filesystem containing
++the directory on which
+.BR readdir ()
+was called.
+If the directory entry is the mount point,
+then
+.I .d_ino
+differs from
-+.IR .st_ino :
++.I .st_ino
++returned by
++.BR stat (2)
++on this file:
+.I .d_ino
-+is the inode number of the underlying mount point,
++is the inode number of the mount point,
+while
+.I .st_ino
-+is the inode number of the mounted file system. -+According to POSIX,
-+this Linux behavior is considered to be a bug,
-+but is nevertheless conforming.
++is the inode number of the root directory of the mounted filesystem.
.TP
.I .d_off
The value returned in
@@ man/man3type/stat.3type: .SH DESCRIPTION
.TP
.I .st_ino
-This field contains the file's inode number.
-+This field contains the file's inode number,
-+which belongs to the
++This field contains the file's inode number
++in the filesystem on
+.IR .st_dev .
+If
+.BR stat (2)
+was called on the mount point,
+then
-+.I .d_ino
-+differs from
-+.IR .st_ino :
-+.I .d_ino
-+is the inode number of the underlying mount point, -+while
+.I .st_ino
-+is the inode number of the mounted file system. ++differs from
++.I .d_ino
++returned by
++.BR readdir (3)
++for the corresponding directory entry in the parent directory. ++In this case,
++.I .st_ino
++is the inode number of the root directory of the mounted filesystem, ++while
++.I .d_ino
++is the inode number of the mount point in the parent filesystem.
.TP
.I .st_mode
This field contains the file type and mode.base-commit:
f305f7647d5cf62e7e764fb7a25c4926160c594fSignature · 1 line
2.51.0
Alejandro Colomar
maintainerRe: [PATCH v3] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Hi Darrick,
Quoted 43 lines · Darrick J. Wong
Quoted 29 lines · Alejandro Colomar
Suggested-by Pali Rohár <[email protected]>Co-authored-by Pali Rohár <[email protected]>Co-authored-by Jan Kara <[email protected]>Cc "G. Branden Robinson" <[email protected]>Cc <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>---
Hi Jan,
I've put your suggestions into the patch. I've also removed the sentence about POSIX, as Pali discussed with Branden.
At the bottom of the email is the range-diff against the previous version.
Have a lovely day!
Alexman/man3/readdir.3 | 19 ++++++++++++++++++- man/man3type/stat.3type | 20 +++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-)man/man3/readdir.3 +0
-0man/man3/readdir.3 .SH DESCRIPTION · line 66
Quoted 10 lines
man/man3/readdir.3 +6
-1@@ -58,7 +58,24 @@ .SH DESCRIPTION structure are as follows: .TP .I .d_ino -This is the inode number of the file. +This is the inode number of the file +in the filesystem containing +the directory on which +.BR readdir () +was called. +If the directory entry is the mount point,nitpicking english:
Quoted 1 line
"...is a mount point," ?
I think you're right. Unless Jan and Pali meant something more specific. Jan, Pali, can you please confirm?
Have a lovely night!
Alex
Quoted 138 lines
--D
Quoted 135 lines
man/man3/readdir.3 +12
-0+then +.I .d_ino +differs from +.I .st_ino +returned by +.BR stat (2) +on this file: +.I .d_ino +is the inode number of the mount point, +while +.I .st_ino +is the inode number of the root directory of the mounted filesystem. .TP .I .d_off The value returned inman/man3type/stat.3type +19
-1@@ -66,7 +66,25 @@ .SH DESCRIPTION macros may be useful to decompose the device ID in this field.) .TP .I .st_ino -This field contains the file's inode number. +This field contains the file's inode number +in the filesystem on +.IR .st_dev . +If +.BR stat (2) +was called on the mount point, +then +.I .st_ino +differs from +.I .d_ino +returned by +.BR readdir (3) +for the corresponding directory entry in the parent directory. +In this case, +.I .st_ino +is the inode number of the root directory of the mounted filesystem, +while +.I .d_ino +is the inode number of the mount point in the parent filesystem. .TP .I .st_mode This field contains the file type and mode.Range-diff against v2:
1:d3eeebe81! 1:bfa7e72eaman/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
@@ Commit messageSuggested-by Pali Rohár <[email protected]>Co-authored-by Pali Rohár <[email protected]>+ Co-authored-by: Jan Kara <[email protected]>
Cc "G. Branden Robinson" <[email protected]>Cc <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>@@ man/man3/readdir.3: .SH DESCRIPTION
.TP
.I .d_ino
-This is the inode number of the file.
-+This is the inode number of the file,
-+which belongs to the filesystem
-+.I .st_dev
-+(see
-+.BR stat (3type))
-+of the directory on which
++This is the inode number of the file
++in the filesystem containing
++the directory on which
+.BR readdir ()
+was called.
+If the directory entry is the mount point,
+then
+.I .d_ino
+differs from
-+.IR .st_ino :
++.I .st_ino
++returned by
++.BR stat (2)
++on this file:
+.I .d_ino
-+is the inode number of the underlying mount point,
++is the inode number of the mount point,
+while
+.I .st_ino
-+is the inode number of the mounted file system. -+According to POSIX,
-+this Linux behavior is considered to be a bug,
-+but is nevertheless conforming.
++is the inode number of the root directory of the mounted filesystem.
.TP
.I .d_off
The value returned in
@@ man/man3type/stat.3type: .SH DESCRIPTION
.TP
.I .st_ino
-This field contains the file's inode number.
-+This field contains the file's inode number,
-+which belongs to the
++This field contains the file's inode number
++in the filesystem on
+.IR .st_dev .
+If
+.BR stat (2)
+was called on the mount point,
+then
-+.I .d_ino
-+differs from
-+.IR .st_ino :
-+.I .d_ino
-+is the inode number of the underlying mount point, -+while
+.I .st_ino
-+is the inode number of the mounted file system. ++differs from
++.I .d_ino
++returned by
++.BR readdir (3)
++for the corresponding directory entry in the parent directory. ++In this case,
++.I .st_ino
++is the inode number of the root directory of the mounted filesystem, ++while
++.I .d_ino
++is the inode number of the mount point in the parent filesystem.
.TP
.I .st_mode
This field contains the file type and mode.base-commit:
f305f7647d5cf62e7e764fb7a25c4926160c594fSignature · 1 line
2.51.0
Signature · 2 lines
<https://www.alejandro-colomar.es> Use port 80 (that is, <...:80/>).
Jan Kara
reviewerRe: [PATCH v3] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Quoted 46 lines · Alejandro Colomar
Hi Darrick,
Quoted 43 lines · Darrick J. Wong
Quoted 29 lines · Alejandro Colomar
Suggested-by Pali Rohár <[email protected]>Co-authored-by Pali Rohár <[email protected]>Co-authored-by Jan Kara <[email protected]>Cc "G. Branden Robinson" <[email protected]>Cc <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>---
Hi Jan,
I've put your suggestions into the patch. I've also removed the sentence about POSIX, as Pali discussed with Branden.
At the bottom of the email is the range-diff against the previous version.
Have a lovely day!
Alexman/man3/readdir.3 | 19 ++++++++++++++++++- man/man3type/stat.3type | 20 +++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-)man/man3/readdir.3 +0
-0man/man3/readdir.3 .SH DESCRIPTION · line 66
Quoted 10 lines
man/man3/readdir.3 +6
-1@@ -58,7 +58,24 @@ .SH DESCRIPTION structure are as follows: .TP .I .d_ino -This is the inode number of the file. +This is the inode number of the file +in the filesystem containing +the directory on which +.BR readdir () +was called. +If the directory entry is the mount point,nitpicking english:
Quoted 4 lines
Quoted 1 line
"...is a mount point," ?
I think you're right. Unless Jan and Pali meant something more specific. Jan, Pali, can you please confirm?
Yes, Darrick is right :).
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Alejandro Colomar
maintainerRe: [PATCH v3] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Hi Jan, Darrick, Pali,
Quoted 5 lines · Jan Kara
Quoted 4 lines · Alejandro Colomar
Quoted 3 lines · Darrick J. Wong
Quoted 1 line · Alejandro Colomar
+If the directory entry is the mount point,
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
nitpicking english:
"...is a mount point," ?
I think you're right. Unless Jan and Pali meant something more specific. Jan, Pali, can you please confirm?
Yes, Darrick is right :).
Thanks! I've amended the patch with that, added the Reviewed-by tags, and pushed.
Have a lovely day!
Alex
Signature · 2 lines
<https://www.alejandro-colomar.es> Use port 80 (that is, <...:80/>).