Module Name:    src
Committed By:   simonb
Date:           Mon Sep  6 08:37:43 UTC 2021

Modified Files:
        src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c

Log Message:
Clamp zfs nlinks at UINT32_MAX (nlink_t max) instead of (much) smaller
16-bit LINK_MAX until we bump LINK_MAX.  Fixes fts(3) problems with
"rm -rf" on zfs directories with > 32766 subdirectories.

Thanks mlelstv@ and mrg@ for helping debug this.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 \
    src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.74 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.75
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.74	Sun Jul 18 23:57:13 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Mon Sep  6 08:37:43 2021
@@ -3116,7 +3116,8 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, i
 		links = zp->z_links + 1;
 	else
 		links = zp->z_links;
-	vap->va_nlink = MIN(links, LINK_MAX);	/* nlink_t limit! */
+	/* XXX NetBSD: use LINK_MAX when that value matches 32-bit nlink_t */
+	vap->va_nlink = MIN(links, UINT32_MAX);	/* nlink_t limit! */
 	vap->va_size = zp->z_size;
 #ifdef illumos
 	vap->va_rdev = vp->v_rdev;

Reply via email to