]> granicus.if.org Git - zfs/log
zfs
10 years agoFix crash when using ZFS on Ceph rbd
Chunwei Chen [Tue, 22 Apr 2014 08:45:36 +0000 (16:45 +0800)]
Fix crash when using ZFS on Ceph rbd

When using __get_free_pages to get high order memory, only the first page's
_count will set to 1, other's will be 0. When an internal page get passed into
rbd, it will eventully go into tcp_sendpage. There, it will be called with
get_page and put_page, and get freed erroneously when _count jump back to 0.

The solution to this problem is to use compound page. All pages in a
high order compound page share a single _count. So get_page and put_page in
tcp_sendpage will not cause _count jump to 0.

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #251

10 years agoAdd support for aarch64 (ARMv8)
Jorgen Lundman [Wed, 16 Apr 2014 03:18:38 +0000 (12:18 +0900)]
Add support for aarch64 (ARMv8)

Using the ARM reference simulation (fast model foundation v8) I
cross compiled spl and zfs, to confirm it works on ARMv8 (64 bit
arm architecture, called aarch64 in Linux).

As it is based on previous ARM porting, the resulting patch is
disappointingly small, there was very little to do. The code fixes
the compile issues and has light testing done.

Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #351

10 years agoChange spl_kmem_cache_expire default setting to 2
Richard Yao [Sun, 4 Aug 2013 23:48:24 +0000 (19:48 -0400)]
Change spl_kmem_cache_expire default setting to 2

This behavior is more consistent with the way memory reclaim
is expected to work under Linux.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #349

10 years agoExpose max/min objs per slab and max slab size
Andrey Vesnovaty [Thu, 6 Feb 2014 10:08:46 +0000 (12:08 +0200)]
Expose max/min objs per slab and max slab size

By default maximal number of objects in slab can't exceed (16*2 - 1) and slab
size can't exceed 32M.
Today's high end servers having couple hundreds of RAM available for ARC may
run into a trouble with virtual memory because of the restriction mentioned
above.

Problem:
Reasons for very high number of virtual memory allocations:
* Real slab size very small relative to the size of the entire RAM
* Slabs allocated on virtual memory and fill entire ARC

The result is very high number of allocated virtual memory ranges (hundreds of
ranges). When virtual memory subsystem manages high number of ranges its
performance become so poor that it freezes from time to time.

Solution:
Number of objects per slab should be increased taking into account maximal
slab size which can also be increased if needed.

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #337

10 years agoAdd ddi_time_after and friends
Chunwei Chen [Tue, 25 Feb 2014 09:16:55 +0000 (17:16 +0800)]
Add ddi_time_after and friends

When comparing times gotten from ddi_get_lbolt, we have to take account of
wrap around of jiffies. Therefore, we cannot use 't1 < t2'. Instead we should
use 't1 - t2 < 0'.

This patch add ddi_time_after and friends to address this issue. They have
strict type restriction, clock_t for vanilla and int64_t for 64 version, to
prevent type conversion from screwing things.

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #335

10 years agoThis patch add a CTASSERT macro for compile time assertion.
Yuxuan Shui [Fri, 1 Nov 2013 16:14:05 +0000 (00:14 +0800)]
This patch add a CTASSERT macro for compile time assertion.

This macro makes the compile to spit "mixed definition and code"
warning, I can't find a way to avoid it.

This patch lays some groundwork for the persistent l2arc feature.
See https://www.illumos.org/issues/3525.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #303

10 years agoSimplify hostid logic
Richard Yao [Tue, 12 Mar 2013 01:16:36 +0000 (21:16 -0400)]
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>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #224

10 years agoCall kthread_create() correctly with fixed arguments.
Tim Chase [Fri, 11 Apr 2014 13:55:10 +0000 (08:55 -0500)]
Call kthread_create() correctly with fixed arguments.

The kernel's kthread_create() function is defined as "..." and there is
no va_list variant at the moment.  The task name is pre-formatted into
a local buffer and passed to kthread_create() with fixed arguments.

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #347

10 years agoDe-inline spl_kthread_create().
Tim Chase [Wed, 9 Apr 2014 18:40:12 +0000 (13:40 -0500)]
De-inline spl_kthread_create().

The function was defined as a static inline with variable arguments
which causes gcc to generate errors on some distros.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Closes #346

10 years agoSupport post-3.13 kthread_create() semantics.
Tim Chase [Wed, 26 Mar 2014 13:29:24 +0000 (08:29 -0500)]
Support post-3.13 kthread_create() semantics.

Provide spl_kthread_create() as a wrapper to the kernel's kthread_create()
to provide pre-3.13 semantics.  Re-try if the call is interrupted or if it
would have returned -ENOMEM.  Otherwise return NULL.

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #339

10 years agosplat cred:groupmember: Fix false positives
Brian Behlendorf [Mon, 7 Apr 2014 21:31:21 +0000 (14:31 -0700)]
splat cred:groupmember: Fix false positives

Due to certain assumptions made in the the cred:groupmember test it
could result in false positives when run on specific distributions.
This was solely a bug in the test case and not in the groupmember()
function which the test case was validating.

To prevent future false positives the test case has been rewritten
to be both more rigerous and to make fewer assumptions about the
system.

Minor style cleanup was done to cr_groups_search() and groupmember()
functions.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
10 years agosplat kmem:slab_reclaim: Test cleanup
Brian Behlendorf [Mon, 7 Apr 2014 22:40:20 +0000 (15:40 -0700)]
splat kmem:slab_reclaim: Test cleanup

By setting __GFP_NORETRY the kernel memory reclaim logic was allowed to
abort early and dump a falled allocation stack to the console.  Since
this was done in a tight loop to fill memory it could result in a large
number of stacks being dumped to the console.  This in turn slowed down
the test sufficiently so it exceeded the time limit and failed.

To resolve this issue the __GFP_NORETRY flag is being removed.  This is
how it should have been called originally to ensure we're simulating
the behavior of most callers which will use the GFP_KERNEL flag.

In addition, the reclaim granularity of 1000 objects was far to coarse
for this to be a realistic test.  For kmem:slab_reclaim there might
only be a few thousand objects total in the cache.  Therefore, the
SPLAT_KMEM_OBJ_RECLAIM constant for these tests was lowered.  This
will cause the reclaim callback to run more frequently which makes
for a better test case.

The frequency of the cache reaping in kmem:slab_reap was increased
to accommodate the reduced number of objects released during the
reclaim.

