diff options
author | Brian Behlendorf <[email protected]> | 2018-02-15 17:53:18 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-05-29 16:00:33 -0700 |
commit | 93ce2b4ca5a40c41ac945cd3aaf4a4a22bb751e1 (patch) | |
tree | 6832f5c9dfdbe0f0bd5c8708344a769676b1f95d /module/spl | |
parent | 1272941f49321bcb7b26025670720c98785427ee (diff) |
Update build system and packaging
Minimal changes required to integrate the SPL sources in to the
ZFS repository build infrastructure and packaging.
Build system and packaging:
* Renamed SPL_* autoconf m4 macros to ZFS_*.
* Removed redundant SPL_* autoconf m4 macros.
* Updated the RPM spec files to remove SPL package dependency.
* The zfs package obsoletes the spl package, and the zfs-kmod
package obsoletes the spl-kmod package.
* The zfs-kmod-devel* packages were updated to add compatibility
symlinks under /usr/src/spl-x.y.z until all dependent packages
can be updated. They will be removed in a future release.
* Updated copy-builtin script for in-kernel builds.
* Updated DKMS package to include the spl.ko.
* Updated stale AUTHORS file to include all contributors.
* Updated stale COPYRIGHT and included the SPL as an exception.
* Renamed README.markdown to README.md
* Renamed OPENSOLARIS.LICENSE to LICENSE.
* Renamed DISCLAIMER to NOTICE.
Required code changes:
* Removed redundant HAVE_SPL macro.
* Removed _BOOT from nvpairs since it doesn't apply for Linux.
* Initial header cleanup (removal of empty headers, refactoring).
* Remove SPL repository clone/build from zimport.sh.
* Use of DEFINE_RATELIMIT_STATE and DEFINE_SPINLOCK removed due
to build issues when forcing C99 compilation.
* Replaced legacy ACCESS_ONCE with READ_ONCE.
* Include needed headers for `current` and `EXPORT_SYMBOL`.
Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Olaf Faaland <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: Pavel Zakharov <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
TEST_ZIMPORT_SKIP="yes"
Closes #7556
Diffstat (limited to 'module/spl')
-rw-r--r-- | module/spl/Makefile.in | 28 | ||||
-rw-r--r-- | module/spl/README.md | 16 | ||||
-rw-r--r-- | module/spl/spl-condvar.c | 7 | ||||
-rw-r--r-- | module/spl/spl-err.c | 13 | ||||
-rw-r--r-- | module/spl/spl-generic.c | 17 | ||||
-rw-r--r-- | module/spl/spl-kmem.c | 20 | ||||
-rw-r--r-- | module/spl/spl-rwlock.c | 1 | ||||
-rw-r--r-- | module/spl/spl-taskq.c | 3 | ||||
-rw-r--r-- | module/spl/spl-vnode.c | 4 | ||||
-rw-r--r-- | module/spl/spl-xdr.c | 2 |
10 files changed, 65 insertions, 46 deletions
diff --git a/module/spl/Makefile.in b/module/spl/Makefile.in new file mode 100644 index 000000000..97a431f22 --- /dev/null +++ b/module/spl/Makefile.in @@ -0,0 +1,28 @@ +src = @abs_top_srcdir@/module/spl +obj = @abs_builddir@ + +MODULE := spl + +obj-$(CONFIG_ZFS) := $(MODULE).o + +ccflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS) + +$(MODULE)-objs += spl-atomic.o +$(MODULE)-objs += spl-condvar.o +$(MODULE)-objs += spl-cred.o +$(MODULE)-objs += spl-err.o +$(MODULE)-objs += spl-generic.o +$(MODULE)-objs += spl-kmem.o +$(MODULE)-objs += spl-kmem-cache.o +$(MODULE)-objs += spl-kobj.o +$(MODULE)-objs += spl-kstat.o +$(MODULE)-objs += spl-mutex.o +$(MODULE)-objs += spl-proc.o +$(MODULE)-objs += spl-rwlock.o +$(MODULE)-objs += spl-taskq.o +$(MODULE)-objs += spl-thread.o +$(MODULE)-objs += spl-tsd.o +$(MODULE)-objs += spl-vmem.o +$(MODULE)-objs += spl-vnode.o +$(MODULE)-objs += spl-xdr.o +$(MODULE)-objs += spl-zlib.o diff --git a/module/spl/README.md b/module/spl/README.md new file mode 100644 index 000000000..57f635aed --- /dev/null +++ b/module/spl/README.md @@ -0,0 +1,16 @@ +The Solaris Porting Layer, SPL, is a Linux kernel module which provides a +compatibility layer used by the [ZFS on Linux](http://zfsonlinux.org) project. + +# Installation + +The latest version of the SPL is maintained as part of this repository. +Only when building ZFS version 0.7.x or earlier must an external SPL release +be used. These releases can be found at: + + * Version 0.7.x: https://github.com/zfsonlinux/spl/tree/spl-0.7-release + * Version 0.6.5.x: https://github.com/zfsonlinux/spl/tree/spl-0.6.5-release + +# Release + +The SPL is released under a GPLv2 license. +For more details see the NOTICE and THIRDPARTYLICENSE files; `UCRL-CODE-235197` diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c index f0060bbdc..1e6e38b78 100644 --- a/module/spl/spl-condvar.c +++ b/module/spl/spl-condvar.c @@ -27,6 +27,7 @@ #include <sys/condvar.h> #include <sys/time.h> #include <linux/hrtimer.h> +#include <linux/compiler_compat.h> void __cv_init(kcondvar_t *cvp, char *name, kcv_type_t type, void *arg) @@ -89,7 +90,7 @@ cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state, int io) ASSERT(mutex_owned(mp)); atomic_inc(&cvp->cv_refs); - m = ACCESS_ONCE(cvp->cv_mutex); + m = READ_ONCE(cvp->cv_mutex); if (!m) m = xchg(&cvp->cv_mutex, mp); /* Ensure the same mutex is used by all callers */ @@ -202,7 +203,7 @@ __cv_timedwait_common(kcondvar_t *cvp, kmutex_t *mp, clock_t expire_time, return (-1); atomic_inc(&cvp->cv_refs); - m = ACCESS_ONCE(cvp->cv_mutex); + m = READ_ONCE(cvp->cv_mutex); if (!m) m = xchg(&cvp->cv_mutex, mp); /* Ensure the same mutex is used by all callers */ @@ -290,7 +291,7 @@ __cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t expire_time, return (-1); atomic_inc(&cvp->cv_refs); - m = ACCESS_ONCE(cvp->cv_mutex); + m = READ_ONCE(cvp->cv_mutex); if (!m) m = xchg(&cvp->cv_mutex, mp); /* Ensure the same mutex is used by all callers */ diff --git a/module/spl/spl-err.c b/module/spl/spl-err.c index 6b71296e8..4c8f818a9 100644 --- a/module/spl/spl-err.c +++ b/module/spl/spl-err.c @@ -26,7 +26,6 @@ #include <sys/sysmacros.h> #include <sys/cmn_err.h> -#include <linux/ratelimit.h> /* * It is often useful to actually have the panic crash the node so you @@ -40,19 +39,11 @@ module_param(spl_panic_halt, uint, 0644); MODULE_PARM_DESC(spl_panic_halt, "Cause kernel panic on assertion failures"); /* END CSTYLED */ -/* - * Limit the number of stack traces dumped to not more than 5 every - * 60 seconds to prevent denial-of-service attacks from debug code. - */ -DEFINE_RATELIMIT_STATE(dumpstack_ratelimit_state, 60 * HZ, 5); - void spl_dumpstack(void) { - if (__ratelimit(&dumpstack_ratelimit_state)) { - printk("Showing stack for process %d\n", current->pid); - dump_stack(); - } + printk("Showing stack for process %d\n", current->pid); + dump_stack(); } EXPORT_SYMBOL(spl_dumpstack); diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c index b38fe254c..7c1ad390b 100644 --- a/module/spl/spl-generic.c +++ b/module/spl/spl-generic.c @@ -46,12 +46,13 @@ #include <sys/strings.h> #include <linux/kmod.h> -char spl_version[32] = "SPL v" SPL_META_VERSION "-" SPL_META_RELEASE; +char spl_version[32] = "SPL v" ZFS_META_VERSION "-" ZFS_META_RELEASE; EXPORT_SYMBOL(spl_version); /* BEGIN CSTYLED */ unsigned long spl_hostid = 0; EXPORT_SYMBOL(spl_hostid); +/* BEGIN CSTYLED */ module_param(spl_hostid, ulong, 0644); MODULE_PARM_DESC(spl_hostid, "The system hostid."); /* END CSTYLED */ @@ -719,8 +720,6 @@ spl_init(void) if ((rc = spl_zlib_init())) goto out10; - printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s\n", SPL_META_VERSION, - SPL_META_RELEASE, SPL_DEBUG_STR); return (rc); out10: @@ -742,18 +741,12 @@ out3: out2: spl_kvmem_fini(); out1: - printk(KERN_NOTICE "SPL: Failed to Load Solaris Porting Layer " - "v%s-%s%s, rc = %d\n", SPL_META_VERSION, SPL_META_RELEASE, - SPL_DEBUG_STR, rc); - return (rc); } static void __exit spl_fini(void) { - printk(KERN_NOTICE "SPL: Unloaded module v%s-%s%s\n", - SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR); spl_zlib_fini(); spl_kstat_fini(); spl_proc_fini(); @@ -770,6 +763,6 @@ module_init(spl_init); module_exit(spl_fini); MODULE_DESCRIPTION("Solaris Porting Layer"); -MODULE_AUTHOR(SPL_META_AUTHOR); -MODULE_LICENSE(SPL_META_LICENSE); -MODULE_VERSION(SPL_META_VERSION "-" SPL_META_RELEASE); +MODULE_AUTHOR(ZFS_META_AUTHOR); +MODULE_LICENSE("GPL"); +MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE); diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index e0d551041..1fdb61e6f 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -27,7 +27,6 @@ #include <sys/kmem.h> #include <sys/vmem.h> #include <linux/mm.h> -#include <linux/ratelimit.h> /* * As a general rule kmem_alloc() allocations should be small, preferably @@ -135,12 +134,6 @@ strfree(char *str) EXPORT_SYMBOL(strfree); /* - * Limit the number of large allocation stack traces dumped to not more than - * 5 every 60 seconds to prevent denial-of-service attacks from debug code. - */ -DEFINE_RATELIMIT_STATE(kmem_alloc_ratelimit_state, 60 * HZ, 5); - -/* * General purpose unified implementation of kmem_alloc(). It is an * amalgamation of Linux and Illumos allocator design. It should never be * exported to ensure that code using kmem_alloc()/kmem_zalloc() remains @@ -160,7 +153,7 @@ spl_kmem_alloc_impl(size_t size, int flags, int node) * through the vmem_alloc()/vmem_zalloc() interfaces. */ if ((spl_kmem_alloc_warn > 0) && (size > spl_kmem_alloc_warn) && - !(flags & KM_VMEM) && __ratelimit(&kmem_alloc_ratelimit_state)) { + !(flags & KM_VMEM)) { printk(KERN_WARNING "Large kmem_alloc(%lu, 0x%x), please file an issue at:\n" "https://github.com/zfsonlinux/zfs/issues/new\n", @@ -207,14 +200,6 @@ spl_kmem_alloc_impl(size_t size, int flags, int node) continue; } - if (unlikely(__ratelimit(&kmem_alloc_ratelimit_state))) { - printk(KERN_WARNING - "Possible memory allocation deadlock: " - "size=%lu lflags=0x%x", - (unsigned long)size, lflags); - dump_stack(); - } - /* * Use cond_resched() instead of congestion_wait() to avoid * deadlocking systems where there are no block devices. @@ -535,9 +520,12 @@ spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock) int spl_kmem_init(void) { + #ifdef DEBUG_KMEM kmem_alloc_used_set(0); + + #ifdef DEBUG_KMEM_TRACKING spl_kmem_init_tracking(&kmem_list, &kmem_lock, KMEM_TABLE_SIZE); #endif /* DEBUG_KMEM_TRACKING */ diff --git a/module/spl/spl-rwlock.c b/module/spl/spl-rwlock.c index 9a992cc3a..cf03bc593 100644 --- a/module/spl/spl-rwlock.c +++ b/module/spl/spl-rwlock.c @@ -25,6 +25,7 @@ */ #include <sys/rwlock.h> +#include <linux/module.h> #if defined(CONFIG_PREEMPT_RT_FULL) diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 2919a942a..7684257be 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -60,7 +60,7 @@ static taskq_thread_t *taskq_thread_create(taskq_t *); /* List of all taskqs */ LIST_HEAD(tq_list); -DECLARE_RWSEM(tq_list_sem); +struct rw_semaphore tq_list_sem; static uint_t taskq_tsd; static int @@ -1257,6 +1257,7 @@ MODULE_PARM_DESC(spl_taskq_kick, int spl_taskq_init(void) { + init_rwsem(&tq_list_sem); tsd_create(&taskq_tsd, NULL); system_taskq = taskq_create("spl_system_taskq", MAX(boot_ncpus, 64), diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index 28ce21276..aebee0a82 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -40,7 +40,7 @@ EXPORT_SYMBOL(rootdir); static spl_kmem_cache_t *vn_cache; static spl_kmem_cache_t *vn_file_cache; -static DEFINE_SPINLOCK(vn_file_lock); +static spinlock_t vn_file_lock; static LIST_HEAD(vn_file_list); static int @@ -744,6 +744,8 @@ vn_file_cache_destructor(void *buf, void *cdrarg) int spl_vn_init(void) { + vn_file_lock = __SPIN_LOCK_UNLOCKED(vn_file_lock); + vn_cache = kmem_cache_create("spl_vn_cache", sizeof (struct vnode), 64, vn_cache_constructor, vn_cache_destructor, NULL, NULL, NULL, 0); diff --git a/module/spl/spl-xdr.c b/module/spl/spl-xdr.c index 2cc3e2a03..1dd31ffc1 100644 --- a/module/spl/spl-xdr.c +++ b/module/spl/spl-xdr.c @@ -131,8 +131,6 @@ static struct xdr_ops xdrmem_encode_ops; static struct xdr_ops xdrmem_decode_ops; -typedef int bool_t; - void xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size, const enum xdr_op op) |