wrong hardlink count for /proc/PID directories
Hi,
Tested on some 2.6.[7-9] kernels: a stat call for a /proc/SOMEPID directory returns a hard link count of 3, which is invalid, since these directories have three subdirectories (attr, fd and task) and hence the hard link counter should be 5.
This causes at least 'find' (gnu findutils) to malfunction, it does not descend under /proc/SOMEPID/fd and /proc/SOMEPID/attr. See also:
https://savannah.gnu.org/bugs/index.php?func=detailitem&item_id=11379
bye,
Egmont
Quoted 10 lines
Hi,
Tested on some 2.6.[7-9] kernels: a stat call for a
/proc/SOMEPIDdirectory returns a hard link count of 3, which is invalid, since these directories have three subdirectories (attr, fd and task) and hence the hard link counter should be 5.This causes at least 'find' (gnu findutils) to malfunction, it does not descend under
/proc/SOMEPID/fdand/proc/SOMEPID/attr. See also:
https://savannah.gnu.org/bugs/index.php?func=detailitem&item_id=11379
You could try working around this by using -noleaf. (Which is by no means a solution.)
Hm, I have 2.6.8+.9-rc2, and /proc/1 for example has a link count of 3 which seems reasonable: ".", "fd" and "task".
Jan Engelhardt
Signature · 1 line
ENOSPC
Quoted 2 lines · Jan Engelhardt
Hm, I have 2.6.8+.9-rc2, and
/proc/1for example has a link count of 3 which seems reasonable: ".", "fd" and "task".
No, it'd have to be 4 in this case: "1" from "/proc", "." from "/proc/1", ".." from "/proc/1/fd" and ".." from "/proc/1/task" all point to "/proc/1". It should always be the number of real subdirectories plus two.
Just copy this directory recursively to a real filesystem and check the hardlink count there.
Signature · 1 line
Egmont
Followup to: <[email protected]> By author: Jan Engelhardt <[email protected]> In newsgroup: linux.dev.kernel
Quoted 7 lines
You could try working around this by using -noleaf. (Which is by no means a solution.)
Hm, I have 2.6.8+.9-rc2, and
/proc/1for example has a link count of 3 which seems reasonable: ".", "fd" and "task".
You're missing "attr", and you're not counting the directory entry from below.
directory + "." + "attr/.." + "fd/.." + "task/.." = 5.
It should either return the correct value or set it to 1.
-hpa