These changes only impact the test cases and were done to remove
false positives caused by the test case itself.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
10 years agoRemove incorrect use of EXTRA_DIST for man pages
Brian Behlendorf [Fri, 17 Jan 2014 19:40:59 +0000 (11:40 -0800)]
Remove incorrect use of EXTRA_DIST for man pages

Setting the 'dist_' prefix is the correct way to instruct Automake
to include these files in the distribution.  The EXTRA_DIST variable
is reserved for files which are not covered by the automatic rules.

  http://www.gnu.org/software/automake/manual/automake.html#Basics

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
10 years agoDefine the needed ISA types for Sparc
marku89 [Tue, 7 Jan 2014 19:33:19 +0000 (20:33 +0100)]
Define the needed ISA types for Sparc

Add the minimum required ISA types to support the Sparc
architecture.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Signed-off-by: marku89 <mar42@kola.li>
Closes #317

10 years agoRemove default taskq thread to CPU bindings
Brian Behlendorf [Tue, 7 Jan 2014 00:31:49 +0000 (16:31 -0800)]
Remove default taskq thread to CPU bindings

When this code was written it appears to have been assumed that
every taskq would have a large number of threads.  In this case
it would make sense to attempt to evenly bind the threads over
all available CPUs.  However, it failed to consider that creating
taskqs with a small number of threads will cause the CPUs with
lower ids become over-subscribed.

For this reason the kthread_bind() call is being removed and
we're leaving the kernel to schedule these threads as it sees fit.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #325

10 years agoInclude linux/vmalloc.h for ARM and Sparc
Brian Behlendorf [Mon, 6 Jan 2014 23:08:35 +0000 (15:08 -0800)]
Include linux/vmalloc.h for ARM and Sparc

Related to issue #257 which added Linux 3.10 compatibility.  For
ARM and Sparc architectures we must explicitly include the
<linux/vmalloc.h> header to ensure the vmalloc_info structure
is always defined when available.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #257
Closes #291

10 years agoAdd module versioning
Brian Behlendorf [Wed, 4 Dec 2013 18:14:14 +0000 (10:14 -0800)]
Add module versioning

Use the standard Linux MODULE_VERSION macro to expose the installed
spl and splat module versions.  This will also automatically add a
checksum of the .c files and headers in "srcversion".  See:

  /sys/module/spl/version
  /sys/module/spl/srcversion
  /sys/module/splat/version
  /sys/module/splat/srcversion

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes zfsonlinux/zfs#1923

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
10 years agoLinux 3.13 compat: Pass NULL for new delegated inode argument
Richard Yao [Mon, 25 Nov 2013 16:22:33 +0000 (11:22 -0500)]
Linux 3.13 compat: Pass NULL for new delegated inode argument

This check was originally added for SLES10, a093c6a, to check for
a 'struct vfsmount *' argument which they added.  However, since
SLES10 is based on a 2.6.16 kernel which is no longer supported
this functionality was dropped.  The checks were refactored to
support Linux 3.13 without concern for historical versions.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #312

10 years agoLinux 3.13 compat: Remove unused flags variable from __cv_init()
Richard Yao [Thu, 8 Aug 2013 08:30:55 +0000 (04:30 -0400)]
Linux 3.13 compat: Remove unused flags variable from __cv_init()

GCC 4.8.1 complained about an unused flags variable when building
against Linux 2.6.26.8:

/var/tmp/portage/sys-kernel/spl-9999/work/spl-9999/module/spl/../../module/spl/spl-condvar.c:
In function ‘__cv_init’:
/var/tmp/portage/sys-kernel/spl-9999/work/spl-9999/module/spl/../../module/spl/spl-condvar.c:39:6:
error: variable ‘flags’ set but not used
[-Werror=unused-but-set-variable]
  int flags = KM_SLEEP;
        ^
cc1: all warnings being treated as errors

Additionally, the superfluous code uses a preempt_count variable that is
no longer available on Linux 3.13. Deleting the unnecessary code fixes a
Linux 3.13 compatibility issue.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #312

10 years agoDocument SPL module parameters.
Turbo Fredriksson [Mon, 18 Nov 2013 13:46:10 +0000 (13:46 +0000)]
Document SPL module parameters.

This is a first draft of a spl-module-parameters(5) man page. I have
just extracted the parameter name and its description with modinfo,
then checked the source what type it is and its default value.

This will need more work, preferably someone that actually know these
values and what to use them for.  Similar to zfsonlinux/zfs#1856, but
for the spl.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes zfsonlinux/zfs#1856

11 years agoRetroactively fix bogus %changelog date
Brian Behlendorf [Thu, 14 Nov 2013 22:05:45 +0000 (14:05 -0800)]
Retroactively fix bogus %changelog date

New versions of rpmbuild detect the invalid date which was added
incorrectly to the changelog.  To silence this noise fix it.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #306

11 years agoTighten spl dependency on spl-kmod
Cyril Plisko [Thu, 14 Nov 2013 21:58:35 +0000 (13:58 -0800)]
Tighten spl dependency on spl-kmod

Make spl depend on the same version of spl-kmod, rather than on same or
better. When yum repository contains a number of versions the dependency
resolution breaks on trying to install non-latest version.

Signed-off-by: Cyril Plisko <cyril.plisko@mountall.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes zfsonlinux/zfs#1677

11 years agoLinux 3.12 compat: New shrinker API
Richard Yao [Tue, 5 Nov 2013 16:35:54 +0000 (11:35 -0500)]
Linux 3.12 compat: New shrinker API

torvalds/linux@24f7c6 introduced a new shrinker API while
torvalds/linux@a0b021 dropped support for the old shrinker API.
This patch adds support for the new shrinker API by wrapping
the old one with the new one.

This change also reorganizes the autotools checks on the shrinker
API such that the configure script will fail early if an unknown
API is encountered in the future.

Support for the set_shrinker() API which was used by Linux 2.6.22
and older has been dropped.  As a general rule compatibility is
only maintained back to Linux 2.6.26.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes zfsonlinux/zfs#1732
Closes zfsonlinux/zfs#1822
Closes #293
Closes #307

11 years agoEmulate illumos interface cv_timedwait_hires()
Ned Bass [Fri, 1 Nov 2013 20:37:58 +0000 (13:37 -0700)]
Emulate illumos interface cv_timedwait_hires()

Needed for Illumos #3582. This interface is supposed to support
a variable-resolution timeout with nanosecond granularity.  This
implementation rounds up to microsecond resolution, as nanosecond-
precision timing is rarely needed for real-world performance
tuning and may incur unnecessary busy-waiting.  usleep_range() is
used if available, otherwise udelay() or msleep() are used
depending on the length of the delay interval.

