diff --git a/META b/META index f5fe29d..cd93047 100644 --- a/META +++ b/META @@ -1,7 +1,7 @@ Meta: 1 Name: spl Branch: 1.0 -Version: 0.6.5.4 +Version: 0.6.5.5 Release: 1 Release-Tags: relext License: GPL diff --git a/configure b/configure index d67a04e..7fd772d 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for spl 0.6.5.4. +# Generated by GNU Autoconf 2.68 for spl 0.6.5.5. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='spl' PACKAGE_TARNAME='spl' -PACKAGE_VERSION='0.6.5.4' -PACKAGE_STRING='spl 0.6.5.4' +PACKAGE_VERSION='0.6.5.5' +PACKAGE_STRING='spl 0.6.5.5' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1357,7 +1357,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures spl 0.6.5.4 to adapt to many kinds of systems. +\`configure' configures spl 0.6.5.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1428,7 +1428,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of spl 0.6.5.4:";; + short | recursive ) echo "Configuration of spl 0.6.5.5:";; esac cat <<\_ACEOF @@ -1545,7 +1545,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -spl configure 0.6.5.4 +spl configure 0.6.5.5 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1823,7 +1823,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by spl $as_me 0.6.5.4, which was +It was created by spl $as_me 0.6.5.5, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2947,7 +2947,7 @@ fi # Define the identity of the package. PACKAGE='spl' - VERSION='0.6.5.4' + VERSION='0.6.5.5' cat >>confdefs.h <<_ACEOF @@ -17462,7 +17462,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by spl $as_me 0.6.5.4, which was +This file was extended by spl $as_me 0.6.5.5, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17528,7 +17528,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -spl config.status 0.6.5.4 +spl config.status 0.6.5.5 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/copy-builtin b/copy-builtin index aa43073..34c482b 100755 --- a/copy-builtin +++ b/copy-builtin @@ -116,7 +116,7 @@ add_after() add_after "$KERNEL_DIR/Kconfig" 'source "arch/$SRCARCH/Kconfig"' 'source "spl/Kconfig"' # We must take care to build SPL before ZFS, otherwise the symbols required # to link ZFS will not be available. -sed -i 's#+= kernel/#+= kernel/ spl/#' "$KERNEL_DIR/Makefile" +sed -i 's~mm/ fs/~mm/ spl/ fs/~' "$KERNEL_DIR/Makefile" echo >&2 echo " $0: done." >&2 diff --git a/include/sys/kmem.h b/include/sys/kmem.h index 8d5e729..d4b3bf6 100644 --- a/include/sys/kmem.h +++ b/include/sys/kmem.h @@ -78,14 +78,20 @@ typedef struct { unsigned int saved_flags; } fstrans_cookie_t; +#ifdef PF_MEMALLOC_NOIO +#define SPL_FSTRANS (PF_FSTRANS|PF_MEMALLOC_NOIO) +#else +#define SPL_FSTRANS (PF_FSTRANS) +#endif + static inline fstrans_cookie_t spl_fstrans_mark(void) { fstrans_cookie_t cookie; cookie.fstrans_thread = current; - cookie.saved_flags = current->flags & PF_FSTRANS; - current->flags |= PF_FSTRANS; + cookie.saved_flags = current->flags & SPL_FSTRANS; + current->flags |= SPL_FSTRANS; return (cookie); } @@ -94,9 +100,9 @@ static inline void spl_fstrans_unmark(fstrans_cookie_t cookie) { ASSERT3P(cookie.fstrans_thread, ==, current); - ASSERT(current->flags & PF_FSTRANS); + ASSERT((current->flags & SPL_FSTRANS) == SPL_FSTRANS); - current->flags &= ~(PF_FSTRANS); + current->flags &= ~SPL_FSTRANS; current->flags |= cookie.saved_flags; } diff --git a/include/sys/types.h b/include/sys/types.h index ec0455c..d718ca0 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -58,7 +58,6 @@ typedef longlong_t diskaddr_t; typedef ushort_t o_mode_t; typedef uint_t major_t; typedef uint_t minor_t; -typedef ulong_t pfn_t; typedef ulong_t pgcnt_t; typedef long spgcnt_t; typedef short index_t; diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c index c3467a5..c420d18 100644 --- a/module/spl/spl-condvar.c +++ b/module/spl/spl-condvar.c @@ -80,6 +80,7 @@ static void cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state, int io) { DEFINE_WAIT(wait); + kmutex_t *m; ASSERT(cvp); ASSERT(mp); @@ -87,11 +88,11 @@ cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state, int io) ASSERT(mutex_owned(mp)); atomic_inc(&cvp->cv_refs); - if (cvp->cv_mutex == NULL) - cvp->cv_mutex = mp; - + m = ACCESS_ONCE(cvp->cv_mutex); + if (!m) + m = xchg(&cvp->cv_mutex, mp); /* Ensure the same mutex is used by all callers */ - ASSERT(cvp->cv_mutex == mp); + ASSERT(m == NULL || m == mp); prepare_to_wait_exclusive(&cvp->cv_event, &wait, state); atomic_inc(&cvp->cv_waiters); @@ -106,16 +107,25 @@ cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state, int io) io_schedule(); else schedule(); - mutex_enter(mp); /* No more waiters a different mutex could be used */ if (atomic_dec_and_test(&cvp->cv_waiters)) { + /* + * This is set without any lock, so it's racy. But this is + * just for debug anyway, so make it best-effort + */ cvp->cv_mutex = NULL; wake_up(&cvp->cv_destroy); } finish_wait(&cvp->cv_event, &wait); atomic_dec(&cvp->cv_refs); + + /* + * Hold mutex after we release the cvp, otherwise we could dead lock + * with a thread holding the mutex and call cv_destroy. + */ + mutex_enter(mp); } void @@ -148,6 +158,7 @@ __cv_timedwait_common(kcondvar_t *cvp, kmutex_t *mp, clock_t expire_time, int state) { DEFINE_WAIT(wait); + kmutex_t *m; clock_t time_left; ASSERT(cvp); @@ -156,15 +167,16 @@ __cv_timedwait_common(kcondvar_t *cvp, kmutex_t *mp, clock_t expire_time, ASSERT(mutex_owned(mp)); atomic_inc(&cvp->cv_refs); - if (cvp->cv_mutex == NULL) - cvp->cv_mutex = mp; - + m = ACCESS_ONCE(cvp->cv_mutex); + if (!m) + m = xchg(&cvp->cv_mutex, mp); /* Ensure the same mutex is used by all callers */ - ASSERT(cvp->cv_mutex == mp); + ASSERT(m == NULL || m == mp); /* XXX - Does not handle jiffie wrap properly */ time_left = expire_time - jiffies; if (time_left <= 0) { + /* XXX - doesn't reset cv_mutex */ atomic_dec(&cvp->cv_refs); return (-1); } @@ -179,10 +191,13 @@ __cv_timedwait_common(kcondvar_t *cvp, kmutex_t *mp, clock_t expire_time, */ mutex_exit(mp); time_left = schedule_timeout(time_left); - mutex_enter(mp); /* No more waiters a different mutex could be used */ if (atomic_dec_and_test(&cvp->cv_waiters)) { + /* + * This is set without any lock, so it's racy. But this is + * just for debug anyway, so make it best-effort + */ cvp->cv_mutex = NULL; wake_up(&cvp->cv_destroy); } @@ -190,6 +205,11 @@ __cv_timedwait_common(kcondvar_t *cvp, kmutex_t *mp, clock_t expire_time, finish_wait(&cvp->cv_event, &wait); atomic_dec(&cvp->cv_refs); + /* + * Hold mutex after we release the cvp, otherwise we could dead lock + * with a thread holding the mutex and call cv_destroy. + */ + mutex_enter(mp); return (time_left > 0 ? time_left : -1); } @@ -216,6 +236,7 @@ __cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t expire_time, int state) { DEFINE_WAIT(wait); + kmutex_t *m; hrtime_t time_left, now; unsigned long time_left_us; @@ -225,11 +246,11 @@ __cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t expire_time, ASSERT(mutex_owned(mp)); atomic_inc(&cvp->cv_refs); - if (cvp->cv_mutex == NULL) - cvp->cv_mutex = mp; - + m = ACCESS_ONCE(cvp->cv_mutex); + if (!m) + m = xchg(&cvp->cv_mutex, mp); /* Ensure the same mutex is used by all callers */ - ASSERT(cvp->cv_mutex == mp); + ASSERT(m == NULL || m == mp); now = gethrtime(); time_left = expire_time - now; @@ -253,10 +274,13 @@ __cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t expire_time, * interrupts */ usleep_range(time_left_us, time_left_us + 100); - mutex_enter(mp); /* No more waiters a different mutex could be used */ if (atomic_dec_and_test(&cvp->cv_waiters)) { + /* + * This is set without any lock, so it's racy. But this is + * just for debug anyway, so make it best-effort + */ cvp->cv_mutex = NULL; wake_up(&cvp->cv_destroy); } @@ -264,6 +288,7 @@ __cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t expire_time, finish_wait(&cvp->cv_event, &wait); atomic_dec(&cvp->cv_refs); + mutex_enter(mp); time_left = expire_time - gethrtime(); return (time_left > 0 ? time_left : -1); } diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c index 323711d..b58f128 100644 --- a/module/spl/spl-kmem-cache.c +++ b/module/spl/spl-kmem-cache.c @@ -1630,16 +1630,11 @@ spl_kmem_cache_reap_now(spl_kmem_cache_t *skc, int count) atomic_inc(&skc->skc_ref); /* - * Execute the registered reclaim callback if it exists. The - * per-cpu caches will be drained when is set KMC_EXPIRE_MEM. + * Execute the registered reclaim callback if it exists. */ if (skc->skc_flags & KMC_SLAB) { if (skc->skc_reclaim) skc->skc_reclaim(skc->skc_private); - - if (spl_kmem_cache_expire & KMC_EXPIRE_MEM) - kmem_cache_shrink(skc->skc_linux_cache); - goto out; } diff --git a/module/splat/splat-condvar.c b/module/splat/splat-condvar.c index ed633ac..3ffa1c7 100644 --- a/module/splat/splat-condvar.c +++ b/module/splat/splat-condvar.c @@ -88,6 +88,9 @@ splat_condvar_test12_thread(void *arg) ct->ct_thread->comm, atomic_read(&cv->cv_condvar.cv_waiters)); mutex_exit(&cv->cv_mtx); + /* wait for main thread reap us */ + while (!kthread_should_stop()) + schedule(); return 0; } @@ -151,6 +154,12 @@ splat_condvar_test1(struct file *file, void *arg) /* Wake everything for the failure case */ cv_broadcast(&cv.cv_condvar); cv_destroy(&cv.cv_condvar); + + /* wait for threads to exit */ + for (i = 0; i < SPLAT_CONDVAR_TEST_COUNT; i++) { + if (!IS_ERR(ct[i].ct_thread)) + kthread_stop(ct[i].ct_thread); + } mutex_destroy(&cv.cv_mtx); return rc; @@ -199,6 +208,12 @@ splat_condvar_test2(struct file *file, void *arg) /* Wake everything for the failure case */ cv_destroy(&cv.cv_condvar); + + /* wait for threads to exit */ + for (i = 0; i < SPLAT_CONDVAR_TEST_COUNT; i++) { + if (!IS_ERR(ct[i].ct_thread)) + kthread_stop(ct[i].ct_thread); + } mutex_destroy(&cv.cv_mtx); return rc; @@ -234,6 +249,9 @@ splat_condvar_test34_thread(void *arg) mutex_exit(&cv->cv_mtx); + /* wait for main thread reap us */ + while (!kthread_should_stop()) + schedule(); return 0; } @@ -302,6 +320,12 @@ splat_condvar_test3(struct file *file, void *arg) /* Wake everything for the failure case */ cv_broadcast(&cv.cv_condvar); cv_destroy(&cv.cv_condvar); + + /* wait for threads to exit */ + for (i = 0; i < SPLAT_CONDVAR_TEST_COUNT; i++) { + if (!IS_ERR(ct[i].ct_thread)) + kthread_stop(ct[i].ct_thread); + } mutex_destroy(&cv.cv_mtx); return rc; @@ -372,6 +396,12 @@ splat_condvar_test4(struct file *file, void *arg) /* Wake everything for the failure case */ cv_broadcast(&cv.cv_condvar); cv_destroy(&cv.cv_condvar); + + /* wait for threads to exit */ + for (i = 0; i < SPLAT_CONDVAR_TEST_COUNT; i++) { + if (!IS_ERR(ct[i].ct_thread)) + kthread_stop(ct[i].ct_thread); + } mutex_destroy(&cv.cv_mtx); return rc; diff --git a/rpm/generic/spl-kmod.spec.in b/rpm/generic/spl-kmod.spec.in index d4441b8..90632e2 100644 --- a/rpm/generic/spl-kmod.spec.in +++ b/rpm/generic/spl-kmod.spec.in @@ -152,6 +152,8 @@ for kernel_version in %{?kernel_versions}; do INSTALL_MOD_DIR=%{kmodinstdir_postfix} cd .. done + +# find-debuginfo.sh only considers executables chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*/* %{?akmod_install} @@ -160,6 +162,13 @@ chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*/* rm -rf $RPM_BUILD_ROOT %changelog +* Wed Mar 9 2016 Ned Bass - 0.6.5.5-1 +- Linux 4.5 compatibility zfsonlinux/spl#524 +- Create working debuginfo packages on Red Hat zfsonlinux/zfs#4224 +- Allow copy-builtin to run multiple times zfsonlinux/spl#526 +- Use safer flags for in-kernel memory allocations zfsonlinux/spl#523 +- Fix potential deadlock in cv_wait() zfsonlinux/zfs#4106 +- Fix livelock in shrinker zfsonlinux/zfs#3936 * Fri Jan 8 2016 Ned Bass - 0.6.5.4-1 - Build fixes on SPARC and some kernels - Fix taskq dynamic spawning deadlock diff --git a/rpm/generic/spl.spec.in b/rpm/generic/spl.spec.in index 6beebb1..7010356 100644 --- a/rpm/generic/spl.spec.in +++ b/rpm/generic/spl.spec.in @@ -38,6 +38,13 @@ make install DESTDIR=%{?buildroot} %{_mandir}/man5/* %changelog +* Wed Mar 9 2016 Ned Bass - 0.6.5.5-1 +- Linux 4.5 compatibility zfsonlinux/spl#524 +- Create working debuginfo packages on Red Hat zfsonlinux/zfs#4224 +- Allow copy-builtin to run multiple times zfsonlinux/spl#526 +- Use safer flags for in-kernel memory allocations zfsonlinux/spl#523 +- Fix potential deadlock in cv_wait() zfsonlinux/zfs#4106 +- Fix livelock in shrinker zfsonlinux/zfs#3936 * Fri Jan 8 2016 Ned Bass - 0.6.5.4-1 - Build fixes on SPARC and some kernels - Fix taskq dynamic spawning deadlock diff --git a/rpm/redhat/spl-kmod.spec.in b/rpm/redhat/spl-kmod.spec.in index 3935285..6fcc4a8 100644 --- a/rpm/redhat/spl-kmod.spec.in +++ b/rpm/redhat/spl-kmod.spec.in @@ -27,7 +27,6 @@ This package contains the kernel modules required to emulate several interfaces provided by the Solaris kernel. %define kmod_name spl -%define debug_package %{nil} %kernel_module_package -n %{kmod_name} -p %{_sourcedir}/kmod-preamble @@ -96,6 +95,8 @@ make install \ DESTDIR=${RPM_BUILD_ROOT} \ INSTALL_MOD_DIR=extra/%{kmod_name} %{__rm} -f %{buildroot}/lib/modules/%{kverrel}/modules.* +# find-debuginfo.sh only considers executables +%{__chmod} u+x %{buildroot}/lib/modules/%{kverrel}/extra/*/*/* %clean rm -rf $RPM_BUILD_ROOT diff --git a/rpm/redhat/spl.spec.in b/rpm/redhat/spl.spec.in index 6beebb1..7010356 100644 --- a/rpm/redhat/spl.spec.in +++ b/rpm/redhat/spl.spec.in @@ -38,6 +38,13 @@ make install DESTDIR=%{?buildroot} %{_mandir}/man5/* %changelog +* Wed Mar 9 2016 Ned Bass - 0.6.5.5-1 +- Linux 4.5 compatibility zfsonlinux/spl#524 +- Create working debuginfo packages on Red Hat zfsonlinux/zfs#4224 +- Allow copy-builtin to run multiple times zfsonlinux/spl#526 +- Use safer flags for in-kernel memory allocations zfsonlinux/spl#523 +- Fix potential deadlock in cv_wait() zfsonlinux/zfs#4106 +- Fix livelock in shrinker zfsonlinux/zfs#3936 * Fri Jan 8 2016 Ned Bass - 0.6.5.4-1 - Build fixes on SPARC and some kernels - Fix taskq dynamic spawning deadlock