From nobody Fri Mar 17 16:26:18 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PdTyy5nNGz3yY7Z; Fri, 17 Mar 2023 16:26:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PdTyy5HlMz4GpY; Fri, 17 Mar 2023 16:26:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679070378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=83L4KozjlZIh5dOqlP+GrR7SBaJCZxYX1b0VRuVs92U=; b=DfpdwsS6Qfes/PqScJd0PnO38fMbTa3jJjW3fhq2OUejb696yfVfnbwO9TwO/KugeQEmkZ P3tH44JdOdhPpKQL5ZHgn/vVxWu3C8qjlqGK7I0J81/fLbPIugDxZIT3XUdKJcViVMtOO3 nz4DAu7NxaZptkycktwGZ0gEXquIlHVcpeqCP9juyvJLxMCHX72YGgV+HvIHVZB/dEle9v fm17SjElJ3qoQhK/npAhsf44U38Af98uF0xyZ7Vg65dkYLy7kCs8qNDib5ncPHJSghmp+l iZvNsYdJfHtOKmFi09x1E2m4UXBUxTvH8dxnT1bFkfLTIGZxBUjzvZaYqYSMfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679070378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=83L4KozjlZIh5dOqlP+GrR7SBaJCZxYX1b0VRuVs92U=; b=hNperES6Fau93H5Mr8z8h4LrTz7fSooH986pbob+TQIVlW3U5s+CvqIqUMm6sOKgO7821c l60eZSxhrNMj5wH6vEch4S8aUf0ak7ZPKfAKM3rIh9hhFRhh/WKK0jojQnOZUvvUYKjxKs aRa4KQs9F6TPKxG1ljeSHVl+0Te5CuJgAhWqiMReOA6hqaV68Knn7ROvjBXMs7ghlrhZD3 WksGkKalMAmXkOX9dYosmkngDCcdaYRLYJLK7GuPy+BWl7JFeNCJvV1fjVmeHLaLGwiyMs uOfw+e1B7aSF2OBlBuZbGzuKk0c7EnVTbccxxGmnpEIS8QclVDpFsaUqoCi3fw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679070378; a=rsa-sha256; cv=none; b=uvCv8wVhPHcmWRz71rdjPdLoT8F1MDDD+1uONbD5NDiZfMNP8ghMsrUeXDU7OAtTOGLC1p LoLF/zbtwYoeehW7czqroBcG9mzYfqIo1cyK1aW8TjL15GQ4Xlb7pcRu2YYdf09zqDf524 TruQ2Y/DFvAdefKx1vpJ4CiLMZHDaAZC3FsFYvh1YUPM42Km57a9kea3qAzBqv77bMbUBq q/2KG9NICTIiaIhYbJKJ2A+oSdPB9DYbpTPXD4LsARocMY18ki4X+uqFgmMvki5uIKr6Np XawUfbazy2jbFK3pTH5rk3nfYleK7D3MNXxl3lL9wTPNw5XUXVc6fPpjRjsXaw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PdTyy47q1zXVd; Fri, 17 Mar 2023 16:26:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32HGQI1I058547; Fri, 17 Mar 2023 16:26:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32HGQIZi058546; Fri, 17 Mar 2023 16:26:18 GMT (envelope-from git) Date: Fri, 17 Mar 2023 16:26:18 GMT Message-Id: <202303171626.32HGQIZi058546@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 62a573d9537c - main - vfs: retire KERN_VNODE List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62a573d9537c717b2d373f26ba90e4b142823466 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=62a573d9537c717b2d373f26ba90e4b142823466 commit 62a573d9537c717b2d373f26ba90e4b142823466 Author: Mateusz Guzik AuthorDate: 2023-03-16 17:21:59 +0000 Commit: Mateusz Guzik CommitDate: 2023-03-17 16:21:45 +0000 vfs: retire KERN_VNODE It got disabled in 2003: commit acb18acfec97aa7fe26ff48f80a5c3f89c9b542d Author: Poul-Henning Kamp Date: Sun Feb 23 18:09:05 2003 +0000 Bracket the kern.vnode sysctl in #ifdef notyet because it results in massive locking issues on diskless systems. It is also not clear that this sysctl is non-dangerous in its requirements for locked down memory on large RAM systems. There does not seem to be practical use for it and the disabled routine does not work anyway. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D39127 --- lib/libc/gen/sysctl.3 | 11 +---- sys/kern/kern_xxx.c | 9 +--- sys/kern/vfs_subr.c | 97 ------------------------------------- sys/security/audit/audit_bsm_klib.c | 1 - sys/sys/sysctl.h | 2 +- sys/sys/vnode.h | 30 ------------ 6 files changed, 3 insertions(+), 147 deletions(-) diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3 index c4883e0aeb4d..4f805d45790a 100644 --- a/lib/libc/gen/sysctl.3 +++ b/lib/libc/gen/sysctl.3 @@ -28,7 +28,7 @@ .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd October 18, 2021 +.Dd March 16, 2023 .Dt SYSCTL 3 .Os .Sh NAME @@ -354,7 +354,6 @@ information. .It Dv KERN_SECURELVL Ta integer Ta raise only .It Dv KERN_UPDATEINTERVAL Ta integer Ta no .It Dv KERN_VERSION Ta string Ta no -.It Dv KERN_VNODE Ta struct xvnode Ta no .El .Bl -tag -width 6n .It Li KERN_ARGMAX @@ -487,14 +486,6 @@ This level may be raised by processes with appropriate privilege. It may not be lowered. .It Li KERN_VERSION The system version string. -.It Li KERN_VNODE -Return the entire vnode table. -Note, the vnode table is not necessarily a consistent snapshot of -the system. -The returned data consists of an array whose size depends on the -current number of such objects in the system. -Each element of the array consists of a -.Va struct xvnode . .El .Ss CTL_NET The string and integer information available for the CTL_NET level diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c index f95246f1cf38..b0026777a389 100644 --- a/sys/kern/kern_xxx.c +++ b/sys/kern/kern_xxx.c @@ -111,7 +111,7 @@ oquota(struct thread *td, struct oquota_args *uap) #define KINFO_PROC (0<<8) #define KINFO_RT (1<<8) -#define KINFO_VNODE (2<<8) +/* UNUSED, was KINFO_VNODE (2<<8) */ #define KINFO_FILE (3<<8) #define KINFO_METER (4<<8) #define KINFO_LOADAVG (5<<8) @@ -184,13 +184,6 @@ ogetkerninfo(struct thread *td, struct ogetkerninfo_args *uap) 0, 0, 0, &size, 0); break; - case KINFO_VNODE: - name[0] = CTL_KERN; - name[1] = KERN_VNODE; - error = userland_sysctl(td, name, 2, uap->where, uap->size, - 0, 0, 0, &size, 0); - break; - case KINFO_PROC: name[0] = CTL_KERN; name[1] = KERN_PROC; diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 0b9d7ca9778f..c117ada017c9 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -4704,103 +4704,6 @@ sysctl_ovfs_conf(SYSCTL_HANDLER_ARGS) #endif /* 1 || COMPAT_PRELITE2 */ #endif /* !BURN_BRIDGES */ -#define KINFO_VNODESLOP 10 -#ifdef notyet -/* - * Dump vnode list (via sysctl). - */ -/* ARGSUSED */ -static int -sysctl_vnode(SYSCTL_HANDLER_ARGS) -{ - struct xvnode *xvn; - struct mount *mp; - struct vnode *vp; - int error, len, n; - - /* - * Stale numvnodes access is not fatal here. - */ - req->lock = 0; - len = (numvnodes + KINFO_VNODESLOP) * sizeof *xvn; - if (!req->oldptr) - /* Make an estimate */ - return (SYSCTL_OUT(req, 0, len)); - - error = sysctl_wire_old_buffer(req, 0); - if (error != 0) - return (error); - xvn = malloc(len, M_TEMP, M_ZERO | M_WAITOK); - n = 0; - mtx_lock(&mountlist_mtx); - TAILQ_FOREACH(mp, &mountlist, mnt_list) { - if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) - continue; - MNT_ILOCK(mp); - TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) { - if (n == len) - break; - vref(vp); - xvn[n].xv_size = sizeof *xvn; - xvn[n].xv_vnode = vp; - xvn[n].xv_id = 0; /* XXX compat */ -#define XV_COPY(field) xvn[n].xv_##field = vp->v_##field - XV_COPY(usecount); - XV_COPY(writecount); - XV_COPY(holdcnt); - XV_COPY(mount); - XV_COPY(numoutput); - XV_COPY(type); -#undef XV_COPY - xvn[n].xv_flag = vp->v_vflag; - - switch (vp->v_type) { - case VREG: - case VDIR: - case VLNK: - break; - case VBLK: - case VCHR: - if (vp->v_rdev == NULL) { - vrele(vp); - continue; - } - xvn[n].xv_dev = dev2udev(vp->v_rdev); - break; - case VSOCK: - xvn[n].xv_socket = vp->v_socket; - break; - case VFIFO: - xvn[n].xv_fifo = vp->v_fifoinfo; - break; - case VNON: - case VBAD: - default: - /* shouldn't happen? */ - vrele(vp); - continue; - } - vrele(vp); - ++n; - } - MNT_IUNLOCK(mp); - mtx_lock(&mountlist_mtx); - vfs_unbusy(mp); - if (n == len) - break; - } - mtx_unlock(&mountlist_mtx); - - error = SYSCTL_OUT(req, xvn, n * sizeof *xvn); - free(xvn, M_TEMP); - return (error); -} - -SYSCTL_PROC(_kern, KERN_VNODE, vnode, CTLTYPE_OPAQUE | CTLFLAG_RD | - CTLFLAG_MPSAFE, 0, 0, sysctl_vnode, "S,xvnode", - ""); -#endif - static void unmount_or_warn(struct mount *mp) { diff --git a/sys/security/audit/audit_bsm_klib.c b/sys/security/audit/audit_bsm_klib.c index 31a9bf29265d..9dde8362ce9c 100644 --- a/sys/security/audit/audit_bsm_klib.c +++ b/sys/security/audit/audit_bsm_klib.c @@ -182,7 +182,6 @@ audit_ctlname_to_sysctlevent(int name[], uint64_t valid_arg) case KERN_HOSTID: case KERN_SECURELVL: case KERN_HOSTNAME: - case KERN_VNODE: case KERN_PROC: case KERN_FILE: case KERN_PROF: diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 79da4772615f..9cfd759166bd 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -972,7 +972,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); #define KERN_HOSTNAME 10 /* string: hostname */ #define KERN_HOSTID 11 /* int: host identifier */ #define KERN_CLOCKRATE 12 /* struct: struct clockrate */ -#define KERN_VNODE 13 /* struct: vnode structures */ +/* was: #define KERN_VNODE 13 ; disabled in 2003 and removed in 2023 */ #define KERN_PROC 14 /* struct: process entries */ #define KERN_FILE 15 /* struct: file entries */ #define KERN_PROF 16 /* node: kernel profiling info */ diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 04596a7184ee..a3eb00f0fe7c 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -199,36 +199,6 @@ _Static_assert(sizeof(struct vnode) <= 448, "vnode size crosses 448 bytes"); /* XXX: These are temporary to avoid a source sweep at this time */ #define v_object v_bufobj.bo_object -/* - * Userland version of struct vnode, for sysctl. - */ -struct xvnode { - size_t xv_size; /* sizeof(struct xvnode) */ - void *xv_vnode; /* address of real vnode */ - u_long xv_flag; /* vnode vflags */ - int xv_usecount; /* reference count of users */ - int xv_writecount; /* reference count of writers */ - int xv_holdcnt; /* page & buffer references */ - u_long xv_id; /* capability identifier */ - void *xv_mount; /* address of parent mount */ - long xv_numoutput; /* num of writes in progress */ - enum vtype xv_type; /* vnode type */ - union { - void *xvu_socket; /* unpcb, if VSOCK */ - void *xvu_fifo; /* fifo, if VFIFO */ - dev_t xvu_rdev; /* maj/min, if VBLK/VCHR */ - struct { - dev_t xvu_dev; /* device, if VDIR/VREG/VLNK */ - ino_t xvu_ino; /* id, if VDIR/VREG/VLNK */ - } xv_uns; - } xv_un; -}; -#define xv_socket xv_un.xvu_socket -#define xv_fifo xv_un.xvu_fifo -#define xv_rdev xv_un.xvu_rdev -#define xv_dev xv_un.xv_uns.xvu_dev -#define xv_ino xv_un.xv_uns.xvu_ino - /* We don't need to lock the knlist */ #define VN_KNLIST_EMPTY(vp) ((vp)->v_pollinfo == NULL || \ KNLIST_EMPTY(&(vp)->v_pollinfo->vpi_selinfo.si_note))