diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2025-10-30 20:18:17 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2025-10-30 20:18:38 +0000 |
| commit | 6c86379b0d0deb2750a662579f63d71ffa519e81 (patch) | |
| tree | 782b5364883aac92cc9c799f5f3fd7bbeadf4330 | |
| parent | 91f66f9b377e09f59f481e653d8f64120a183806 (diff) | |
pjdfstest: Fix link count test
This UFS-only test verifies that attempting to create more links than
permitted by the file system returns EMLINK, but has been broken ever
since UFS_LINK_MAX was increased because a) it hardcodes the previous
value of UFS_LINK_MAX, and b) the new value requires more space than
the test allocates, so it ends up getting ENOSPC instead of EMLINK.
* Switch to retrieving {PC_LINK_MAX} at runtime.
* Stop the test when we reach {PC_LINK_MAX} links. This ensures that
we don't go on for hours if the actual limit turns out to be much
higher than we anticipated (e.g. INT64_MAX on ZFS).
* Double the size of the test filesystem.
MFC after: 3 days
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Fixes: 35a301555bff ("Increase UFS/FFS maximum link count from 32767 to 65530.")
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D53442
| -rw-r--r-- | contrib/pjdfstest/tests/link/05.t | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/contrib/pjdfstest/tests/link/05.t b/contrib/pjdfstest/tests/link/05.t index 5a18c2103e1d..e6a7d1cc8201 100644 --- a/contrib/pjdfstest/tests/link/05.t +++ b/contrib/pjdfstest/tests/link/05.t @@ -2,7 +2,7 @@ # vim: filetype=sh noexpandtab ts=8 sw=8 # $FreeBSD: head/tools/regression/pjdfstest/tests/link/05.t 211352 2010-08-15 21:24:17Z pjd $ -desc="link returns EMLINK if the link count of the file named by name1 would exceed 32767" +desc="link returns EMLINK if the link count of the file named by name1 would exceed {PC_LINK_MAX}" dir=`dirname $0` . ${dir}/../misc.sh @@ -16,19 +16,20 @@ n1=`namegen` n2=`namegen` expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit +n=`mdconfig -a -n -t malloc -s 2m` || exit newfs -i 1 /dev/md${n} >/dev/null || exit mount /dev/md${n} ${n0} || exit +link_max=`${fstest} pathconf ${n0} _PC_LINK_MAX` expect 0 create ${n0}/${n1} 0644 i=1 -while :; do +while [ ${i} -le ${link_max} ]; do link ${n0}/${n1} ${n0}/${i} >/dev/null 2>&1 if [ $? -ne 0 ]; then break fi i=`expr $i + 1` done -test_check $i -eq 32767 +test_check $i -eq ${link_max} expect EMLINK link ${n0}/${n1} ${n0}/${n2} |
