[Bug 233161] bsd find finds only 32756 directories with '-type d' switch

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Nov 12 14:23:16 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233161

sigsys at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sigsys at gmail.com

--- Comment #1 from sigsys at gmail.com ---
This seems to be caused by an optimization in lib/libc/gen/fts.c that assumes
that there can be no more subdirectories in a given directory than indicated by
st_nlink (since each subdirectory increases the link count of the parent with
its ".." entry).  This doesn't work when st_nlink gets capped by ZFS.  AFAIK,
UFS does not allow more subdirectories than st_nlink can count so the problem
does not happen there.

Removing "zfs" from ufslike_filesystems[] in fts.c should avoid the bug.  A
better fix would be to check if st_nlink seems saturated (with
pathconf(2)/_PC_LINK_MAX I guess) and disable the optimization only then.

nlink_t is 64 bits on 12.X so the problem probably doesn't exist there.

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


More information about the freebsd-bugs mailing list