Add flags from sys/callo.h as these are used to control the behavior of
cv_timedwait_hires().  Specifically,

CALLOUT_FLAG_ABSOLUTE
    Normally, the expiration passed to the timeout API functions is
    an expiration interval. If this flag is specified, then it is
    interpreted as the expiration time itself.

CALLOUT_FLAG_ROUNDUP
    Roundup the expiration time to the next resolution boundary. If this
    flag is not specified, the expiration time is rounded down.

References:
    https://www.illumos.org/issues/3582
    illumos/illumos-gate@0689f76

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #304

11 years agoMerge branch 'kstat'
Brian Behlendorf [Fri, 25 Oct 2013 20:50:07 +0000 (13:50 -0700)]
Merge branch 'kstat'

This branch updates the existing kstat infrastructure to be
more flexible.  In particular, it extends the KSTAT_TYPE_RAW
type so it may be used to generate more dynamic kstats without
the need for additional custom types.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years ago3537 add kstat_waitq_enter and friends
Ned Bass [Mon, 26 Aug 2013 23:42:11 +0000 (16:42 -0700)]
3537 add kstat_waitq_enter and friends

These kstat interfaces are required to port
"Illumos #3537 want pool io kstats" to ZFS on Linux.

kstat_waitq_enter()
kstat_waitq_exit()
kstat_runq_enter()
kstat_runq_exit()

Additionally, zero out the ks_data buffer in __kstat_create() so
that the kstat_io_t counters are initialized to zero.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoKstat to use private lock by default
Cyril Plisko [Tue, 13 Aug 2013 12:15:36 +0000 (15:15 +0300)]
Kstat to use private lock by default

While porting Illumos #3537 I found that ks_lock member of kstat_t
structure is different between Illumos and SPL. It is a pointer to
the kmutex_t in Illumos, but the mutex lock itself in SPL.
Apparently Illumos kstat API allows consumer to override the lock
if required. With SPL implementation it is not possible anymore.

Things were alright until the first attempt to actually override
the lock. Porting of Illumos #3537 introduced such code for the
first time.

In order to provide the Solaris/Illumos like functionality we:
  1. convert ks_lock to "kmutex_t *ks_lock"
  2. create a new field "kmutex_t ks_private_lock"
  3. On kstat_create() ks_lock = &ks_private_lock

Thus if consumer doesn't care we still have our internal lock in use.
If, however, consumer does care she has a chance to set ks_lock to
anything else before calling kstat_install().

The rest of the code will use ks_lock regardless of its origin.

Signed-off-by: Ned Bass <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #286

11 years agoRevert "Add KSTAT_TYPE_TXG type"
Brian Behlendorf [Mon, 30 Sep 2013 18:32:42 +0000 (11:32 -0700)]
Revert "Add KSTAT_TYPE_TXG type"

This reverts commit dba79fcbf2cc50be5caef84ae01657e884ac5d89 in
favor of using the generic KSTAT_TYPE_RAW callbacks.  The advantage
of this approach is that arbitrary types can be added without the
need to add them to the SPL.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #296

11 years agoAdd wrappers for accessing PID and command info
Prakash Surya [Tue, 24 Sep 2013 23:11:56 +0000 (16:11 -0700)]
Add wrappers for accessing PID and command info

This change adds simple wrappers for accessing a thread's PID and
command character string.

Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #296

11 years agoAdd callbacks for displaying KSTAT_TYPE_RAW kstats
Prakash Surya [Thu, 12 Sep 2013 23:14:51 +0000 (16:14 -0700)]
Add callbacks for displaying KSTAT_TYPE_RAW kstats

The current implementation for displaying kstats of type KSTAT_TYPE_RAW
is rather crude. This patch attempts to enhance this handling by
allowing a kstat user to register formatting callbacks which can
optionally be used.

The callbacks allow the user to implement functions for interpreting
their data and transposing it into a character buffer. This buffer,
containing a string representation of the raw data, is then be displayed
through the current /proc textual interface.

Additionally the kstats are made writable because it's now possible
to provide a useful handler via the existing ks_update() interface.

Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #296

11 years agoDefine SET_ERROR()
Richard Yao [Sun, 6 Oct 2013 02:19:05 +0000 (22:19 -0400)]
Define SET_ERROR()

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoConsistently use local_irq_disable/local_irq_enable
Brian Behlendorf [Wed, 25 Sep 2013 21:52:29 +0000 (14:52 -0700)]
Consistently use local_irq_disable/local_irq_enable

It was observed that spl_kmem_cache_alloc() uses local_irq_save()
and saves the interrupt state in a local variable.  This would
normally be fine except that spl_kmem_cache_alloc() calls
spl_cache_refill() which re-enables interrupts.  It is then
possible that while interrupts are enabled the process is
rescheduled to a different cpu before being disable again.
This could result in us restoring the saved interrupt state
from one cpu to another.

What the consequences of this are aren't perfectly clear, but
this is clearly a bug and it has the potential to cause issues.
The code has been updated to just use local_irq_enable() and
local_irq_disable() to avoid this.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoDocument how to run SPLAT
Kohsuke Kawaguchi [Sun, 22 Sep 2013 16:45:54 +0000 (09:45 -0700)]
Document how to run SPLAT

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #294

11 years agoAdd kpreempt() compatibility macro
Ned Bass [Thu, 29 Aug 2013 03:08:03 +0000 (20:08 -0700)]
Add kpreempt() compatibility macro

This is needed for the Illumos #4045 write throttle patch.  It is used
in the arc eviction code to avoid blocking all arc activity by sitting on
arcs_mtx too long.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #286

11 years agoReplace current_kernel_time() with getnstimeofday()
Richard Yao [Sun, 18 Aug 2013 14:51:06 +0000 (10:51 -0400)]
Replace current_kernel_time() with getnstimeofday()

current_kernel_time() is used by the SPLAT, but it is not meant for
performance measurement. We modify the SPLAT to use getnstimeofday(),
which is equivalent to the gethrestime() function on Solaris.
Additionally, we update gethrestime() to invoke getnstimeofday().

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #279

11 years agoTag spl-0.6.2
Brian Behlendorf [Fri, 16 Aug 2013 22:14:17 +0000 (15:14 -0700)]
Tag spl-0.6.2

META file and release log updated.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoLinux 3.8 compat: Use kuid_t/kgid_t when required
Richard Yao [Sat, 13 Jul 2013 20:34:56 +0000 (16:34 -0400)]
Linux 3.8 compat: Use kuid_t/kgid_t when required

