From owner-svn-src-head@freebsd.org Mon Sep 18 23:30:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD5DAE0F9F7; Mon, 18 Sep 2017 23:30:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B74F32D8; Mon, 18 Sep 2017 23:30:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8INUdSq011441; Mon, 18 Sep 2017 23:30:39 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8INUd0S011438; Mon, 18 Sep 2017 23:30:39 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709182330.v8INUd0S011438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 18 Sep 2017 23:30:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323723 - in head/sys/ufs: ffs ufs X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/ufs: ffs ufs X-SVN-Commit-Revision: 323723 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Sep 2017 23:30:41 -0000 Author: jhb Date: Mon Sep 18 23:30:39 2017 New Revision: 323723 URL: https://svnweb.freebsd.org/changeset/base/323723 Log: Add UFS_LINK_MAX for the UFS-specific limit on link counts. ino64 expanded nlink_t to 64 bits, but the on-disk format for UFS is still limited to 16 bits. This is a nop currently but will matter if LINK_MAX is increased in the future. Reviewed by: kib Sponsored by: Chelsio Communications Modified: head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ufs/dinode.h head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Mon Sep 18 20:22:42 2017 (r323722) +++ head/sys/ufs/ffs/ffs_softdep.c Mon Sep 18 23:30:39 2017 (r323723) @@ -11532,7 +11532,7 @@ handle_written_inodeblock(inodedep, bp, flags) */ if (inodedep->id_savedsize == -1 || inodedep->id_savedextsize == -1) panic("handle_written_inodeblock: bad size"); - if (inodedep->id_savednlink > LINK_MAX) + if (inodedep->id_savednlink > UFS_LINK_MAX) panic("handle_written_inodeblock: Invalid link count " "%jd for inodedep %p", (uintmax_t)inodedep->id_savednlink, inodedep); Modified: head/sys/ufs/ufs/dinode.h ============================================================================== --- head/sys/ufs/ufs/dinode.h Mon Sep 18 20:22:42 2017 (r323722) +++ head/sys/ufs/ufs/dinode.h Mon Sep 18 23:30:39 2017 (r323723) @@ -186,4 +186,6 @@ struct ufs1_dinode { u_int64_t di_modrev; /* 120: i_modrev for NFSv4 */ }; +#define UFS_LINK_MAX 32767 + #endif /* _UFS_UFS_DINODE_H_ */ Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Mon Sep 18 20:22:42 2017 (r323722) +++ head/sys/ufs/ufs/ufs_vnops.c Mon Sep 18 23:30:39 2017 (r323723) @@ -981,7 +981,7 @@ ufs_link(ap) goto out; } ip = VTOI(vp); - if ((nlink_t)ip->i_nlink >= LINK_MAX) { + if (ip->i_nlink >= UFS_LINK_MAX) { error = EMLINK; goto out; } @@ -1266,7 +1266,7 @@ relock: doingdirectory = 0; newparent = 0; ino = fip->i_number; - if (fip->i_nlink >= LINK_MAX) { + if (fip->i_nlink >= UFS_LINK_MAX) { error = EMLINK; goto unlockout; } @@ -1369,7 +1369,7 @@ relock: * actual link modification is completed when * .. is rewritten below. */ - if ((nlink_t)tdp->i_nlink >= LINK_MAX) { + if (tdp->i_nlink >= UFS_LINK_MAX) { error = EMLINK; goto bad; } @@ -1793,7 +1793,7 @@ ufs_mkdir(ap) panic("ufs_mkdir: no name"); #endif dp = VTOI(dvp); - if ((nlink_t)dp->i_nlink >= LINK_MAX) { + if (dp->i_nlink >= UFS_LINK_MAX) { error = EMLINK; goto out; } @@ -2442,6 +2442,9 @@ ufs_pathconf(ap) error = 0; switch (ap->a_name) { + case _PC_LINK_MAX: + *ap->a_retval = UFS_LINK_MAX; + break; case _PC_NAME_MAX: *ap->a_retval = UFS_MAXNAMLEN; break;