]> git.proxmox.com Git - mirror_spl-debian.git/log
mirror_spl-debian.git
11 years agoMerge branch 'upstream'
Darik Horn [Sat, 1 Dec 2012 04:57:43 +0000 (22:57 -0600)]
Merge branch 'upstream'

11 years agoVerify --with-linux source directory exists
Brian Behlendorf [Fri, 30 Nov 2012 03:26:19 +0000 (19:26 -0800)]
Verify --with-linux source directory exists

Previously this check was only performed when ./configure was
attempting to autodetect your kernel source directory.  But we
should also handle the case where --with-linux was provided
and is obviously wrong.  This way we catch the error before
invoking make and compiling the source with an incorrect
autoconf results.

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

11 years agoDisable FS reclaim when allocating new slabs
Brian Behlendorf [Tue, 27 Nov 2012 00:52:28 +0000 (16:52 -0800)]
Disable FS reclaim when allocating new slabs

Allowing the spl_cache_grow_work() function to reclaim inodes
allows for two unlikely deadlocks.  Therefore, we clear __GFP_FS
for these allocations.  The two deadlocks are:

* While holding the ZFS_OBJ_HOLD_ENTER(zsb, obj1) lock a function
  calls kmem_cache_alloc() which happens to need to allocate a
  new slab.  To allocate the new slab we enter FS level reclaim
  and attempt to evict several inodes.  To evict these inodes we
  need to take the ZFS_OBJ_HOLD_ENTER(zsb, obj2) lock and it
  just happens that obj1 and obj2 use the same hashed lock.

* Similar to the first case however instead of getting blocked
  on the hash lock we block in txg_wait_open() which is waiting
  for the next txg which isn't coming because the txg_sync
  thread is blocked in kmem_cache_alloc().

Note this isn't a 100% fix because vmalloc() won't strictly
honor __GFP_FS.  However, it practice this is sufficient because
several very unlikely things must all occur concurrently.

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

11 years agoPPA 0.6.0.87-0ubuntu1 release.
Darik Horn [Sat, 24 Nov 2012 20:34:33 +0000 (14:34 -0600)]
PPA 0.6.0.87-0ubuntu1 release.

11 years agoPPA 0.6.0.86-0ubuntu1 release.
Darik Horn [Thu, 15 Nov 2012 02:11:08 +0000 (20:11 -0600)]
PPA 0.6.0.86-0ubuntu1 release.

11 years agoMerge branch 'upstream'
Darik Horn [Thu, 15 Nov 2012 02:10:12 +0000 (20:10 -0600)]
Merge branch 'upstream'

11 years agoSPL 0.6.0-rc12
Brian Behlendorf [Tue, 13 Nov 2012 22:28:25 +0000 (14:28 -0800)]
SPL 0.6.0-rc12

11 years agoPPA 0.6.0.85-0ubuntu1 release.
Darik Horn [Mon, 12 Nov 2012 04:33:58 +0000 (22:33 -0600)]
PPA 0.6.0.85-0ubuntu1 release.

11 years agoMerge branch 'upstream'
Darik Horn [Mon, 12 Nov 2012 04:32:05 +0000 (22:32 -0600)]
Merge branch 'upstream'

11 years agoMerge branch 'kmem-cache-optimization'
Brian Behlendorf [Thu, 8 Nov 2012 19:00:23 +0000 (11:00 -0800)]
Merge branch 'kmem-cache-optimization'

This branch contains kmem cache optimizations designed to resolve
the lockups reported in zfsonlinux/zfs#922.  The lockups were
largely the result of spin lock contention in the slab under low
memory conditions.  Fundamentally, these changes are all designed
to minimize that contention though a variety of methods.

  * Improved vmem cached deadlock detection
  * Track emergency objects in rbtree
  * Optimize spl_kmem_cache_free()
  * Never spin in kmem_cache_alloc()

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

11 years agoNever spin in kmem_cache_alloc()
Brian Behlendorf [Mon, 5 Nov 2012 21:54:20 +0000 (13:54 -0800)]
Never spin in kmem_cache_alloc()

If we are reaping from the cache and a concurrent allocation
occurs then the caller must block until the reaping is complete.
This is signaled by the clearing of the KMC_BIT_REAPING bit.

Otherwise the caller will be in a tight loop which takes and
releases the skc->skc_cache lock.  When there are multiple
concurrent callers the system will thrash on the lock and
appear to lock up.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoOptimize spl_kmem_cache_free()
Brian Behlendorf [Tue, 30 Oct 2012 18:21:42 +0000 (11:21 -0700)]
Optimize spl_kmem_cache_free()

Because only virtual slabs may have emergency objects and these
objects are guaranteed to have physical addresses.  It can be
easily determined if the passed object is a virtual slab object
or an emergency object.  This allows us to completely optimize
the emergency object free case out of the common free path.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoTrack emergency object in rbtree
Brian Behlendorf [Tue, 30 Oct 2012 17:45:50 +0000 (10:45 -0700)]
Track emergency object in rbtree

In the initial implementation emergency objects were tracked on a
per-cache list.  The assumption was that under normal operation we
would never allocate more than a handful of these objects.  So the
cost of walking the list during free was expected to be negligible.

However real world usage has shown that emergency objects tend to
be allocated in batches.  A deadlock will be detected and several
thousand emergency objects will be allocated before the original
blocked slab allocation can complete.

Therefore the original list has been replaced by a red black tree
which is sorted by the memory address of each allocated object.
This bounds the worst case insertion and removal time to O(log n)
which minimize contention on the assoicated spin lock.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoImproved vmem cached deadlock detection
Brian Behlendorf [Mon, 29 Oct 2012 23:51:59 +0000 (16:51 -0700)]
Improved vmem cached deadlock detection

