On Mar 30, 2005 20:43 +0100, David Malone wrote: > It seems that internally xfs uses a 32 bit field for the link count, > and the stat64 syscalls use a 32 bit field. These fields are copied > via the vattr structure in xfs_vnode.h, which uses a nlink_t for > the link count. However, in the kernel, I think this field is > actually of type __kernel_nlink_t which seems to be 16 bits on many > platforms. > > I've tested this on an i386 2.6.11 kernel and it seems that the > link count presented to userland wraps after 65536 subdirectories. > This naturally doesn't let you screw up the filesystem or anything, > but it does let you can hide files from find/fts, as demonstrated > below. The correct fix, used for reiserfs (and a patch for ext3 also) is to set i_nlink = 1 in case the filesystem count has wrapped. When nlink==1 the fts/find code no longer optimizes subdirectory traversal and checks each entries filetype to see if it should recurse. Cheers, Andreas -- Andreas Dilger Principal Software Engineer Cluster File Systems, Inc.
Attachment:
pgpy4qXbEWASA.pgp
Description: PGP signature
- Follow-Ups:
- Re: Directory link count wrapping on Linux/XFS/i386?
- From: Nathan Scott <[email protected]>
- Re: Directory link count wrapping on Linux/XFS/i386?
- References:
- Directory link count wrapping on Linux/XFS/i386?
- From: David Malone <[email protected]>
- Directory link count wrapping on Linux/XFS/i386?
- Prev by Date: Re: Can't use SYSFS for "Proprietry" driver modules !!!.
- Next by Date: [PATCH] Set MS_ACTIVE in isofs_fill_super()
- Previous by thread: Directory link count wrapping on Linux/XFS/i386?
- Next by thread: Re: Directory link count wrapping on Linux/XFS/i386?
- Index(es):