When CONFIG_UIDGID_STRICT_TYPE_CHECKS is enabled uid_t/git_t are
replaced by kuid_t/kgid_t, which are structures instead of integral
types. This causes any code that uses an integral type to fail to build.
The User Namespace functionality introduced in Linux 3.8 requires
CONFIG_UIDGID_STRICT_TYPE_CHECKS, so we could not build against any
kernel that supported it.

We resolve this by converting between the new kuid_t/kgid_t structures
and the original uid_t/gid_t types.

Original-patch-by: DHE
Rewrite-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #260

11 years agoPaX/GrSecurity Linux 3.8.y compat: Use __no_const on struct ctl_table
Richard Yao [Wed, 27 Mar 2013 15:33:14 +0000 (11:33 -0400)]
PaX/GrSecurity Linux 3.8.y compat: Use __no_const on struct ctl_table

The PaX team started constifying `struct ctl_table` as of their Linux
3.8.0 patchset. This lead to zfsonlinux/spl#225 and Gentoo bug #463012.

While investigating our options, I learned that there is a preprocessor
directive called CONSTIFY_PLUGIN that we can use to detect the presence
of the PaX changes and adjust the code accordingly.

The PaX Team had suggested adopting ctl_table_no_const, but supporting
older kernels required declaring that whenever the CONSTIFY_PLUGIN was
set. Future compiler changes could potentially cause that to break in
the presence of -Werror, so instead we define our own spl_ctl_table
typdef and use that. This should be compatible with all PaX kernels.

This introduces a Linux kernel version number check to prevent a build
failure on versions of the PaX GCC plugin that existed for kernels
before Linux 3.8.0. Affected versions of the PaX plugin will trigger a
compiler error when they see no_const cast on a non-constified
structure.  Ordinarily, we would need an autotools check to catch that.
However, it is safe to do a kernel version check instead of an autotools
check in this specific instance because the affected versions of the PaX
GCC plugin only exist for Linux kernels before 3.8.0 and the
constification of `struct ctl_table` by the PaX developers only occurs
in Linux 3.8.0 and later.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #225

11 years agoFix race in spl_kmem_cache_reap_now()
Richard Yao [Sun, 4 Aug 2013 23:35:08 +0000 (19:35 -0400)]
Fix race in spl_kmem_cache_reap_now()

The current code contains a race condition that triggers when bit 2 in
spl.spl_kmem_cache_expire is set, spl_kmem_cache_reap_now() is invoked
and another thread is concurrently accessing its magazine.

spl_kmem_cache_reap_now() currently invokes spl_cache_flush() on each
magazine in the same thread when bit 2 in spl.spl_kmem_cache_expire is
set. This is unsafe because there is one magazine per CPU and the
magazines are lockless, so it is impossible to guarentee that another
CPU is not using its magazine when this function is called.

The solution is to only touch the local CPU's magazine and leave other
CPU's magazines to other CPUs.

Reported-by: DHE
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #274

11 years agoLinux 3.11 compat: Replace num_physpages with totalram_pages
Richard Yao [Wed, 7 Aug 2013 08:50:04 +0000 (04:50 -0400)]
Linux 3.11 compat: Replace num_physpages with totalram_pages

num_physpages was removed by
torvalds/linux@cfa11e08ed39eb28a9eff9a907b20913020c69b5, so lets replace
it with totalram_pages.

This is a bug fix as much as it is a compatibility fix because
num_physpages did not reflect the number of pages actually available to
the kernel:

http://lkml.indiana.edu/hypermail/linux/kernel/0908.2/01001.html

Also, there are known issues with memory calculations when ZFS is in a
Xen dom0. There is a chance that using totalram_pages could resolve
them. This conjecture is untested at the time of writing.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #273

11 years agoAdd kmod repo integration
Brian Behlendorf [Sat, 27 Jul 2013 09:37:38 +0000 (02:37 -0700)]
Add kmod repo integration

When the kmod packaging infrastructure was originally added the
dependency on the rpmfusion yum repositories was disabled.  This
was done at the time in favour of getting local builds working.

Now the time has come to conditionally re-enable that functionality
so we can properly provide binary kmod packages.

  ./configure --with-config=srpm
  make SRPM_DEFINE_KMOD='--define="repo rpmfusion"' srpm-kmod
  mock rebuild spl-kmod-x.y.z-r.el6.src.rpm

One nice benefit of finishing this work is that the generic and
fedora spl-kmod spec files can be merged again.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoFix KMC_OFFSLAB type caches
Brian Behlendorf [Fri, 19 Jul 2013 21:39:35 +0000 (14:39 -0700)]
Fix KMC_OFFSLAB type caches

Because spl_slab_size() was always returning -ENOSPC for caches of
type KMC_OFFSLAB the cache could never be created.  Additionally
the slab size is rounded up to a page which is what kv_alloc()
expects.  The kv_alloc() code will minimally allocate a page,
in the KMC_OFFSLAB case this could be reduced.

The basic regression tests kmem:slab_small, kmem:slab_large,
and kmem:slab_align regression were updated to test KMC_OFFSLAB.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ying Zhu <casualfisher@gmail.com>
Closes #266

11 years agoReturn -1 for generic kmem cache shrinker
Brian Behlendorf [Tue, 23 Jul 2013 22:52:11 +0000 (15:52 -0700)]
Return -1 for generic kmem cache shrinker

It has been observed that it's possible to get in a state where
shrink_slabs() will spin repeated invoking the generic kmem cache
shrinker.  It fails to detect it's not making forward progress
reclaiming from the cache and doesn't give up.  To ensure this
never occurs we unconditionally return -1 after reclaiming what
we can.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Closes zfsonlinux/zfs#1276
Closes zfsonlinux/zfs#1598
Closes zfsonlinux/zfs#1432

11 years agoModify gethrestime to use current_kernel_time()
James H [Sat, 13 Jul 2013 20:25:04 +0000 (21:25 +0100)]
Modify gethrestime to use current_kernel_time()

This allows us to get nanosecond resolution. It also means
we use the same time source as utimensat(now) etc.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #255

11 years agoImprove build instructions
Brian Behlendorf [Thu, 11 Jul 2013 23:07:15 +0000 (16:07 -0700)]
Improve build instructions

Make it clear that when building directly from the Git tree
the configure script must be manually generated by running the
autogen.sh script.  This requires that the GNU autotools packages
be installed for your distribution.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes zfsonlinux/zfs#1448

11 years agoFix bogus kmem leak warning
Brian Behlendorf [Wed, 10 Jul 2013 22:04:07 +0000 (15:04 -0700)]
Fix bogus kmem leak warning

Commit 5c7a036 correctly relocated the creation of a taskq
and the registraction of the kmem_cache_shrinker after the
initialization of the kmem tracking code.  However, the
cleanup of these structures was not done before the leak
checks in spl_kmem_fini().  This resulted in an incorrect
'kmem leaked' warning even though there was no actual leak.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes zfsonlinux/zfs#1569

11 years agoFix --enable-debug-kmem-tracking option
Brian Behlendorf [Wed, 3 Jul 2013 17:14:35 +0000 (10:14 -0700)]
Fix --enable-debug-kmem-tracking option

This code has gotten something stale and no longer builds cleanly
against modern kernels.  The two issues addressed here are as
follows:

* The hlist_*_rcu interfaces in the kernel have been relatively
  unstable.  Since this isn't performance critical code just use
  the long standing hlist_* variants.

* In older kernels the hash_ptr() function takes a 'void *' but
  in newer kernels it expects a 'const void *'.  To silence the
  compiler warnings about this explicitly cast it to a 'void *'.
  The memset function is a similar case but it always expects
  a 'void *'.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #256

11 years agoMerge branch 'linux-3.10'
Brian Behlendorf [Mon, 8 Jul 2013 22:26:59 +0000 (15:26 -0700)]
Merge branch 'linux-3.10'

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #257

11 years agoLinux 3.10 compat: Do not rely on struct proc_dir_entry definition
Richard Yao [Wed, 3 Jul 2013 20:34:52 +0000 (16:34 -0400)]
Linux 3.10 compat: Do not rely on struct proc_dir_entry definition

Linux kernel commit torvalds/linux#59d8053f moved the definition of
struct proc_dir_entry from include/linux/proc_fs.h to the private
header fs/proc/internal.h. The SPL relied on that to map Solaris'
kstat to entries in /proc/spl/kstat.

Since the proc_dir_entry structure is now private the only safe
thing to do is wrap the opaque proc handle with our own structure.
This actually ends up simplify the code and is good because it
moves us away from depending on implementation details of /proc.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #257

11 years agoLinux 3.10 compat: add missing include of linux/slab.h
Yuxuan Shui [Tue, 14 May 2013 00:40:20 +0000 (08:40 +0800)]
Linux 3.10 compat: add missing include of linux/slab.h

Linux kernel commit torvalds/linux@0d01ff2 changes some
includes we were depending on through linux/proc_fs.h.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #257

11 years agoLinux 3.10 compat: replace PDE()->data with PDE_DATA()
Yuxuan Shui [Tue, 14 May 2013 00:39:26 +0000 (08:39 +0800)]
Linux 3.10 compat: replace PDE()->data with PDE_DATA()

Linux kernel commit torvalds/linux@d9dda78b renamed PDE() to
PDE_DATA().  To handle this detect the prefered interface
and define a PDE_DATA() wrapper for consistency.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #257

11 years agoLinux 3.10 compat: struct vmalloc_info moved
Yuxuan Shui [Tue, 14 May 2013 00:31:53 +0000 (08:31 +0800)]
Linux 3.10 compat: struct vmalloc_info moved

Linux kernel commmit torvalds/linux@db3808c1 moved the
vmalloc_info structure from a private to a public header.
Now that it's available for kernel modules use it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #257

11 years agoAdd --buildroot option to kmod build
Nathaniel Clark [Fri, 3 May 2013 12:23:20 +0000 (08:23 -0400)]
Add --buildroot option to kmod build

This allows rpmbuild to define buildroot to point to where kernel
data is located.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #242

11 years agoCopy spl.release.in to kernel dir
Matthew Thode [Fri, 21 Jun 2013 18:55:07 +0000 (14:55 -0400)]
Copy spl.release.in to kernel dir

Required when compiling ZFS in the kernel.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #253

11 years agoFix ASSERT0 and VERIFY0 macro typo
Brian Behlendorf [Fri, 21 Jun 2013 17:02:26 +0000 (10:02 -0700)]
Fix ASSERT0 and VERIFY0 macro typo

Ensure the value is cast to a 'long long' for printing purposes.  The
expectation is that ASSERT0/VERIFY0 are mostly used for validating
return values and thus may commonly be negative.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #246

11 years agoAdd ASSERT0 and VERIFY0 macros
Brian Behlendorf [Fri, 10 May 2013 21:27:30 +0000 (14:27 -0700)]
Add ASSERT0 and VERIFY0 macros

The Illumos code introduced the ASSERT0 and VERIFY0 macros which
are to be used instead of ASSERT3S(x, ==, 0) and VERIFY3S(x, ==, 0).

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Madhav Suresh <madhav.suresh@delphix.com>
Closes #246

11 years agoFix --enable-debug-kmem-tracking option
Tim Chase [Fri, 31 May 2013 02:52:36 +0000 (21:52 -0500)]
Fix --enable-debug-kmem-tracking option

Re-order initialization in spl_kmem_init to allow for kmem tracing
to work.  The spl_kmem_init function calls taskq_create prior to
initializing the tracking (calling spl_kmem_init_tracking).  Since
taskq_create uses kmem_alloc, NULL dereferences occur because the
global kmem_list hasn't had its next & prev pointers initialized yet.

This commit moves the calls to spl_kmem_init_tracking earlier in the
spl_kmem_init function in order that the subsequent kmem_alloc calls
(by taskq_create) work properly.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #243

11 years agoFix taskq_wait_id()
Brian Behlendorf [Mon, 29 Apr 2013 20:47:59 +0000 (13:47 -0700)]
Fix taskq_wait_id()

The existing taskq_wait_id() function can incorrectly block
indefinitely.  Reimplement it more simply using wait_event()
in a similar fashion to taskq_wait_all().

This flaw was uncovered in the context of moving vn_rdwr() to
a taskq.  Previously taskq_wait_id() had no consumers outside
the SPLAT task framework which is why the issue went unnoticed.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoFix delay()
Brian Behlendorf [Wed, 1 May 2013 23:20:28 +0000 (16:20 -0700)]
Fix delay()

Somewhat amazingly it went unnoticed that the delay() function
doesn't actually cause the task to block.  Since the task state
is never changed from TASK_RUNNING before schedule_timeout() the
scheduler allows to task to continue running without any delay.
Using schedule_timeout_interruptible() resolves the issue by
correctly setting TASK_UNINTERRUPTIBLE.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoAdd msec/usec/nsec to tick convertors
Brian Behlendorf [Tue, 30 Apr 2013 16:46:33 +0000 (09:46 -0700)]
Add msec/usec/nsec to tick convertors

