Date: Sun, 1 Oct 2017 16:37:55 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324167 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern sys Message-ID: <201710011637.v91Gbtmb033233@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Sun Oct 1 16:37:54 2017 New Revision: 324167 URL: https://svnweb.freebsd.org/changeset/base/324167 Log: revert r324166, it has an unrelated change in it Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/kern/kern_linker.c head/sys/kern/kern_sysctl.c head/sys/sys/sysctl.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sun Oct 1 16:34:16 2017 (r324166) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sun Oct 1 16:37:54 2017 (r324167) @@ -1808,10 +1808,10 @@ get_clones_stat(dsl_dataset_t *ds, nvlist_t *nv) fnvlist_add_nvlist(propval, ZPROP_VALUE, val); fnvlist_add_nvlist(nv, zfs_prop_to_name(ZFS_PROP_CLONES), propval); + } else { + nvlist_free(val); + nvlist_free(propval); } - - nvlist_free(val); - nvlist_free(propval); } /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Oct 1 16:34:16 2017 (r324166) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Oct 1 16:37:54 2017 (r324167) @@ -3096,8 +3096,6 @@ spa_load_best(spa_t *spa, spa_load_state_t state, int if (config && (rewind_error || state != SPA_LOAD_RECOVER)) spa_config_set(spa, config); - else - nvlist_free(config); if (state == SPA_LOAD_RECOVER) { ASSERT3P(loadinfo, ==, NULL); Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Sun Oct 1 16:34:16 2017 (r324166) +++ head/sys/kern/kern_linker.c Sun Oct 1 16:37:54 2017 (r324167) @@ -288,7 +288,7 @@ linker_file_sysuninit(linker_file_t lf) } static void -linker_file_register_sysctls(linker_file_t lf, bool enable) +linker_file_register_sysctls(linker_file_t lf) { struct sysctl_oid **start, **stop, **oidp; @@ -303,34 +303,8 @@ linker_file_register_sysctls(linker_file_t lf, bool en sx_xunlock(&kld_sx); sysctl_wlock(); - for (oidp = start; oidp < stop; oidp++) { - if (enable) - sysctl_register_oid(*oidp); - else - sysctl_register_disabled_oid(*oidp); - } - sysctl_wunlock(); - sx_xlock(&kld_sx); -} - -static void -linker_file_enable_sysctls(linker_file_t lf) -{ - struct sysctl_oid **start, **stop, **oidp; - - KLD_DPF(FILE, - ("linker_file_enable_sysctls: enable SYSCTLs for %s\n", - lf->filename)); - - sx_assert(&kld_sx, SA_XLOCKED); - - if (linker_file_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0) - return; - - sx_xunlock(&kld_sx); - sysctl_wlock(); for (oidp = start; oidp < stop; oidp++) - sysctl_enable_oid(*oidp); + sysctl_register_oid(*oidp); sysctl_wunlock(); sx_xlock(&kld_sx); } @@ -456,9 +430,8 @@ linker_load_file(const char *filename, linker_file_t * return (error); } modules = !TAILQ_EMPTY(&lf->modules); - linker_file_register_sysctls(lf, false); + linker_file_register_sysctls(lf); linker_file_sysinit(lf); - linker_file_enable_sysctls(lf); lf->flags |= LINKER_FILE_LINKED; /* @@ -719,8 +692,8 @@ linker_file_unload(linker_file_t file, int flags) */ if (file->flags & LINKER_FILE_LINKED) { file->flags &= ~LINKER_FILE_LINKED; - linker_file_unregister_sysctls(file); linker_file_sysuninit(file); + linker_file_unregister_sysctls(file); } TAILQ_REMOVE(&linker_files, file, link); @@ -1669,7 +1642,7 @@ restart: if (linker_file_lookup_set(lf, "sysinit_set", &si_start, &si_stop, NULL) == 0) sysinit_add(si_start, si_stop); - linker_file_register_sysctls(lf, true); + linker_file_register_sysctls(lf); lf->flags |= LINKER_FILE_LINKED; continue; fail: Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Sun Oct 1 16:34:16 2017 (r324166) +++ head/sys/kern/kern_sysctl.c Sun Oct 1 16:37:54 2017 (r324167) @@ -408,8 +408,8 @@ SYSCTL_PROC(_sysctl, 0, reuse_test, CTLTYPE_STRING|CTL 0, 0, sysctl_reuse_test, "-", ""); #endif -static void -sysctl_register_oid_impl(struct sysctl_oid *oidp, bool enable) +void +sysctl_register_oid(struct sysctl_oid *oidp) { struct sysctl_oid_list *parent = oidp->oid_parent; struct sysctl_oid *p; @@ -491,17 +491,6 @@ retry: } /* update the OID number, if any */ oidp->oid_number = oid_number; - - /* - * Mark the leaf as dormant if it's not to be immediately enabled. - * We do not disable nodes as they can be shared between modules - * and it is always safe to access a node. - */ - if (!enable && (oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) { - KASSERT((oidp->oid_kind & CTLFLAG_DORMANT) == 0, - ("internal flag is set in oid_kind")); - oidp->oid_kind |= CTLFLAG_DORMANT; - } if (q != NULL) SLIST_INSERT_AFTER(q, oidp, oid_link); else @@ -521,35 +510,6 @@ retry: } void -sysctl_register_oid(struct sysctl_oid *oidp) -{ - - sysctl_register_oid_impl(oidp, true); -} - -void -sysctl_register_disabled_oid(struct sysctl_oid *oidp) -{ - - sysctl_register_oid_impl(oidp, false); -} - -void -sysctl_enable_oid(struct sysctl_oid *oidp) -{ - - SYSCTL_ASSERT_WLOCKED(); - if ((oidp->oid_kind & CTLTYPE) == CTLTYPE_NODE) { - KASSERT((oidp->oid_kind & CTLFLAG_DORMANT) == 0, - ("sysctl node is marked as dormant")); - return; - } - KASSERT((oidp->oid_kind & CTLFLAG_DORMANT) != 0, - ("enabling already enabled sysctl oid")); - oidp->oid_kind &= ~CTLFLAG_DORMANT; -} - -void sysctl_unregister_oid(struct sysctl_oid *oidp) { struct sysctl_oid *p; @@ -1097,7 +1057,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *next = oidp->oid_number; *oidpp = oidp; - if ((oidp->oid_kind & (CTLFLAG_SKIP | CTLFLAG_DORMANT)) != 0) + if (oidp->oid_kind & CTLFLAG_SKIP) continue; if (!namelen) { @@ -1918,8 +1878,6 @@ sysctl_find_oid(int *name, u_int namelen, struct sysct } lsp = SYSCTL_CHILDREN(oid); } else if (indx == namelen) { - if ((oid->oid_kind & CTLFLAG_DORMANT) != 0) - return (ENOENT); *noid = oid; if (nindx != NULL) *nindx = indx; Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Sun Oct 1 16:34:16 2017 (r324166) +++ head/sys/sys/sysctl.h Sun Oct 1 16:37:54 2017 (r324167) @@ -83,7 +83,6 @@ struct ctlname { #define CTLFLAG_RD 0x80000000 /* Allow reads of variable */ #define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */ #define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR) -#define CTLFLAG_DORMANT 0x20000000 /* This sysctl is not active yet */ #define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */ #define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */ #define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */ @@ -220,8 +219,6 @@ int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS); * These functions are used to add/remove an oid from the mib. */ void sysctl_register_oid(struct sysctl_oid *oidp); -void sysctl_register_disabled_oid(struct sysctl_oid *oidp); -void sysctl_enable_oid(struct sysctl_oid *oidp); void sysctl_unregister_oid(struct sysctl_oid *oidp); /* Declare a static oid to allow child oids to be added to it. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710011637.v91Gbtmb033233>