The entire goal of performing the slab allocations asynchronously
is to be able to detect when a vmalloc() deadlocks.  In this case,
and only this case, do we want to start allocating emergency objects.
The trick here is to minimize false positives because the overhead
of tracking emergency objects is far higher than normal slab objects.

With that goal in mind the code was reworked to be less sensitive
to slow allocations by increasing the wait time.  Once a cache is
is marked deadlocked all subsequent allocations which can not be
satisfied with existing cache objects will immediately allocate new
emergency objects.  This behavior persists until the asynchronous
allocation completes and clears the deadlocked flag.

The result of these tweaks is that far fewer emergency objects
get created which is important because this minimizes the cost of
releasing them latter in kmem_cache_free().

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoMerge branch 'splat'
Brian Behlendorf [Tue, 6 Nov 2012 22:49:11 +0000 (14:49 -0800)]
Merge branch 'splat'

Additional debugging, some cleanup, and an assortment of fixes
to the SPLAT tests and infrastructure.  Full details in the
individual patches.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agosplat kmem:slab_overcommit: Disabled
Brian Behlendorf [Fri, 2 Nov 2012 23:13:50 +0000 (16:13 -0700)]
splat kmem:slab_overcommit: Disabled

Disable this test because it may result in an OOM event on the
system which can result in the test infrastructure being killed.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agosplat atomic:64-bit: Create thread outside spin lock
Brian Behlendorf [Fri, 2 Nov 2012 21:14:53 +0000 (14:14 -0700)]
splat atomic:64-bit: Create thread outside spin lock

The Fedora 3.6 debug kernel identified the following issue where
we create a thread under a spin lock.  This isn't safe because
sleeping could result in a deadlock.  Therefore the lock is changed
to a mutex so it's safe to sleep.

  BUG: sleeping function called from invalid context at mm/slub.c:930
  in_atomic(): 1, irqs_disabled(): 0, pid: 10583, name: splat
  1 lock held by splat/10583:

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agosplat: Fix log buffer locking
Brian Behlendorf [Fri, 2 Nov 2012 22:31:04 +0000 (15:31 -0700)]
splat: Fix log buffer locking

The Fedora 3.6 debug kernel identified the following issue where
we call copy_to_user() under a spin lock().  This used to be safe
in older kernels but no longer appears to be true so the spin
lock was changed to a mutex.  None of this code is performance
critical so allowing the process to sleep is harmless.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agosplat: Cleanup headers
Brian Behlendorf [Fri, 2 Nov 2012 22:29:44 +0000 (15:29 -0700)]
splat: Cleanup headers

Restructure the the SPLAT headers such that each test only
includes the minimal set of headers it requires.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoCondition variable reference counts
Brian Behlendorf [Mon, 5 Nov 2012 17:04:50 +0000 (09:04 -0800)]
Condition variable reference counts

Reference count every entry and exit from the condition variable
functions: cv_wait(), cv_wait_timeout(), cv_signal(), cv_broadcast().

This allows us to safely block in cv_destroy() until all consumers
have been scheduled and are no longer accessing the condition
variable memory.

In addition poison the magic value at the start of cv_destroy() to
ensure there are never any new callers after cv_destroy() is called.
The consumer is responsible for ensuring this never occurs.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoMerge remote branch 'eris/stats'
Brian Behlendorf [Tue, 6 Nov 2012 22:48:33 +0000 (14:48 -0800)]
Merge remote branch 'eris/stats'

Bring in support for the new KSTAT_TYPE_TXG type.  This allows for
additional visibility in to the txg handling.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoAdd KSTAT_TYPE_TXG type
Brian Behlendorf [Mon, 22 Oct 2012 23:57:27 +0000 (16:57 -0700)]
Add KSTAT_TYPE_TXG type

Add a new kstat type for tracking useful statistics about a TXG.
The new KSTAT_TYPE_TXG type can be used to tracks the following
statistics per-txg.

  txg          - Unique txg number
  state        - State (O)pen/(Q)uiescing/(S)yncing/(C)ommitted
  birth;       - Creation time
  nread        - Bytes read
  nwritten;    - Bytes written
  reads        - IOPs read
  writes       - IOPs write
  open_time;   - Length in nanoseconds the txg was open
  quiesce_time - Length in nanoseconds the txg was quiescing
  sync_time;   - Length in nanoseconds the txg was syncing

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoPPA 0.6.0.84-0ubuntu1 release.
Darik Horn [Fri, 2 Nov 2012 22:08:20 +0000 (17:08 -0500)]
PPA 0.6.0.84-0ubuntu1 release.

11 years agoMerge branch 'upstream'
Darik Horn [Fri, 2 Nov 2012 22:06:39 +0000 (17:06 -0500)]
Merge branch 'upstream'

11 years agoPPA 0.6.0.83-0ubuntu1 release.
Darik Horn [Mon, 29 Oct 2012 02:51:39 +0000 (21:51 -0500)]
PPA 0.6.0.83-0ubuntu1 release.

11 years agoDisable Ubuntu 11.04 Natty Narwhal builds.
Darik Horn [Mon, 29 Oct 2012 02:49:28 +0000 (21:49 -0500)]
Disable Ubuntu 11.04 Natty Narwhal builds.

Distro support for Natty ended October 28th 2012:

  https://lists.ubuntu.com/archives/ubuntu-announce/2012-October/000165.html

11 years agoMake kstat.ks_update() callback atomic
Brian Behlendorf [Tue, 23 Oct 2012 16:17:29 +0000 (09:17 -0700)]
Make kstat.ks_update() callback atomic

Move the kstat ks_update() callback under the ks_lock.  This
enables dynamically sized kstats without modification to the
kstat API.

  * Create a kstat with the KSTAT_FLAG_VIRTUAL flag.
  * Register a ->ks_update() callback which does:
    o Frees any existing ks_data buffer.
    o Set ks_data_size to the kstat array size.
    o Set ks_data to an allocated buffer of size ks_data_size
    o Populate the array of buffers with the required data.

The buffer allocated in the ks_update() callback is guaranteed
to remain allocated and valid while the proc sequence handler
iterates over the buffer.  The lock will not be dropped until
kstat_seq_stop() function is run making it safe for concurrent
access.  To allow the ks_update() callback to perform memory
allocations the lock was changed to a mutex.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoPPA 0.6.0.82-0ubuntu1 release.
Darik Horn [Mon, 22 Oct 2012 04:17:49 +0000 (23:17 -0500)]
PPA 0.6.0.82-0ubuntu1 release.

11 years agoMerge branch 'upstream'
Darik Horn [Mon, 22 Oct 2012 04:16:52 +0000 (23:16 -0500)]
Merge branch 'upstream'

11 years agoLinux 3.7 compat, __clear_close_on_exec() removed
Brian Behlendorf [Thu, 18 Oct 2012 19:37:32 +0000 (12:37 -0700)]
Linux 3.7 compat, __clear_close_on_exec() removed

Commit torvalds/linux@b8318b0 moved the __clear_close_on_exec()
function out of include/linux/fdtable.h and in to fs/file.c
making it unavailable to the SPL.

Now as it turns out we only used this function to tear down
some test infrastructure for the vn_getf()/vn_releasef() SPLAT
regression tests.  Rather than implement even more autoconf
compatibilty code to handle this we just remove the test case.
This also allows us to drop three existing autoconf tests.

This does mean the SPLAT tests will no longer verify these
functions but historically they have never been a problem.
And if we feel we absolutely need this test coverage I'm
sure a more portable version of the test case could be added.

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

11 years agoLinux 3.6 compat, kern_path_locked() added
Yuxuan Shui [Thu, 11 Oct 2012 14:41:33 +0000 (22:41 +0800)]
Linux 3.6 compat, kern_path_locked() added

The kern_path_parent() function was removed from Linux 3.6 because
it was observed that all the callers just want the parent dentry.
The simpler kern_path_locked() function replaces kern_path_parent()
and does the lookup while holding the ->i_mutex lock.

This is good news for the vn implementation because it removes the
need for us to handle the locking.  However, it makes it harder to
implement a single readable vn_remove()/vn_rename() function which
is usually what we prefer.

Therefore, we implement a new version of vn_remove()/vn_rename()
for Linux 3.6 and newer kernels.  This allows us to leave the
existing working implementation untouched, and to add a simpler
version for newer kernels.

Long term I would very much like to see all of the vn code removed
since what this code enabled is generally frowned upon in the kernel.
But that can't happen util we either abondon the zpool.cache file
or implement alternate infrastructure to update is correctly in
user space.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #154

11 years agoSwitch KM_SLEEP to KM_PUSHPAGE
Massimo Maggi [Thu, 11 Oct 2012 23:19:48 +0000 (16:19 -0700)]
Switch KM_SLEEP to KM_PUSHPAGE

In this particular instance the allocation occurred in the context
of sys_msync()->...->zpl_putpage() where we must be careful not to
initiate additional I/O.

Signed-off-by: Massimo Maggi <massimo@mmmm.it>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoPPA 0.6.0.81-0ubuntu1 release.
Darik Horn [Sun, 7 Oct 2012 02:49:35 +0000 (21:49 -0500)]
PPA 0.6.0.81-0ubuntu1 release.

11 years agoMerge branch 'upstream'
Darik Horn [Sun, 7 Oct 2012 02:48:18 +0000 (21:48 -0500)]
Merge branch 'upstream'

11 years agoAdd interface for file hole punching.
Etienne Dechamps [Mon, 3 Sep 2012 12:56:26 +0000 (14:56 +0200)]
Add interface for file hole punching.

This adds an interface to "punch holes" (deallocate space) in VFS
files. The interface is identical to the Solaris VOP_SPACE interface.
This interface is necessary for TRIM support on file vdevs.

This is implemented using Linux fallocate(FALLOC_FL_PUNCH_HOLE), which
was introduced in 2.6.38. For a brief time before 2.6.38 this was done
using the truncate_range inode operation, which was quickly deprecated.
This patch only supports FALLOC_FL_PUNCH_HOLE.

This adds support for the truncate_range() inode operation to
VOP_SPACE() for file hole punching. This API is deprecated and removed
in 3.5, so it's only useful for old kernels.

On tmpfs, the truncate_range() inode operation translates to
shmem_truncate_range(). Unfortunately, this function expects the end
offset to be inclusive and aligned to the end of a page. If it is not,
the kernel will stop with a BUG_ON().

This patch fixes the issue by adapting to the constraints set forth by
shmem_truncate_range().

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

11 years agoPPA 0.6.0.80-0ubuntu1 release.
Darik Horn [Tue, 18 Sep 2012 21:58:24 +0000 (16:58 -0500)]
PPA 0.6.0.80-0ubuntu1 release.

11 years agoMerge branch 'upstream'
Darik Horn [Tue, 18 Sep 2012 21:57:28 +0000 (16:57 -0500)]
Merge branch 'upstream'

11 years agoAdd quantal to the PPA build list.
Darik Horn [Tue, 18 Sep 2012 21:56:16 +0000 (16:56 -0500)]
Add quantal to the PPA build list.

Begin building packages for the Ubuntu 12.10 Quantal Quetzal
beta release.

11 years agoSPL 0.6.0-rc11
Brian Behlendorf [Tue, 18 Sep 2012 18:28:57 +0000 (11:28 -0700)]
SPL 0.6.0-rc11

11 years agoPPA 0.6.0.79-0ubuntu1 release.
Darik Horn [Tue, 18 Sep 2012 04:36:48 +0000 (23:36 -0500)]
PPA 0.6.0.79-0ubuntu1 release.

11 years agoGenerate META from debian/changelog.
Darik Horn [Fri, 14 Sep 2012 21:39:40 +0000 (16:39 -0500)]
Generate META from debian/changelog.

The META file contains a version number that is baked into the kernel module
and appears in the dmesg. Most users report bugs using this information.

At build time, substitute the downstream version in the debian/changelog file
for the upstream version in the META file. This obsoletes the volatile-version
patch.

Closes: dajhorn/pkg-zfs#45
11 years agoPPA 0.6.0.78-0ubuntu1 release.
Darik Horn [Fri, 14 Sep 2012 17:41:08 +0000 (12:41 -0500)]
PPA 0.6.0.78-0ubuntu1 release.

11 years agoMerge branch 'upstream'
Darik Horn [Fri, 14 Sep 2012 17:39:34 +0000 (12:39 -0500)]
Merge branch 'upstream'

11 years agoSwitch KM_SLEEP to KM_PUSHPAGE
Brian Behlendorf [Wed, 12 Sep 2012 19:24:41 +0000 (12:24 -0700)]
Switch KM_SLEEP to KM_PUSHPAGE

Under certain circumstances the following functions may be called
in a context where KM_SLEEP is unsafe and can result in a deadlocked
system.  To avoid this problem the unconditional KM_SLEEPs are
converted to KM_PUSHPAGEs.  This will prevent them from attempting
to initiate any I/O during direct reclaim.

This change was originally part of cd5ca4b but was reverted by
330fe01.  It always should have had its own commit for exactly
this reason.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRemove TQ_SLEEP -> KM_SLEEP mapping
Brian Behlendorf [Wed, 12 Sep 2012 18:31:39 +0000 (11:31 -0700)]
Remove TQ_SLEEP -> KM_SLEEP mapping

When the taskq code was originally written it seemed like a good
idea to simply map TQ_SLEEP to KM_SLEEP.  Unfortunately, this
assumed that the TQ_* flags would never confict with any of the
Linux GFP_* flags.  When adding the TQ_PUSHPAGE support in commit
cd5ca4b this invariant was accidentally broken.

Therefore to support TQ_PUSHPAGE, which is needed for Linux, and
prevent any further confusion I have removed this direct mapping.
The TQ_SLEEP, TQ_NOSLEEP, and TQ_PUSHPAGE are no longer defined
in terms of their KM_* counterparts.  Instead a simple mapping
function is introduce to convert TQ_* -> KM_* where needed.

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

11 years agoRevert "Switch KM_SLEEP to KM_PUSHPAGE"
Brian Behlendorf [Wed, 12 Sep 2012 17:06:13 +0000 (10:06 -0700)]
Revert "Switch KM_SLEEP to KM_PUSHPAGE"

This reverts commit cd5ca4b2f86a606aa6ed68341a3672fdde1c9856
due to conflicts in the higher TQ_ bits which caused incorrect
behavior.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoPPA 0.6.0.77-0ubuntu1 release.
Darik Horn [Tue, 11 Sep 2012 21:14:36 +0000 (16:14 -0500)]
PPA 0.6.0.77-0ubuntu1 release.

11 years agoMerge branch 'upstream'
Darik Horn [Tue, 11 Sep 2012 21:12:20 +0000 (16:12 -0500)]
Merge branch 'upstream'

11 years agoRemove autotools products
Chris Dunlop [Tue, 11 Sep 2012 06:48:01 +0000 (16:48 +1000)]
Remove autotools products

spl_config.h.in is a generated file: remove and .gitignore it

Signed-off-by: Chris Dunlop <chris@onthe.net.au>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoDebug cv_destroy() with mutex held
Brian Behlendorf [Fri, 7 Sep 2012 18:05:46 +0000 (11:05 -0700)]
Debug cv_destroy() with mutex held

There still appears to be a race in the condition variables where
->cv_mutex is set after we are woken from the cv_destroy wait queue.
This might be possible when cv_destroy() is called immediately after
cv_broadcast().  We had some troubles with this previously but
there may still be a small race, see commit d599e4f.

The following patch closes one small race and improves the ASSERTs
such that they log the offending value.

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

11 years agoSet KMC_NOEMERGENCY for zlib workspaces
Brian Behlendorf [Fri, 7 Sep 2012 21:28:07 +0000 (14:28 -0700)]
Set KMC_NOEMERGENCY for zlib workspaces

The workspace required by zlib to perform compression is roughly
512MB (order-7).  These allocations are so large that we should
never attempt to directly kmalloc an emergency object for them.

It is far preferable to asynchronously vmalloc an additional slab
in case it's needed.  Then simply block waiting for an existing
object to be released or for the new slab to be allocated.

This can be accomplished by disabling emergency slab objects by
passing the KMC_NOEMERGENCY flag at slab creation time.

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

11 years agoAdd KMC_NOEMERGENCY slab flag
Brian Behlendorf [Fri, 7 Sep 2012 21:24:17 +0000 (14:24 -0700)]
Add KMC_NOEMERGENCY slab flag

Provide a flag to disable the use of emergency objects for a
specific kmem cache.  There may be instances where under no
circumstances should you kmalloc() an emergency object.  For
example, when you cache contains very large objects (>128k).

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoPPA 0.6.0.76-0ubuntu1 release.
Darik Horn [Fri, 7 Sep 2012 01:05:38 +0000 (20:05 -0500)]
PPA 0.6.0.76-0ubuntu1 release.

11 years agoPPA 0.6.0.75-0ubuntu1 release.
Darik Horn [Wed, 5 Sep 2012 14:38:39 +0000 (09:38 -0500)]
PPA 0.6.0.75-0ubuntu1 release.

11 years agoMerge branch 'upstream'
Darik Horn [Wed, 5 Sep 2012 14:37:29 +0000 (09:37 -0500)]
Merge branch 'upstream'

11 years agoAdd DKIOCTRIM for TRIM support.
Etienne Dechamps [Sat, 1 Sep 2012 13:02:25 +0000 (15:02 +0200)]
Add DKIOCTRIM for TRIM support.

See dechamps/zfs@cc6cd40ad71e1e611591929ad08184516357eaf5 for details.

This harmless addition was merged to simplify testing the ZFS TRIM
support patches.

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

11 years agoPPA 0.6.0.74-0ubuntu1 release.
Darik Horn [Sun, 2 Sep 2012 19:34:35 +0000 (14:34 -0500)]
PPA 0.6.0.74-0ubuntu1 release.

11 years agoPPA 0.6.0.73-0ubuntu1 release.
Darik Horn [Fri, 31 Aug 2012 19:38:18 +0000 (14:38 -0500)]
PPA 0.6.0.73-0ubuntu1 release.

11 years agoMerge branch 'upstream'
Darik Horn [Fri, 31 Aug 2012 19:35:57 +0000 (14:35 -0500)]
Merge branch 'upstream'

11 years agoSuppress task_hash_table_init() large allocation warning
Brian Behlendorf [Fri, 31 Aug 2012 03:56:22 +0000 (20:56 -0700)]
Suppress task_hash_table_init() large allocation warning

When various kernel debuging options are enabled this allocation
may be larger than usual as shown by the following warning.  It
is in no way harmful so we suppress the warning.

  SPL: large kmem_alloc(40960, 0x80d0) at
  tsd_hash_table_init:358 (76495/76495)

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

11 years agoEnhance SPLAT kmem:slab_overcommit test
Brian Behlendorf [Sun, 26 Aug 2012 20:34:06 +0000 (13:34 -0700)]
Enhance SPLAT kmem:slab_overcommit test

After the emergency slab objects were merged I started observing
timeout failures in the kmem:slab_overcommit test.  These were
due to the ineffecient way the slab_overcommit reclaim function
was implemented.  And due to the additional cost of potentially
allocating ten of thousands of emergency objects and tracking
them on a single list.

This patch addresses the first concern by enhansing the test
case to trace all of the allocations objects as a linked list.
This allows for a cleaner version of the reclaim function to
simply release SPLAT_KMEM_OBJ_RECLAIM objects.

Since this touches some common code all the tests which share
these data structions were also updated.  After making these
changes slab_overcommit is reliably passing.  However, there
is certainly additional cleanup which could be done here.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoSwitch KM_SLEEP to KM_PUSHPAGE
Brian Behlendorf [Thu, 23 Aug 2012 22:36:28 +0000 (15:36 -0700)]
Switch KM_SLEEP to KM_PUSHPAGE

Under certain circumstances the following functions may be called
in a context where KM_SLEEP is unsafe and can result in a deadlocked
system.  To avoid this problem the unconditional KM_SLEEPs are
converted to KM_PUSHPAGEs.  This will prevent them from attempting
to initiate any I/O during direct reclaim.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoMutex ASSERT on self deadlock
Brian Behlendorf [Sun, 19 Aug 2012 19:10:19 +0000 (12:10 -0700)]
Mutex ASSERT on self deadlock

Generate an assertion if we're going to deadlock the system by
attempting to acquire a mutex the process is already holding.

There are currently no known instances of this under normal
operation, but it _might_ be possible when using a ZVOL as a
swap device.  I want to ensure we catch this immediately if it
were to occur.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoAdd PF_NOFS debugging flag
Brian Behlendorf [Sat, 18 Aug 2012 19:42:28 +0000 (12:42 -0700)]
Add PF_NOFS debugging flag

PF_NOFS is a per-process debug flag which is set in current->flags to
detect when a process is performing an unsafe allocation.  All tasks
with PF_NOFS set must strictly use KM_PUSHPAGE for allocations because
if they enter direct reclaim and initiate I/O they may deadlock.

When debugging is disabled, any incorrect usage will be detected and
a call stack with a warning will be printed to the console.  The flags
will then be automatically corrected to allow for safe execution.  If
debugging is enabled this will be treated as a fatal condition.

To avoid any risk of conflicting with the existing PF_ flags.  The
PF_NOFS bit shadows the rarely used PF_MUTEX_TESTER bit.  Only when
CONFIG_RT_MUTEX_TESTER is not set, and we know this bit is unused,
will the PF_NOFS bit be valid.  Happily, most existing distributions
ship a kernel with CONFIG_RT_MUTEX_TESTER disabled.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRevert "Disable vmalloc() direct reclaim"
Brian Behlendorf [Sat, 18 Aug 2012 18:06:21 +0000 (11:06 -0700)]
Revert "Disable vmalloc() direct reclaim"

This reverts commit 2092cf68d89a51eb0d6193aeadabb579dfc4b4a0.  The
use of the PF_MEMALLOC flag was always a hack to work around memory
reclaim deadlocks.  Those issues are believed to be resolved so this
workaround can be safely reverted.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRevert "Fix NULL deref in balance_pgdat()"
Brian Behlendorf [Sat, 18 Aug 2012 18:05:53 +0000 (11:05 -0700)]
Revert "Fix NULL deref in balance_pgdat()"

This reverts commit b8b6e4c453929596b630fa1cca1ee26a532a2ab4.  The
use of the PF_MEMALLOC flag was always a hack to work around memory
reclaim deadlocks.  Those issues are believed to be resolved so this
workaround can be safely reverted.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRevert "Detect kernels that honor gfp flags passed to vmalloc()"
Brian Behlendorf [Sat, 18 Aug 2012 18:01:22 +0000 (11:01 -0700)]
Revert "Detect kernels that honor gfp flags passed to vmalloc()"

This reverts commit 36811b4430aaea8c8b91bbe7d812a26799865499.
Which is no longer required because there is now SPL code in
place to safely handle the deadlocks the kernel patch was designed
to address.  Therefore we can unconditionally use vmalloc() and
drop all the PF_MEMALLOC code.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRevert "Add TASKQ_NORECLAIM flag"
Brian Behlendorf [Sat, 18 Aug 2012 17:56:17 +0000 (10:56 -0700)]
Revert "Add TASKQ_NORECLAIM flag"

This reverts commit 372c2572336468cbf60272aa7e735b7ca0c3807c.  The
use of the PF_MEMALLOC flag was always a hack to work around memory
reclaim deadlocks.  Those issues are believed to be resolved so this
workaround can be safely reverted.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoEmergency slab objects
Brian Behlendorf [Tue, 7 Aug 2012 23:59:50 +0000 (16:59 -0700)]
Emergency slab objects

This patch is designed to resolve a deadlock which can occur with
__vmalloc() based slabs.  The issue is that the Linux kernel does
not honor the flags passed to __vmalloc().  This makes it unsafe
to use in a writeback context.  Unfortunately, this is a use case
ZFS depends on for correct operation.

Fixing this issue in the upstream kernel was pursued and patches
are available which resolve the issue.

  https://bugs.gentoo.org/show_bug.cgi?id=416685

However, these changes were rejected because upstream felt that
using __vmalloc() in the context of writeback should never be done.
Their solution was for us to rewrite parts of ZFS to accomidate
the Linux VM.

While that is probably the right long term solution, and it is
something we want to pursue, it is not a trivial task and will
likely destabilize the existing code.  This work has been planned
for the 0.7.0 release but in the meanwhile we want to improve the
SPL slab implementation to accomidate this expected ZFS usage.

This is accomplished by performing the __vmalloc() asynchronously
in the context of a work queue.  This doesn't prevent the posibility
of the worker thread from deadlocking.  However, the caller can now
safely block on a wait queue for the slab allocation to complete.

Normally this will occur in a reasonable amount of time and the
caller will be woken up when the new slab is available,.  The objects
will then get cached in the per-cpu magazines and everything will
proceed as usual.

However, if the __vmalloc() deadlocks for the reasons described
above, or is just very slow, then the callers on the wait queues
will timeout out.  When this rare situation occurs they will attempt
to kmalloc() a single minimally sized object using the GFP_NOIO flags.
This allocation will not deadlock because kmalloc() will honor the
passed flags and the caller will be able to make forward progress.

As long as forward progress can be maintained then even if the
worker thread is deadlocked the critical thread will make progress.
This will eventually allow the deadlocked worker thread to complete
and normal operation will resume.

These emergency allocations will likely be slow since they require
contiguous pages.  However, their use should be rare so the impact
is expected to be minimal.  If that turns out not to be the case in
practice further optimizations are possible.

One additional concern is if these emergency objects are long lived.
Right now they are simply tracked on a list which must be walked when
an object is freed.  Is they accumulate on a system and the list
grows freeing objects will become more expensive.  This could be
handled relatively easily by using a hash instead of a list, but that
optimization (if needed) is left for a follow up patch.

Additionally, these emeregency objects could be repacked in to existing
slabs as objects are freed if the kmem_cache_set_move() functionality
was implemented.  See issue https://github.com/zfsonlinux/spl/issues/26
for full details.  This work would also help reduce ZFS's memory
fragmentation problems.

The /proc/spl/kmem/slab file has had two new columns added at the
end.  The 'emerg' column reports the current number of these emergency
objects in use for the cache, and the following 'max' column shows
the historical worst case.  These value should give us a good idea
of how often these objects are needed.  Based on these values under
real use cases we can tune the default behavior.

Lastly, as a side benefit using a single work queue for the slab
allocations should reduce cpu contention on the global virtual address
space lock.   This should manifest itself as reduced cpu usage for
the system.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRemove SPL_LINUX_CONFIG autoconf macro
Prakash Surya [Wed, 22 Aug 2012 20:16:02 +0000 (13:16 -0700)]
Remove SPL_LINUX_CONFIG autoconf macro

Since removing the check for CONFIG_PREEMPT, there are no consumers of
the SPL_LINUX_CONFIG macro. As such, there is no reason to keep it
around.

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

11 years agoRevert "Make CONFIG_PREEMPT Fatal"
Prakash Surya [Wed, 22 Aug 2012 20:07:05 +0000 (13:07 -0700)]
Revert "Make CONFIG_PREEMPT Fatal"

This reverts commit 7731d46b69bd893d515c55e87ffa8a9bd2ddfb38.

Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRemove autotools products
Brian Behlendorf [Mon, 27 Aug 2012 00:38:40 +0000 (17:38 -0700)]
Remove autotools products

Remove all of the generated autotools products from the repository
and update the .gitignore files accordingly.

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

11 years agoPPA 0.6.0.72-0ubuntu1 release.
Darik Horn [Sun, 26 Aug 2012 21:57:20 +0000 (16:57 -0500)]
PPA 0.6.0.72-0ubuntu1 release.

11 years agoMerge branch 'upstream'
Darik Horn [Sun, 26 Aug 2012 21:56:00 +0000 (16:56 -0500)]
Merge branch 'upstream'

11 years agoAdd kpreempt_[dis|en]able macros in <sys/disp.h>
Prakash Surya [Fri, 24 Aug 2012 17:42:12 +0000 (10:42 -0700)]
Add kpreempt_[dis|en]able macros in <sys/disp.h>

To support preempt enabled kernels in ZFS on Linux, there are a couple
places where the ZFS code needs to disable interrupts. This change adds
the Solaris preempt functions and maps them to the equivalent ZFS
functions, allowing the ZFS to make use of them.

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

11 years agoAvoid calling smp_processor_id in spl_magazine_age
Prakash Surya [Thu, 23 Aug 2012 21:00:58 +0000 (14:00 -0700)]
Avoid calling smp_processor_id in spl_magazine_age

The spl_magazine_age function had the implied assumption that it will
remain on its current cpu through its execution. In order to support
preempt enabled kernels, this assumption had to be removed.

The spl_kmem_magazine structure now holds the cpu id of the cpu it is
local to. This allows spl_magazine_age to use this field when scheduling
work to be done by the magazine's local cpu.

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

11 years agoRemove Makefile from non-toplevel .gitignore files
Richard Yao [Thu, 16 Aug 2012 18:55:42 +0000 (14:55 -0400)]
Remove Makefile from non-toplevel .gitignore files

When building SPL support into the kernel, ./copy-builtin will copy
non-toplevel .gitignore files. These files list /Makefile, which causes
git-archive to omit ./module/{spl,splat}/Makefile. The absence of these
files result in build failures when SPL is selected. ZFS is unaffected
because it puts Makefile in the toplevel .gitignore, which is not
copied. We fix SPL by emulating that behavior.

Reported-by: Fabio Erculiani <lxnay@gentoo.org>
Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #152

11 years agoWrap trace_set_debug_header in trace_[get|put]_tcd
Prakash Surya [Wed, 22 Aug 2012 19:30:59 +0000 (12:30 -0700)]
Wrap trace_set_debug_header in trace_[get|put]_tcd

To properly support CONFIG_PREEMPT enabled kernels, we must refrain from
using a CPU index when preemption is enabled. As a result, this change
moves the trace_set_debug_header call (which calls smp_processor_id)
within trace_get_tcd and trace_put_tcd (which disable and enable
preemption respectively).

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

11 years agoAdd copy-builtin to EXTRA_DIST
Brian Behlendorf [Thu, 23 Aug 2012 16:46:38 +0000 (09:46 -0700)]
Add copy-builtin to EXTRA_DIST

The copy-builtin script was accidentally not being included in
the tarballs.

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

11 years agoPPA 0.6.0.71-0ubuntu1 release.
Darik Horn [Wed, 15 Aug 2012 02:34:21 +0000 (21:34 -0500)]
PPA 0.6.0.71-0ubuntu1 release.

11 years agoRefresh debian/patches after upstream merge.
Darik Horn [Wed, 15 Aug 2012 02:31:46 +0000 (21:31 -0500)]
Refresh debian/patches after upstream merge.

11 years agoMerge branch 'upstream'
Darik Horn [Tue, 14 Aug 2012 23:55:05 +0000 (18:55 -0500)]
Merge branch 'upstream'

11 years agoSPL 0.6.0-rc10
Brian Behlendorf [Mon, 13 Aug 2012 17:19:22 +0000 (10:19 -0700)]
SPL 0.6.0-rc10

11 years agoCleanly remove spl-modules-devel headers
Brian Behlendorf [Mon, 13 Aug 2012 23:23:45 +0000 (16:23 -0700)]
Cleanly remove spl-modules-devel headers

Add the /usr/src/spl-<version>-<release>/<kernel> directory to
the spl-modules-devel package.  This ensures that this directory
will be removed when the package is removed.

We do not include the higher level /usr/src/spl-<version>-<release>
directory since there may be builds for multiple kernels.  Instead,
a %postun rmdir is added which attempts to remove this directory.
It will only succeed when the last spl-modules-devel-* package
for this specific release is removed.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoPPA 0.6.0.70-0ubuntu1 release.
Darik Horn [Sat, 11 Aug 2012 00:42:17 +0000 (19:42 -0500)]
PPA 0.6.0.70-0ubuntu1 release.

11 years agoMerge branch 'upstream'
Darik Horn [Sat, 11 Aug 2012 00:33:41 +0000 (19:33 -0500)]
Merge branch 'upstream'

11 years agoSupport building a spl-modules-dkms sub package
Prakash Surya [Tue, 7 Aug 2012 20:57:03 +0000 (13:57 -0700)]
Support building a spl-modules-dkms sub package

This commit adds support for building a spl-modules-dkms sub package
built around Dynamic Kernel Module Support. This is to allow building
packages using the DKMS infrastructure which is intended to ease the
burden of kernel version changes, upgrades, etc.

By default spl-modules-dkms-* sub package will be built as part of
the 'make rpm' target.  Alternately, you can build only the DKMS
module package using the 'make rpm-dkms' target.

Examples:

    # To build packaged binaries as well as a dkms packages
    $ ./configure && make rpm

    # To build only the packaged binary utilities and dkms packages
    $ ./configure && make rpm-utils rpm-dkms

Note: Only the RHEL 5/6, CHAOS 5, and Fedora distributions are
      supported for building the dkms sub package.

Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue zfsonlinux/zfs#535

11 years agoHandle any invalidate_inodes_check prototype.
Etienne Dechamps [Thu, 2 Aug 2012 13:33:31 +0000 (15:33 +0200)]
Handle any invalidate_inodes_check prototype.

In the comments of commit 723aa3b0c2eed070f7eeadd2ce2d87f46da6d0f8,
mmatuska reported that the test for invalidate_inodes_check() is broken
if invalidate_inodes() takes two arguments.

This patch fixes the issue by resorting to another approach for
detecting invalidate_inodes_check(): is simply checks if
invalidate_inodes is defined as a macro. If it is, then it concludes
that invalidate_inodes_check() is available. This will continue to work
even if the prototype of invalidate_inodes_check() changes over time.

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

11 years agoPPA 0.6.0.69-0ubuntu3 release.
Darik Horn [Mon, 6 Aug 2012 14:35:14 +0000 (09:35 -0500)]
PPA 0.6.0.69-0ubuntu3 release.

11 years agoRun autogen for packaged builds.
Darik Horn [Mon, 6 Aug 2012 14:31:30 +0000 (09:31 -0500)]
Run autogen for packaged builds.

Add autoconf, automake, and autogen to the Build-Depends field in the
debian/control file, and run `./autogen.sh` before `./configure` in the
debian/rules file.

11 years agoRemove lintian-ltmain.patch
Darik Horn [Mon, 6 Aug 2012 14:17:02 +0000 (09:17 -0500)]
Remove lintian-ltmain.patch

This patch adds a whackbang to config/ltmain.sh, which is an autotools product
carried by upstream, to satisfy the lintian executable-not-elf-or-script check.

Remove the patch in antipication of running autogen for packaged builds, which
will regenerate the ltmain.sh file.

11 years agoConvert lintian-COPYING.patch to a build rule.
Darik Horn [Mon, 6 Aug 2012 14:03:35 +0000 (09:03 -0500)]
Convert lintian-COPYING.patch to a build rule.

The lintian-COPYING.patch changes the top Makefile.in to disable the GNU
standard rule for COPYING, which is a kludge. In anticipation of the upstream
removal of such autotools products, use a debian/rules line instead.

This supercedes commit 21ad7742863ec67d6697fe36863db8dd95c7e5e3.

11 years agoFix incorrect type in spl_kmem_cache_set_move() parameter
Richard Yao [Wed, 1 Aug 2012 06:00:40 +0000 (02:00 -0400)]
Fix incorrect type in spl_kmem_cache_set_move() parameter

A preprocessor definition renders this harmless. However, it is a good
idea to change this to be consistent.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
11 years agoUpdate the README file for deb packages.
Darik Horn [Fri, 27 Jul 2012 20:05:39 +0000 (15:05 -0500)]
Update the README file for deb packages.

The upstream instructions are inappropriate for building PPA-style packages
on Debian and Ubuntu. Packaging policy is violated here so that the README
appears correctly at Github.

11 years agoPPA 0.6.0.68-0ubuntu1 release.
Darik Horn [Fri, 27 Jul 2012 19:24:35 +0000 (14:24 -0500)]
PPA 0.6.0.68-0ubuntu1 release.

11 years agoMerge branch 'upstream'
Darik Horn [Fri, 27 Jul 2012 19:23:21 +0000 (14:23 -0500)]
Merge branch 'upstream'

11 years agoMerge branch 'builtin-clean'
Brian Behlendorf [Thu, 26 Jul 2012 22:30:47 +0000 (15:30 -0700)]
Merge branch 'builtin-clean'

Support in-tree builtin module building.

These commits add support for compiling the SPL module as a built-in
kernel module by copying the module code into the kernel source tree.
Here's the procedure:

  - Create your kernel configuration (`.config` file) as usual. This
    has to be done first so that SPL's configure script is able to
    detect kernel features correctly.
  - Run `make prepare scripts` inside the kernel source tree.
  - Run `./configure --enable-linux-builtin --with-linux=/usr/src/linux-...`
    inside the SPL directory.
  - Run `./copy-builtin /usr/src/linux-...` inside the SPL directory.
  - In the kernel source tree, enable the `CONFIG_SPL` option
    (e.g. using `make menuconfig`).
  - Build the kernel as usual.

SPL module parameters can be set at boot time using the following syntax
on the kernel command line: `spl.parameter_name=parameter_value`.

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

11 years agoDetermine the hostid on demand.
Etienne Dechamps [Thu, 5 Jul 2012 07:22:03 +0000 (09:22 +0200)]
Determine the hostid on demand.

Currently, the SPL tries to determine the hostid at module load. The
hostid is usually determined by running the userland program "hostid"
during module initialization.

Unfortunately, when the module initializes, it may be way too soon to be
able to run any userland programs. This is especially true when the
module is compiled directly inside the kernel (built-in); in that case,
the SPL would try to run hostid when the kernel is still initializing,
which of course is doomed to fail.

This patch fixes the issue by deferring hostid generation until
something actually needs the hostid (that is, when zone_get_hostid() is
called), thus switching to a "on-initialization" model to a "on-demand"
(lazy loading) model. ZFS only needs the hostid when some pool
operations are requested, and this always happens way after the kernel
has finished initialization, thus solving the problem.

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

11 years agoAdd script for builtin module building.
Etienne Dechamps [Mon, 9 Jul 2012 09:10:31 +0000 (11:10 +0200)]
Add script for builtin module building.

This commit introduces a "copy-builtin" script designed to prepare a
kernel source tree for building SPL as a builtin module. The script
makes a full copy of all needed files, thus making the kernel source
tree fully independent of the spl source package.

To achieve that, some compilation flags (-include, -I) have been moved
to module/Makefile. This Makefile is only used when compiling external
modules; when compiling builtin modules, a Kbuild file generated by the
configure-builtin script is used instead. This makes sure Makefiles
inside the kernel source tree does not contain references to the spl
source package.

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

11 years agoWhen checking for symbol exports, try compiling.
Etienne Dechamps [Mon, 16 Jul 2012 15:04:05 +0000 (17:04 +0200)]
When checking for symbol exports, try compiling.

This patch adds a new autoconf function: SPL_LINUX_TRY_COMPILE_SYMBOL.
This new function does the following:

 - Call LINUX_TRY_COMPILE with the specified parameters.
 - If unsuccessful, return false.
 - If successful and we're configuring with --enable-linux-builtin,
   return true.
 - Else, call CHECK_SYMBOL_EXPORT with the specified parameters and
   return the result.

All calls to CHECK_SYMBOL_EXPORT are converted to
LINUX_TRY_COMPILE_SYMBOL so that the tests work even when configuring
for builtin on a kernel which doesn't have loadable module support, or
hasn't been built yet.

The only exception are:

 - AC_GET_VMALLOC_INFO, because we don't even have a public header to
include in the test case, but that's okay considering this symbol can
be ignored just fine.

- SPL_AC_DEVICE_CREATE, which is legacy API for 2.6.18 kernels.  Since
kernels this old are no longer supported it should arguably just be
removed entirely from the build system.

Note that we're also checking for the correct prototype with an actual
call, which was not the case with CHECK_SYMBOL_EXPORT. However, for
"complicated" test cases like with multiple symbol versions (e.g.
vfs_fsync), we stick with the original behavior and only check for the
function's existence.

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