Add wrappers for the Solaris MSEC_TO_TICK, USEC_TO_TICK, and
NSEC_TO_TICK conversion functions.  They are mapped directly to
their Linux counterparts with the exception of NSEC_TO_TICK
can cannot use usecs_to_jiffies() because it is not exported
by the kernel.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoIgnore *.{deb,rpm,tar.gz} files in the top directory.
Turbo Fredriksson [Tue, 23 Apr 2013 23:49:06 +0000 (16:49 -0700)]
Ignore *.{deb,rpm,tar.gz} files in the top directory.

These are build products and should be ignored.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Turbo Fredriksson <turbo@bayour.com>
Issue zfsonlinux/zfs#1402

11 years agoAdd --bump=0 to alien
Turbo Fredriksson [Tue, 23 Apr 2013 23:45:45 +0000 (16:45 -0700)]
Add --bump=0 to alien

Preserve the release field when creating Debian packages.  The
--keep-version option was not used because it results in a failure
when the git '<commit>_<hash>' syntax is used for the release.
The '_' is a valid character for RPM packages but not for DEBs.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Turbo Fredriksson <turbo@bayour.com>
Issue zfsonlinux/zfs#1402
Issue zfsonlinux/zfs#928

11 years agoSupport .nogitrelease file
Turbo Fredriksson [Tue, 23 Apr 2013 22:35:37 +0000 (15:35 -0700)]
Support .nogitrelease file

When building a custom release in a git tree provide the ability
to prevent the release field from being overwritten by the
`git describe` output.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue zfsonlinux/zfs#1402

11 years agoFix various generic kmod RPM spec issues.
Etienne Dechamps [Sun, 21 Apr 2013 18:54:29 +0000 (19:54 +0100)]
Fix various generic kmod RPM spec issues.

There are a number of issues with the generic kmod RPM spec in its
current state:
 - The "%{__id_u}" macro seems to not be available on some systems (e.g.
   Debian squeeze). It appears it has been deprecated. Use "${__id} -u"
   instead.
 - The way the "--with-linux=" configure option is generated in the
   non-RHEL/Fedora case is completely wrong with various newline and
   escaping issues (also, $kernel_version is not available in the
   generator context).

The second issue made the generator shell snippet (almost) silently
fail, which under specific circumstances can result in broken builds
against the wrong kernel sources.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #231

11 years agoAdd additional dependencies for DKMS package
Brian Behlendorf [Tue, 2 Apr 2013 20:56:28 +0000 (13:56 -0700)]
Add additional dependencies for DKMS package

For the DKMS package to successfully build the kernel-devel
headers must be included along gcc, make, and perl.  The SPL
code never directly invokes perl but the kernel build system
depends on it.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue zfsonlinux/zfs#1380

11 years agoReplace the SPL_AC_META perl dependency with awk
Brian Behlendorf [Tue, 2 Apr 2013 21:05:23 +0000 (14:05 -0700)]
Replace the SPL_AC_META perl dependency with awk

The only remaining perl dependency is part of the SPL_AC_META macro.
By eliminating this and replacing it with awk we can avoid the need
to pull in perl to rebuild the packages.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue zfsonlinux/zfs#1380

11 years agoAutomake 1.10.1 compat: AM_SILENT_RULES
Brian Behlendorf [Tue, 2 Apr 2013 22:09:29 +0000 (15:09 -0700)]
Automake 1.10.1 compat: AM_SILENT_RULES

Part of the automated testing involves building the source on Debian Lenny
which ships an ancient version of automake (1.10.1).  Historically, this
has caused a non-fatal warning about AM_SILENT_RULES not being defined.
But when the autogen.sh script was updated to use autoreconf the warning
became fatal.

  configure.ac:31: warning: macro `AM_SILENT_RULES' not found in library
  autoreconf: running: /usr/bin/autoconf --force
  configure.ac:34: error: possibly undefined macro: AM_SILENT_RULES
        If this token and others are legitimate, please use m4_pattern_allow.

To resolve this build issue the call to AM_SILENT_RULES has been wrapped
by m4_ifdef().  This prevents the macro from being expanded on platforms
where it's undefined.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agobuild: do not call boilerplate ourself
Jan Engelhardt [Sat, 30 Mar 2013 02:33:09 +0000 (03:33 +0100)]
build: do not call boilerplate ourself

Rationale see section 3.5 "Using `autoreconf' to Update `configure'
Scripts" of the autoconf manual.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agogitignore: anchor entries at their respective directory
Jan Engelhardt [Sat, 30 Mar 2013 02:31:52 +0000 (03:31 +0100)]
gitignore: anchor entries at their respective directory

.ko is specific to module, .m4 to config, etc.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agobuild: use CPPFLAGS
Jan Engelhardt [Sat, 30 Mar 2013 02:30:25 +0000 (03:30 +0100)]
build: use CPPFLAGS

-D and -I are preprocessor flags, so should preferably be in the
appropriate variable.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agobuild: resolve orthographic and other grammatical errors
Jan Engelhardt [Sat, 30 Mar 2013 02:27:50 +0000 (03:27 +0100)]
build: resolve orthographic and other grammatical errors

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoTag spl-0.6.1
Brian Behlendorf [Mon, 25 Mar 2013 20:46:47 +0000 (13:46 -0700)]
Tag spl-0.6.1

META file and release log updated.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoProvide ${kmodname}-devel-kmod for yum-builddep
Brian Behlendorf [Mon, 25 Mar 2013 18:18:11 +0000 (11:18 -0700)]
Provide ${kmodname}-devel-kmod for yum-builddep

In order to ensure that yum-builddep pulls in all the build
requirements a generic ${kmodname}-devel-kmod provides line is
added.  This allows a version of the development headers to be
included without requiring knowledge of the kernel version.

This is important because unlike rpmbuild which does correctly
expand the source rpm spec file, yum-builddep does not.  Without
this generic provides line mock which relies on yum-builddep is
unable to automatically satisfy the dependency.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoUse 'git describe' for working builds
Brian Behlendorf [Fri, 22 Mar 2013 18:27:20 +0000 (11:27 -0700)]
Use 'git describe' for working builds

When building from an arbitrary commit in the git tree it's useful
for the resulting packages to be uniquely identifiable.  Therefore,
the build system has been updated to detect if your compiling in
git tree.

If you are building in a git tree, and there are commits after the
last annotated tag.  Then the <id>-<hash> component of 'git describe'
will be used to overwrite the 'Release:' field in the META file.

The only tricky part is that to ensure the 'make dist' tarball is
built using the correct release.  A dist-hook was added to the top
level make file to rewrite the META file using the correct release.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #195
Issue #111

11 years agoDo not call cond_resched() in spl_slab_reclaim()
Richard Yao [Thu, 21 Mar 2013 17:21:11 +0000 (13:21 -0400)]
Do not call cond_resched() in spl_slab_reclaim()

Calling cond_resched() after each object is freed and then after each
slab is freed can cause slabs of objects to live for excessive periods
of time following reclaimation. This interferes with the kernel's own
memory management when called from kswapd and can cause direct reclaim
to occur in response to memory pressure that should have been resolved.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
11 years agoUse requested kernel for dkms builds
Brian Behlendorf [Wed, 20 Mar 2013 22:11:24 +0000 (15:11 -0700)]
Use requested kernel for dkms builds

The --with-linux and --with-linux-obj options must be specified
as part of the dkms build otherwise the package will be built
against the running kernel.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRemove spl-dkms conflict with spl-kmod
Brian Behlendorf [Wed, 20 Mar 2013 18:33:15 +0000 (11:33 -0700)]
Remove spl-dkms conflict with spl-kmod

Because the spl-dkms package also provides spl-kmod for the
spl user package yum flags this as a conflict.  To avoid the
problem remove the Conflicts tag from spl-dkms and just rely
on the one in spl-kmod.

  spl-dkms-0.6.0-rc14.fc18.noarch has installed conflicts
    spl-kmod: spl-dkms-0.6.0-rc14.fc18.noarch

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoCreate splat man page
Darik Horn [Fri, 15 Mar 2013 19:25:32 +0000 (12:25 -0700)]
Create splat man page

The automake templates have been updated to install this man
page and the existing packaging was updated to include it.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRefresh RPM packaging
Brian Behlendorf [Fri, 8 Feb 2013 19:02:08 +0000 (11:02 -0800)]
Refresh RPM packaging

Refresh the existing RPM packaging to conform to the 'Fedora
Packaging Guidelines'.  This includes adopting the kmods2
packaging standard which is used fod kmods distributed by
rpmfusion for Fedora/RHEL.

  http://fedoraproject.org/wiki/Packaging:Guidelines
  http://rpmfusion.org/Packaging/KernelModules/Kmods2

While the spec files have been entirely rewritten from a
user perspective the only major changes are:

* The Fedora packages now have a build dependency on the
  rpmfusion repositories.  The generic kmod packages also
  have a new dependency on kmodtool-1.22 but it is bundled
  with the source rpm so no additional packages are needed.

* The kernel binary module packages have been renamed from
  spl-modules-* to kmod-spl-* as specificed by kmods2.

* The is now a common kmod-spl-devel-* package in addition
  to the per-kernel devel packages.  The common package
  contains the development headers while the per-kernel
  package contains kernel specific build products.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #222

11 years agoChange spl-kmod-devel install path
Brian Behlendorf [Wed, 20 Feb 2013 21:58:05 +0000 (13:58 -0800)]
Change spl-kmod-devel install path

Install the common spl kernel development headers under
/usr/src/spl-<version>/ rather than in a kernel specific
directory.  The kernel specific build products such as
spl_config.h and Modules.symvers are left installed under
/usr/src/spl-<version>/<kernel>.

This was done to be consistent with where dkms expects
kernel module source to be packaged.  It also allows for
a common spl-kmod-devel package which includes the headers,
and per-kernel spl-kmod-devel-<kernel> packages.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoMerge branch 'linux-3.9'
Brian Behlendorf [Thu, 14 Mar 2013 17:43:46 +0000 (10:43 -0700)]
Merge branch 'linux-3.9'

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #221

11 years agoLinux 3.9 compat: Switch to hlist_for_each{,_rcu}
Richard Yao [Mon, 4 Mar 2013 20:17:03 +0000 (15:17 -0500)]
Linux 3.9 compat: Switch to hlist_for_each{,_rcu}

torvalds/linux@b67bfe0d42cac56c512dd5da4b1b347a23f4b70a changed
hlist_for_each_entry{,_rcu} to take 3 arguments instead of 4. We handle
this by switching to hlist_for_each{,_rcu}, which works across all
supported kernels.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoDrop support for 3 argument version of set_fs_pwd
Richard Yao [Tue, 12 Mar 2013 02:02:45 +0000 (22:02 -0400)]
Drop support for 3 argument version of set_fs_pwd

This was a suggestion that Brian Behlendorf made when reviewing an early
pull request for Linux 3.9 support. This commit was made intentionally
easy to revert should we ever have a reason to reintroduce support for
older kernels.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoLinux 3.9 compat: set_fs_root takes const struct path *
Richard Yao [Mon, 4 Mar 2013 05:24:04 +0000 (00:24 -0500)]
Linux 3.9 compat: set_fs_root takes const struct path *

torvalds/linux@dcf787f39162ce32ca325b3e784aba2d2444619a enforces
const-correctness in passing struct path *.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoLinux 3.9 compat: vfs_getattr takes two arguments
Richard Yao [Mon, 4 Mar 2013 05:02:43 +0000 (00:02 -0500)]
Linux 3.9 compat: vfs_getattr takes two arguments

The function prototype of vfs_getattr previoulsy took struct vfsmount *
and struct dentry * as arguments. These would always be defined together
in a struct path *.

torvalds/linux@3dadecce20603aa380023c65e6f55f108fd5e952 modified
vfs_getattr to take struct path * is taken as an argument instead.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoLinux 3.9 compat: Do not depend on f_vfsmnt
Richard Yao [Mon, 4 Mar 2013 04:45:33 +0000 (23:45 -0500)]
Linux 3.9 compat: Do not depend on f_vfsmnt

torvalds/linux@182be684784334598eee1d90274e7f7aa0063616 removed the
preprocessor definition for f_vfsmnt. The ability to access the
mountpoint via ->f_path.mnt has been stable for a long time, so we
switch to that.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoLinux 3.9 compat: Include linux/sched/rt.h
Richard Yao [Mon, 4 Mar 2013 04:42:32 +0000 (23:42 -0500)]
Linux 3.9 compat: Include linux/sched/rt.h

Linux 3.9 reorganized sched.h, splitting it into numerous files.
torvalds/linux@8bd75c77b7c6a3954140dd2e20346aef3efe4a35 moved MAX_PRIO
and MAX_RT_PRIO to linux/sched/rt.h.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoMerge branch 'build-system'
Brian Behlendorf [Wed, 6 Mar 2013 23:49:57 +0000 (15:49 -0800)]
Merge branch 'build-system'

11 years agoRefresh links to web site
Ned Bass [Tue, 5 Mar 2013 01:26:55 +0000 (17:26 -0800)]
Refresh links to web site

Update links to refer to the official ZFS on Linux website instead of
@behlendorf's personal fork on github.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRemove ARCH packaging
Brian Behlendorf [Sat, 16 Feb 2013 23:32:08 +0000 (15:32 -0800)]
Remove ARCH packaging

The kernel modules are now available in the Arch User Repository
(AUR) via zfs.  Since their packaging is maintained and superior
to ours it is being removed from the tree.

  https://wiki.archlinux.org/index.php/ZFS

Now that various distributions are picking up the packages we
should eventually be able to remove most of this infrastructure.
Packaging belongs with the distributions not upstream.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRemove custom install-data-local for headers
Brian Behlendorf [Wed, 13 Feb 2013 22:01:00 +0000 (14:01 -0800)]
Remove custom install-data-local for headers

Rather than use a custom install target it is cleaner to define
a 'kerneldir' and set 'kernel_HEADERS' appropriately.  This
allows us to leverage the standing configure install support.

Additionally, I took this opertunity add the missing make files
to the include subdirectories.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoAdd KMODDIR to install target
Brian Behlendorf [Tue, 12 Feb 2013 23:56:02 +0000 (15:56 -0800)]
Add KMODDIR to install target

Provide a mechanism to control the directory name the modules
are installed in.  The kernel privdes INSTALL_MOD_DIR for
this but it was hardcoded to be 'addon/spl'.

Add a KMODDIR variable which can be passed to 'make install'
to override the default directory name.  While we're here
change the default from 'addon/spl' to 'extra' which is the
kernel.org default.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoFix spl_config.h install permissions
Brian Behlendorf [Fri, 8 Feb 2013 21:54:24 +0000 (13:54 -0800)]
Fix spl_config.h install permissions

The default permissions used by install are 755.  Since this
file isn't executable 644 is more appropriate.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRemove INSTALL
Brian Behlendorf [Fri, 8 Feb 2013 20:17:18 +0000 (12:17 -0800)]
Remove INSTALL

The generic INSTALL instructions can be safely dropped.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoDisable automatic log dumping
Brian Behlendorf [Tue, 5 Feb 2013 23:59:36 +0000 (15:59 -0800)]
Disable automatic log dumping

Long ago infrastructure was added to the SPL to keep an internal
debug log of the last few seconds of activity.  This was helpful
during the early development, but these days it is no longer
needed.  I haven't had to resort to this debug buffer to resolve
an issue for several years now.

Today better more generic tools like systemtap and ftrace have
evolved to the point where they can be used for this purpose.
Along with the stack trace dumped to the system console, and in
rare cases a crash dump we almost always have the debug we need.

Therefore, I'm disabling the code which automatically dumps
this log to disk during an assertion except for the case where
spl_debug_panic_on_bug is set (disabled by default).

This should be viewed as a first step towards either.

  a) Retiring this infrastructure and complexity entirely, or
  b) Integrating this logging more properly with ftrace.

As part of this change I'm also removing from the packages the
undocumented spl utility which is used to decode the binary logs.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoFix HAVE_MUTEX_OWNER_TASK_STRUCT autotools check on PPC64
Richard Yao [Tue, 5 Feb 2013 21:42:29 +0000 (16:42 -0500)]
Fix HAVE_MUTEX_OWNER_TASK_STRUCT autotools check on PPC64

The HAVE_MUTEX_OWNER_TASK_STRUCT fails on PPC64 with the following
error:

error: 'current' undeclared (first use in this function)

We include linux/sched.h to ensure that current is available.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoFix atomic64_* autoconf checks
Brian Behlendorf [Tue, 5 Feb 2013 17:35:43 +0000 (09:35 -0800)]
Fix atomic64_* autoconf checks

The SPL_AC_ATOMIC_SPINLOCK, SPL_AC_TYPE_ATOMIC64_CMPXCHG, and
SPL_AC_TYPE_ATOMIC64_XCHG were all directly including the
'asm/atomic.h' header.  As of Linux 3.4 this header was removed
which results in a build failure.

The right thing to do is include 'linux/atomic.h' however we
can't safely do this because it doesn't exist in 2.6.26 kernels.
Therefore, we include 'linux/fs.h' which in turn includes the
correct atomic header regardless of the kernel version.

When these incorrect APIs are used in ZFS the following build
failure results.

  arc.c:791:80: warning: '__ret' may be used uninitialized
  in this function [-Wuninitialized]
  arc.c:791:1875: error: call to '__cmpxchg_wrong_size'
  declared with attribute error: Bad argument size for cmpxchg

Since this is all Linux 2.6.24 compatibility code there's
an argument to be made that it should be removed because
kernels this old are not supported.  However, because we're
so close to a release I'm going to leave it in place for now.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes zfsonlinux/zfs#814
Closes zfsonlinux/zfs#1254

11 years agoSPL 0.6.0-rc14
Brian Behlendorf [Fri, 1 Feb 2013 19:24:54 +0000 (11:24 -0800)]
SPL 0.6.0-rc14

11 years agoFix tsd_get/set() race with tsd_exit/destroy()
Brian Behlendorf [Thu, 31 Jan 2013 20:59:39 +0000 (12:59 -0800)]
Fix tsd_get/set() race with tsd_exit/destroy()

The tsd_exit() and tsd_destroy() functions remove entries from
hash bins without taking the hash bin lock.  They do take the
table lock, but tsd_get() and tsd_set() only take the hash bin
lock to allow for maximum concurency.

The result is that while tsd_get() and tsd_set() are traversing
the hash bin list it can be modified by another thread in which
happens to hash to the same value.  To avoid this add the needed
locking to tsd_exit() and tsd_destroy().

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #174

11 years agoCheck for KALLSYMS
Brian Behlendorf [Wed, 30 Jan 2013 00:13:07 +0000 (16:13 -0800)]
Check for KALLSYMS

Check at ./configure time that the kernel was built with kallsyms
support.  If the kernel doesn't have CONFIG_KALLSYMS defined the
modules will still compile cleanly but will not be loadable.  So
we really want to catch this early during ./configure.  Note that
we do not require CONFIG_KALLSYMS_ALL but it may be safely defined.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #6