[Bug 196405] mkdir mishandles st_nlink in ext4 directory with 64997 subdirectories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.kernel.org/show_bug.cgi?id=196405

--- Comment #8 from Paul Eggert (eggert@xxxxxxxxxxx) ---
(In reply to Theodore Tso from comment #1)
> In order to support a large
> number of directories, when we have a 16-bit link count field, we use
> a link count of 1 to mean, "lots".

Where is this behavior documented? I don't see it mentioned in
e2fsprogs/doc/libext2fs.texinfo. Where should I look?

> various userspace utilities that try to optimize
> directory walking by depending on the directory's link count to
> understand when they have found all of the subdirectories know that
> directory link count of 1 means "lots".

Although I've been contributing to the GNU core utilities for many years, this
behavior is news to me. I just checked the GNU coreutils source, and these
utilities do not know that 1 means "lots". Although the code happens to work,
it is pure luck. GNU findutils is similar.

The GNU C library's fts functions can misbehave on file systems where st_nlink
undercounts the number of subdirectories. To reproduce the problem, run the
program fts-test.c (attached to this bug report) in a fresh directory. On an
ext4 file system, the program outputs "0 needles found (should be 2)" and
fails, due to the incompatibility between ext4 st_nlink behavior and what the
GNU C library expects.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux