From owner-svn-src-head@freebsd.org Tue Dec 19 20:19:09 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 21BDCE9D7A8; Tue, 19 Dec 2017 20:19:09 +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 EC8FF69CA6; Tue, 19 Dec 2017 20:19:08 +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 vBJKJ7CD097736; Tue, 19 Dec 2017 20:19:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBJKJ7H7097733; Tue, 19 Dec 2017 20:19:07 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201712192019.vBJKJ7H7097733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 19 Dec 2017 20:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326998 - head/sys/fs/tmpfs X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/fs/tmpfs X-SVN-Commit-Revision: 326998 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.25 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: Tue, 19 Dec 2017 20:19:09 -0000 Author: jhb Date: Tue Dec 19 20:19:07 2017 New Revision: 326998 URL: https://svnweb.freebsd.org/changeset/base/326998 Log: Update tmpfs link count handling for ino64. Add a new TMPFS_LINK_MAX to use in place of LINK_MAX for link overflow checks and pathconf() reporting. Rather than storing a full 64-bit link count, just use a plain int and use INT_MAX as TMPFS_LINK_MAX. Discussed with: bde Reviewed by: kib (part of a larger patch) Sponsored by: Chelsio Communications Modified: head/sys/fs/tmpfs/tmpfs.h head/sys/fs/tmpfs/tmpfs_subr.c head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs.h ============================================================================== --- head/sys/fs/tmpfs/tmpfs.h Tue Dec 19 20:17:07 2017 (r326997) +++ head/sys/fs/tmpfs/tmpfs.h Tue Dec 19 20:19:07 2017 (r326998) @@ -188,8 +188,8 @@ struct tmpfs_node { uid_t tn_uid; /* (v) */ gid_t tn_gid; /* (v) */ mode_t tn_mode; /* (v) */ + int tn_links; /* (v) */ u_long tn_flags; /* (v) */ - nlink_t tn_links; /* (v) */ struct timespec tn_atime; /* (vi) */ struct timespec tn_mtime; /* (vi) */ struct timespec tn_ctime; /* (vi) */ @@ -296,6 +296,8 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); #define tn_link tn_spec.tn_link #define tn_reg tn_spec.tn_reg #define tn_fifo tn_spec.tn_fifo + +#define TMPFS_LINK_MAX INT_MAX #define TMPFS_NODE_LOCK(node) mtx_lock(&(node)->tn_interlock) #define TMPFS_NODE_UNLOCK(node) mtx_unlock(&(node)->tn_interlock) Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Tue Dec 19 20:17:07 2017 (r326997) +++ head/sys/fs/tmpfs/tmpfs_subr.c Tue Dec 19 20:19:07 2017 (r326998) @@ -739,8 +739,8 @@ tmpfs_alloc_file(struct vnode *dvp, struct vnode **vpp if (vap->va_type == VDIR) { /* Ensure that we do not overflow the maximum number of links * imposed by the system. */ - MPASS(dnode->tn_links <= LINK_MAX); - if (dnode->tn_links == LINK_MAX) { + MPASS(dnode->tn_links <= TMPFS_LINK_MAX); + if (dnode->tn_links == TMPFS_LINK_MAX) { return (EMLINK); } Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Dec 19 20:17:07 2017 (r326997) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Dec 19 20:19:07 2017 (r326998) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -618,8 +619,8 @@ tmpfs_link(struct vop_link_args *v) /* Ensure that we do not overflow the maximum number of links imposed * by the system. */ - MPASS(node->tn_links <= LINK_MAX); - if (node->tn_links == LINK_MAX) { + MPASS(node->tn_links <= TMPFS_LINK_MAX); + if (node->tn_links == TMPFS_LINK_MAX) { error = EMLINK; goto out; } @@ -1349,7 +1350,7 @@ tmpfs_pathconf(struct vop_pathconf_args *v) switch (name) { case _PC_LINK_MAX: - *retval = LINK_MAX; + *retval = TMPFS_LINK_MAX; break; case _PC_NAME_MAX: