Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Mar 1997 10:28:01 +0000 (GMT)
From:      Jeremy Prior <jez@netcraft.co.uk>
To:        bde@zeta.org.au (Bruce Evans)
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Hard Link Count too small!
Message-ID:  <199703111028.KAA00828@server.netcraft.co.uk>
In-Reply-To: <199703071739.EAA23773@godzilla.zeta.org.au> from Bruce Evans at "Mar 8, 97 04:39:51 am"

next in thread | previous in thread | raw e-mail | index | archive | help
# The limit is (bogusly) given by LINK_MAX in <sys/syslimits.h>.  This is
# supposed to give the system-wide limit, but it is really only the ufs
# limit.  You can probably safely increase it to slightly less than 65535.
# Don't make it 65535, since ufs_rename() temporarily increases the link
# count without checking the limit.

[Apologies for not replying sooner, but I spent most of the weekend
 resurrecting my test machine after a (hardware based) disk problem]

Thanks for this, but it doesn't quite work!  I bumped up the limit to 65530,
recompiled a kernel (this is on 2.1.7-stable btw), and (eventually) booted
from it.  I was able to create a new directory in the one containing 32767
links, but the rmdir gave me an inappropriate error message (something like
"invalid file descriptor" - this is from memory), and the entire directory
was miraculously empty!  A quick umount and fsck showed a zero length
directory, and 32765 unlinked ones!

Looking at sys/ufs/ufs/ufs_vnops.c, LINK_MAX is compared against ip->i_nlink
(ufs_link() and ufs_rename()), and further digging shows that i_nlink is a
#define for i_din.di_nlink (sys/ufs/ufs/inode.h) and di_nlink is a signed
short (sys/ufs/ufs/dinode.h)!

So, what are the implications of changing di_nlink to unsigned short
(or should that be u_int16_t?)?

# Bruce

jez
--
Jeremy Prior                                      <jez@netcraft.co.uk>
Netcraft,  Rockfield House,  Granville Road,  Bath,  BA1 9BQ,  England
Tel: +44-1225-447500                              Fax: +44-1225-448600



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703111028.KAA00828>