Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 03 May 2002 11:03:08 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Scott Hess <scott@avantgo.com>
Cc:        "Vladimir B. Grebenschikov" <vova@sw.ru>, fs@freebsd.org
Subject:   Re: Filesystem
Message-ID:  <3CD2D0DC.9B636A54@mindspring.com>
References:  <Pine.LNX.4.44.0205030959270.3919-100000@river.avantgo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Scott Hess wrote:
> Looks to me like Vladimir's supposition is correct for FFS:
> 
> scott@ganja2:test> uname -a
> FreeBSD ganja2.avantgo.com 4.5-RELEASE-p4 FreeBSD 4.5-RELEASE-p4 #0: Tue Apr 23 16:28:25 PDT 2002
> root@agdev2.avantgo.com:/avantgo/obj/avantgo/src/sys/GANJA  i386
> scott@ganja2:test> perl -e 'for (my $ii = 0; 1; $ii++) { mkdir(sprintf("%06u", $ii), 0755) || die "$!";}'
> Too many links at -e line 1.
> scott@ganja2:test> ls | wc
>    32765   32765  229355
> scott@ganja2:test> ls -ld .
> drwxr-xr-x  32767 scott  wheel  530944 May  3 10:23 .
> 
> [32767 is 32765 links from .. of subdirs, 1 for . of test, one for test in
> parent directory.]


Crap.

Forgot about the link count.

Yes, it's an int16_t.

It looks like it's signed for a single compare, so it could be
made unsigned, and the compare done against both 0 and 65535 (and/or
prevented from underflowing in the first place).

If you look at the stat man page, there's an nlink_t.

This is a u_int16_t.  So minimally, there is a limit of 65535 on
all FS's, period.

I believe this limit is common to all UNIX systems that use hard
links to do ".." processing.  Technically, it should be possible
to do this with affecting link count.  However, it's really easy
to open a directory and determine if there ar substirectories by
examining the link count on it, and to know how many there are by
examining the link count on it.

In any case, it's still an incredibly bad idea to have even a tenth
of that man objects in a single directory, period.

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-fs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CD2D0DC.9B636A54>