diff options
author | Richard Yao <ryao@gentoo.org> | 2013-03-28 22:19:21 +0000 |
---|---|---|
committer | Richard Yao <ryao@gentoo.org> | 2013-03-28 22:19:21 +0000 |
commit | e2ca0e0b622aa7206136e3d659c857427afbc47b (patch) | |
tree | 02f23900fcbf2d6ce5f1ae12898ba67e8d912cdb /sys-kernel | |
parent | Version bump for Gnome 3.8 (diff) | |
download | gentoo-2-e2ca0e0b622aa7206136e3d659c857427afbc47b.tar.gz gentoo-2-e2ca0e0b622aa7206136e3d659c857427afbc47b.tar.bz2 gentoo-2-e2ca0e0b622aa7206136e3d659c857427afbc47b.zip |
Version bump to 0.6.1; Simplify hostid logic
(Portage version: 2.2.0_alpha169/cvs/Linux x86_64, signed Manifest commit with key 0xBEE84C64)
Diffstat (limited to 'sys-kernel')
-rw-r--r-- | sys-kernel/spl/ChangeLog | 9 | ||||
-rw-r--r-- | sys-kernel/spl/files/spl-0.6.0_rc14-simplify-hostid-logic.patch | 181 | ||||
-rw-r--r-- | sys-kernel/spl/spl-0.6.1.ebuild | 112 | ||||
-rw-r--r-- | sys-kernel/spl/spl-9999.ebuild | 38 |
4 files changed, 314 insertions, 26 deletions
diff --git a/sys-kernel/spl/ChangeLog b/sys-kernel/spl/ChangeLog index dc419f612977..5b372ff7afdf 100644 --- a/sys-kernel/spl/ChangeLog +++ b/sys-kernel/spl/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-kernel/spl # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/ChangeLog,v 1.50 2013/03/23 23:48:08 ryao Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/ChangeLog,v 1.51 2013/03/28 22:19:21 ryao Exp $ + +*spl-0.6.1 (28 Mar 2013) + + 28 Mar 2013; Richard Yao <ryao@gentoo.org> + +files/spl-0.6.0_rc14-simplify-hostid-logic.patch, +spl-0.6.1.ebuild, + spl-9999.ebuild: + Version bump to 0.6.1; Simplify hostid logic *spl-0.6.0_rc14-r3 (23 Mar 2013) diff --git a/sys-kernel/spl/files/spl-0.6.0_rc14-simplify-hostid-logic.patch b/sys-kernel/spl/files/spl-0.6.0_rc14-simplify-hostid-logic.patch new file mode 100644 index 000000000000..3d5199fb4eb6 --- /dev/null +++ b/sys-kernel/spl/files/spl-0.6.0_rc14-simplify-hostid-logic.patch @@ -0,0 +1,181 @@ +From f47f028ae6f039c13d3138e2ee1c0056a3a3f789 Mon Sep 17 00:00:00 2001 +From: Richard Yao <ryao@cs.stonybrook.edu> +Date: Mon, 11 Mar 2013 21:16:36 -0400 +Subject: [PATCH] Simplify hostid logic + +There is plenty of compatibility code for a hw_hostid +that isn't used by anything. At the same time, there are apparently +issues with the current hostid logic. coredumb in #zfsonlinux on +freenode reported that Fedora 17 changes its hostid on every boot, which +required force importing his pool. A suggestion by wca was to adopt +FreeBSD's behavior, where it treats hostid as zero if /etc/hostid does +not exist + +Adopting FreeBSD's behavior permits us to eliminate plenty of code, +including a userland helper that invokes the system's hostid as a +fallback. + +Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu> +--- + include/sys/sysmacros.h | 1 - + include/sys/systeminfo.h | 3 +-- + module/spl/spl-generic.c | 55 ++++++------------------------------------------ + module/spl/spl-proc.c | 11 ---------- + 4 files changed, 7 insertions(+), 63 deletions(-) + +diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h +index 7c4da67..4dd2685 100644 +--- a/include/sys/sysmacros.h ++++ b/include/sys/sysmacros.h +@@ -138,7 +138,6 @@ + /* Missing globals */ + extern char spl_version[32]; + extern unsigned long spl_hostid; +-extern char hw_serial[11]; + + /* Missing misc functions */ + extern int highbit(unsigned long i); +diff --git a/include/sys/systeminfo.h b/include/sys/systeminfo.h +index e22a085..a4c1984 100644 +--- a/include/sys/systeminfo.h ++++ b/include/sys/systeminfo.h +@@ -25,6 +25,5 @@ + #ifndef _SPL_SYSTEMINFO_H + #define _SPL_SYSTEMINFO_H + +-#define HW_INVALID_HOSTID 0xFFFFFFFF /* an invalid hostid */ + #define HW_HOSTID_LEN 11 /* minimum buffer size needed */ + /* to hold a decimal or hex */ +diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c +index 3cef489..b8e2ed1 100644 +--- a/module/spl/spl-generic.c ++++ b/module/spl/spl-generic.c +@@ -52,14 +52,11 @@ + char spl_version[32] = "SPL v" SPL_META_VERSION "-" SPL_META_RELEASE; + EXPORT_SYMBOL(spl_version); + +-unsigned long spl_hostid = HW_INVALID_HOSTID; ++unsigned long spl_hostid = 0; + EXPORT_SYMBOL(spl_hostid); + module_param(spl_hostid, ulong, 0644); + MODULE_PARM_DESC(spl_hostid, "The system hostid."); + +-char hw_serial[HW_HOSTID_LEN] = "<none>"; +-EXPORT_SYMBOL(hw_serial); +- + proc_t p0 = { 0 }; + EXPORT_SYMBOL(p0); + +@@ -467,7 +464,7 @@ struct new_utsname *__utsname(void) + int result; + uint64_t size; + struct _buf *file; +- unsigned long hostid = 0; ++ uint32_t hostid = 0; + + file = kobj_open_file(spl_hostid_path); + +@@ -511,45 +508,10 @@ struct new_utsname *__utsname(void) + return 0; + } + +-#define GET_HOSTID_CMD \ +- "exec 0</dev/null " \ +- " 1>/proc/sys/kernel/spl/hostid " \ +- " 2>/dev/null; " \ +- "hostid" +- +-static int +-hostid_exec(void) +-{ +- char *argv[] = { "/bin/sh", +- "-c", +- GET_HOSTID_CMD, +- NULL }; +- char *envp[] = { "HOME=/", +- "TERM=linux", +- "PATH=/sbin:/usr/sbin:/bin:/usr/bin", +- NULL }; +- int rc; +- +- /* Doing address resolution in the kernel is tricky and just +- * not a good idea in general. So to set the proper 'hw_serial' +- * use the usermodehelper support to ask '/bin/sh' to run +- * '/usr/bin/hostid' and redirect the result to /proc/sys/spl/hostid +- * for us to use. It's a horrific solution but it will do for now. +- */ +- rc = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC); +- if (rc) +- printk("SPL: Failed user helper '%s %s %s', rc = %d\n", +- argv[0], argv[1], argv[2], rc); +- +- return rc; +-} +- + uint32_t + zone_get_hostid(void *zone) + { + static int first = 1; +- unsigned long hostid; +- int rc; + + /* Only the global zone is supported */ + ASSERT(zone == NULL); +@@ -559,21 +521,16 @@ struct new_utsname *__utsname(void) + + /* + * Get the hostid if it was not passed as a module parameter. +- * Try reading the /etc/hostid file directly, and then fall +- * back to calling the /usr/bin/hostid utility. ++ * Try reading the /etc/hostid file directly. + */ +- if ((spl_hostid == HW_INVALID_HOSTID) && +- (rc = hostid_read()) && (rc = hostid_exec())) +- return HW_INVALID_HOSTID; ++ if (hostid_read()) ++ spl_hostid = 0; + + printk(KERN_NOTICE "SPL: using hostid 0x%08x\n", + (unsigned int) spl_hostid); + } + +- if (ddi_strtoul(hw_serial, NULL, HW_HOSTID_LEN-1, &hostid) != 0) +- return HW_INVALID_HOSTID; +- +- return (uint32_t)hostid; ++ return spl_hostid; + } + EXPORT_SYMBOL(zone_get_hostid); + +diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c +index cd4fa1b..1113cf2 100644 +--- a/module/spl/spl-proc.c ++++ b/module/spl/spl-proc.c +@@ -506,9 +506,6 @@ enum { + if (str == end) + SRETURN(-EINVAL); + +- (void) snprintf(hw_serial, HW_HOSTID_LEN, "%lu", spl_hostid); +- hw_serial[HW_HOSTID_LEN - 1] = '\0'; +- *ppos += *lenp; + } else { + len = snprintf(str, sizeof(str), "%lx", spl_hostid); + if (*ppos >= len) +@@ -1051,14 +1048,6 @@ enum { + .mode = 0644, + .proc_handler = &proc_dohostid, + }, +- { +- CTL_NAME (CTL_HW_SERIAL) +- .procname = "hw_serial", +- .data = hw_serial, +- .maxlen = sizeof(hw_serial), +- .mode = 0444, +- .proc_handler = &proc_dostring, +- }, + #ifndef HAVE_KALLSYMS_LOOKUP_NAME + { + CTL_NAME (CTL_KALLSYMS) +-- +1.8.1.5 + diff --git a/sys-kernel/spl/spl-0.6.1.ebuild b/sys-kernel/spl/spl-0.6.1.ebuild new file mode 100644 index 000000000000..8838513bfbd8 --- /dev/null +++ b/sys-kernel/spl/spl-0.6.1.ebuild @@ -0,0 +1,112 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/spl-0.6.1.ebuild,v 1.1 2013/03/28 22:19:21 ryao Exp $ + +EAPI="4" +AUTOTOOLS_AUTORECONF="1" + +inherit flag-o-matic linux-info linux-mod autotools-utils + +if [[ ${PV} == "9999" ]] ; then + inherit git-2 + EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git" +else + inherit eutils versionator + MY_PV=$(replace_version_separator 3 '-') + SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz" + S="${WORKDIR}/${PN}-${PN}-${MY_PV}" + KEYWORDS="~amd64" +fi + +DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs" +HOMEPAGE="http://zfsonlinux.org/" + +LICENSE="GPL-2" +SLOT="0" +IUSE="custom-cflags debug debug-log" +RESTRICT="test" + +COMMON_DEPEND="virtual/awk" + +DEPEND="${COMMON_DEPEND}" + +RDEPEND="${COMMON_DEPEND} + !sys-devel/spl" + +AT_M4DIR="config" +AUTOTOOLS_IN_SOURCE_BUILD="1" + +pkg_setup() { + linux-info_pkg_setup + CONFIG_CHECK=" + !DEBUG_LOCK_ALLOC + !GRKERNSEC_HIDESYM + MODULES + KALLSYMS + !PAX_KERNEXEC_PLUGIN_METHOD_OR + ZLIB_DEFLATE + ZLIB_INFLATE + " + + kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required" + + [ ${PV} != "9999" ] && \ + { kernel_is le 3 9 || die "Linux 3.9 is the latest supported version."; } + + check_extra_config +} + +src_prepare() { + # Workaround for hard coded path + sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die + + if [ ${PV} != "9999" ] + then + # Be more like FreeBSD and Illumos when handling hostids + epatch "${FILESDIR}/${PN}-0.6.0_rc14-simplify-hostid-logic.patch" + fi + + # splat is unnecessary unless we are debugging + use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in" + + autotools-utils_src_prepare +} + +src_configure() { + use custom-cflags || strip-flags + filter-ldflags -Wl,* + + set_arch_to_kernel + local myeconfargs=( + --bindir="${EPREFIX}/bin" + --sbindir="${EPREFIX}/sbin" + --with-config=all + --with-linux="${KV_DIR}" + --with-linux-obj="${KV_OUT_DIR}" + $(use_enable debug) + $(use_enable debug-log) + ) + autotools-utils_src_configure +} + +src_install() { + autotools-utils_src_install + dodoc AUTHORS DISCLAIMER README.markdown + + # Provide /usr/src/spl symlink for lustre + dosym "$(basename $(echo "${ED}/usr/src/spl-"*))/${KV_FULL}" /usr/src/spl +} + +pkg_postinst() { + linux-mod_pkg_postinst + + # Remove old modules + if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ] + then + ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl" + ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl" + ewarn "Automatically removing old modules to avoid problems." + rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules" + rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon" + fi +} diff --git a/sys-kernel/spl/spl-9999.ebuild b/sys-kernel/spl/spl-9999.ebuild index 2230fa05a75a..48cf572ed074 100644 --- a/sys-kernel/spl/spl-9999.ebuild +++ b/sys-kernel/spl/spl-9999.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/spl-9999.ebuild,v 1.33 2013/03/23 23:48:08 ryao Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/spl-9999.ebuild,v 1.34 2013/03/28 22:19:21 ryao Exp $ EAPI="4" AUTOTOOLS_AUTORECONF="1" @@ -62,17 +62,8 @@ src_prepare() { if [ ${PV} != "9999" ] then - # Fix x86 build failures on Linux 3.4 and later, bug #450646 - epatch "${FILESDIR}/${P}-fix-atomic64-checks.patch" - - # Fix autotools check that fails on ~ppc64 - epatch "${FILESDIR}/${P}-fix-mutex-owner-check.patch" - - # Linux 3.9 Support - epatch "${FILESDIR}/${P}-linux-3.9-compat.patch" - - # Free memory under load quickly - epatch "${FILESDIR}/${P}-no-cond_resched.patch" + # Be more like FreeBSD and Illumos when handling hostids + epatch "${FILESDIR}/${PN}-0.6.0_rc14-simplify-hostid-logic.patch" fi # splat is unnecessary unless we are debugging @@ -106,19 +97,16 @@ src_install() { dosym "$(basename $(echo "${ED}/usr/src/spl-"*))/${KV_FULL}" /usr/src/spl } -src_test() { - if [[ ! -e /proc/modules ]] - then - die "Missing /proc/modules" - elif [[ $UID -ne 0 ]] - then - ewarn "Cannot run make check tests with FEATURES=userpriv." - ewarn "Skipping make check tests." - elif grep -q '^spl ' /proc/modules +pkg_postinst() { + linux-mod_pkg_postinst + + # Remove old modules + if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ] then - ewarn "Cannot run make check tests with module spl loaded." - ewarn "Skipping make check tests." - else - autotools-utils_src_test + ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl" + ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl" + ewarn "Automatically removing old modules to avoid problems." + rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules" + rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon" fi } |