public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* wrong hardlink count for /proc/PID directories
@ 2004-12-22 22:16 Egmont Koblinger
  2004-12-22 22:42 ` Jan Engelhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Egmont Koblinger @ 2004-12-22 22:16 UTC (permalink / raw)
  To: linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: wrong hardlink count for /proc/PID directories
  2004-12-22 22:16 wrong hardlink count for /proc/PID directories Egmont Koblinger
@ 2004-12-22 22:42 ` Jan Engelhardt
  2004-12-22 23:02   ` Egmont Koblinger
  2004-12-30  1:12   ` H. Peter Anvin
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Engelhardt @ 2004-12-22 22:42 UTC (permalink / raw)
  To: Egmont Koblinger; +Cc: linux-kernel

>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

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
-- 
ENOSPC

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: wrong hardlink count for /proc/PID directories
  2004-12-22 22:42 ` Jan Engelhardt
@ 2004-12-22 23:02   ` Egmont Koblinger
  2004-12-30  1:12   ` H. Peter Anvin
  1 sibling, 0 replies; 4+ messages in thread
From: Egmont Koblinger @ 2004-12-22 23:02 UTC (permalink / raw)
  To: Jan Engelhardt

On Wed, Dec 22, 2004 at 11:42:33PM +0100, Jan Engelhardt wrote:

> 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".

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.



-- 
Egmont

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: wrong hardlink count for /proc/PID directories
  2004-12-22 22:42 ` Jan Engelhardt
  2004-12-22 23:02   ` Egmont Koblinger
@ 2004-12-30  1:12   ` H. Peter Anvin
  1 sibling, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2004-12-30  1:12 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <Pine.LNX.4.61.0412222340540.475@yvahk01.tjqt.qr>
By author:    Jan Engelhardt <jengelh@linux01.gwdg.de>
In newsgroup: linux.dev.kernel
> 
> 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".
> 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-12-30  1:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-22 22:16 wrong hardlink count for /proc/PID directories Egmont Koblinger
2004-12-22 22:42 ` Jan Engelhardt
2004-12-22 23:02   ` Egmont Koblinger
2004-12-30  1:12   ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox