]> git.proxmox.com Git - mirror_spl.git/log
mirror_spl.git
12 years agoLinux 3.1 compat, kern_path_parent()
Brian Behlendorf [Wed, 9 Nov 2011 20:29:51 +0000 (12:29 -0800)]
Linux 3.1 compat, kern_path_parent()

Prior to Linux 3.1 the kern_path_parent symbol was exported for
use by kernel modules.  As of Linux 3.1 it is now longer easily
available.  To handle this case the spl will now dynamically
look up address of the missing symbol at module load time.

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

12 years agoFix NULL deref in balance_pgdat()
Brian Behlendorf [Tue, 1 Nov 2011 20:35:12 +0000 (13:35 -0700)]
Fix NULL deref in balance_pgdat()

Be careful not to unconditionally clear the PF_MEMALLOC bit in
the task structure.  It may have already been set when entering
kv_alloc() in which case it must remain set on exit.  In
particular the kswapd thread will have PF_MEMALLOC set in
order to prevent it from entering direct reclaim.  By clearing
it we allow the following NULL deref to potentially occur.

  BUG: unable to handle kernel NULL pointer dereference at (null)
  IP: [<ffffffff8109c7ab>] balance_pgdat+0x25b/0x4ff

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

12 years agoInclude distribution in release
Brian Behlendorf [Wed, 19 Oct 2011 18:23:38 +0000 (11:23 -0700)]
Include distribution in release

Common practice is to include the distribution in the package release.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
12 years agoCleaned up MUTEX() #define
Gunnar Beutner [Wed, 19 Oct 2011 16:04:40 +0000 (18:04 +0200)]
Cleaned up MUTEX() #define

The old define assumed a specific layout of the kmutex_t struct. This
patch makes the macro independent from the actual struct layout.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
12 years agoRemove the spinlocks for mutex_enter()/mutex_exit()
Gunnar Beutner [Tue, 18 Oct 2011 00:54:35 +0000 (02:54 +0200)]
Remove the spinlocks for mutex_enter()/mutex_exit()

The m_owner variable is protected by the mutex itself. Reading the variable
is guaranteed to be atomic (due to it being a word-sized reference) and
ACCESS_ONCE() takes care of read cache effects.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
12 years agoFix race condition in mutex_exit()
Gunnar Beutner [Tue, 18 Oct 2011 00:32:50 +0000 (02:32 +0200)]
Fix race condition in mutex_exit()

On kernels with CONFIG_DEBUG_MUTEXES mutex_exit() clears the mutex
owner after releasing the mutex. This would cause mutex_owner()
to return an incorrect owner if another thread managed to lock the
mutex before mutex_exit() had a chance to clear the owner.

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

12 years agovn_rdwr() didn't properly advance the file position
Gunnar Beutner [Wed, 12 Oct 2011 10:49:18 +0000 (12:49 +0200)]
vn_rdwr() didn't properly advance the file position

This would cause problems when using 'zfs send' with a file as the
target (rather than a pipe or a socket as is usually the case) as
for each write the destination offset in the file would be 0.

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

12 years agoFix package URLs to use the github repository
Brian Behlendorf [Mon, 17 Oct 2011 23:40:38 +0000 (16:40 -0700)]
Fix package URLs to use the github repository

The URL field in the spl-modules and spl package spec files were
updated to point to the ZFS on Linux repository hosted by github.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
12 years agoFix various typos in comments
Brian Behlendorf [Tue, 11 Oct 2011 17:11:26 +0000 (10:11 -0700)]
Fix various typos in comments

Just clean up some of the typos and spelling mistakes in the
comments of spl-kmem.c.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
12 years agoFixed typo in spl_slab_alloc()
Gunnar Beutner [Tue, 11 Oct 2011 17:03:29 +0000 (10:03 -0700)]
Fixed typo in spl_slab_alloc()

The typo did not have any effect (apart from a negligible performance
impact) because skc->skc_flags * KMC_OFFSLAB is always non-null when
at least one bit in skc->skc_flags is set.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
12 years agoProperly destroy work items in spl_kmem_cache_destroy()
Gunnar Beutner [Tue, 11 Oct 2011 16:59:02 +0000 (09:59 -0700)]
Properly destroy work items in spl_kmem_cache_destroy()

In a non-debug build the ASSERT() would be optimized away
which could cause pending work items to not be cancelled.

We must also use cancel_delayed_work_sync() rather than just
cancel_delayed_work() to actually wait until work items have
completed.  Otherwise they might accidentally access free'd
memory.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes ZFS bugs #279, #62, #363, #418

12 years agoFixed invalid resource re-use in file_find()
Gunnar Beutner [Tue, 11 Oct 2011 16:50:52 +0000 (09:50 -0700)]
Fixed invalid resource re-use in file_find()

File descriptors are a per-process resource. The same descriptor
in different processes can refer to different files. find_file()
incorrectly assumed that file descriptors are globally unique.

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

12 years agoPrep spl-0.6.0-rc6 tag
Brian Behlendorf [Thu, 6 Oct 2011 21:07:00 +0000 (14:07 -0700)]
Prep spl-0.6.0-rc6 tag

Create the sixth 0.6.0 release candidate tag (rc6).

12 years agoRemove /etc/hostid missing warning
Brian Behlendorf [Thu, 6 Oct 2011 21:55:17 +0000 (14:55 -0700)]
Remove /etc/hostid missing warning

No longer print the following warning to the console when the
/etc/hostid file is missing.  This is the expected default behavior.
Keeping the hostid in sync with the initramfs is now accomplished
by creating the /etc/hostid in the initramfs not on the system.

  SPL: The /etc/hostid file is not found.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
12 years agoRevert "Stabilize the hostid for RPM installations."
Brian Behlendorf [Fri, 30 Sep 2011 16:36:35 +0000 (09:36 -0700)]
Revert "Stabilize the hostid for RPM installations."

Creating an /etc/hostid file as part of the rpm post install
causes problems for diskless systems which are sharing an image.
While it's still critical to ensure the hostid doesn't change
for zfs root filesystems.  This will now be done by setting
the /etc/hostid in the initramfs created by dracut.

This reverts commit 79593b0dec57ee94c5bb56cdc2770ebde81ecea9.

12 years agoFix HAVE_FS_STRUCT_SPINLOCK check for gcc-4.1.2
Brian Behlendorf [Mon, 19 Sep 2011 20:35:03 +0000 (13:35 -0700)]
Fix HAVE_FS_STRUCT_SPINLOCK check for gcc-4.1.2

Older versions of gcc (gcc-4.1.2) will treat an 'incompatible
pointer type' as a warning instead of an error.  This results
in HAVE_FS_STRUCT_SPINLOCK being defined incorrectly.  This
failure mode was observed when using a RHEL6 2.6.32 based kernel
under RHEL5.5 which contains the old version of gcc.  To resolve
the issue the warning is explicitly promoted to an error.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
12 years agoFix the configure CONFIG_* option detection
Brian Behlendorf [Fri, 22 Jul 2011 21:23:12 +0000 (14:23 -0700)]
Fix the configure CONFIG_* option detection

The latest kernels no longer define AUTOCONF_INCLUDED which was
being used to detect the new style autoconf.h kernel configure
options.  This results in the CONFIG_* checks always failing
incorrectly for newer kernels.

The fix for this is a simplification of the testing method.
Rather than attempting to explicitly include to renamed config
header.  It is simpler to unconditionally include <linux/module.h>
which must pick up the correctly named header.

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

12 years agoFix 'make install' overly broad 'rm'
Brian Behlendorf [Wed, 20 Jul 2011 04:06:50 +0000 (21:06 -0700)]
Fix 'make install' overly broad 'rm'

When running 'make install' without DESTDIR set the module install
rules would mistakenly destroy the 'modules.*' files for ALL of
your installed kernels.  This could lead to a non-functional system
for the alternate kernels because 'depmod -a' will only be run for
the kernel which was compiled against.  This issue would not impact
anyone using the 'make <deb|rpm|pkg>' build targets to build and
install packages.

The fix for this issue is to only remove extraneous build products
when DESTDIR is set.  This almost exclusively indicates we are
building packages and installed the build products in to a temporary
staging location.  Additionally, limit the removal the unneeded
build products to the target kernel version.

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

12 years agoPrep spl-0.6.0-rc5 tag
Brian Behlendorf [Fri, 1 Jul 2011 22:23:17 +0000 (15:23 -0700)]
Prep spl-0.6.0-rc5 tag

Create the fifth 0.6.0 release candidate tag (rc5).

12 years agoLinux 2.6.39 compat, mutex owner
Brian Behlendorf [Fri, 24 Jun 2011 18:57:14 +0000 (11:57 -0700)]
Linux 2.6.39 compat, mutex owner

Prior to Linux 2.6.39 when CONFIG_DEBUG_MUTEXES was defined
the kernel stored a thread_info pointer as the mutex owner.
From this you could get the pointer of the current task_struct
to compare with get_current().

As of Linux 2.6.39 this behavior has changed and now the mutex
stores a pointer to the task_struct.  This commit detects the
type of pointer stored in the mutex and adjusts the mutex_owner()
and mutex_owned() functions to perform the correct comparision.

12 years agoStabilize the hostid for RPM installations.
Darik Horn [Fri, 24 Jun 2011 03:10:27 +0000 (22:10 -0500)]
Stabilize the hostid for RPM installations.

ZFS requires a stable hostid to recognize foreign pool imports,
but the hostid of a Linux system can change if the /etc/hostid
file is missing, particularly during DHCP lease updates.

Ensure that the system hostid is stable by creating the
/etc/hostid file from the output of the /usr/bin/hostid utility.
The /sbin/genhostid utility that is provided by the initscripts
package is not used because it creates a random hostid, which
breaks upgrades on systems that already have the SPL module
installed.

The external `printf` is used because the dash builtin lacks
the byte format.  Conveniences like a ${HOSTID:$ii:2} substring
range or a `sed` one-liner are similarly avoided.

12 years agoRead the /etc/hostid file directly.
Darik Horn [Mon, 20 Jun 2011 19:53:56 +0000 (14:53 -0500)]
Read the /etc/hostid file directly.

Deprecate the /usr/bin/hostid call by reading the /etc/hostid file
directly. Add the spl_hostid_path parameter to override the default
/etc/hostid path.

Rename the set_hostid() function to hostid_exec() to better reflect
actual behavior and complement the new hostid_read() function.

Use HW_INVALID_HOSTID as the spl_hostid sentinel value because
zero seems to be a valid gethostid() result on Linux.

12 years agoAdd linux compatibility tests
Brian Behlendorf [Tue, 21 Jun 2011 17:57:48 +0000 (10:57 -0700)]
Add linux compatibility tests

While the splat tests were originally designed to stress test
the Solaris primatives.  I am extending them to include some kernel
compatibility tests.  Certain linux APIs have changed frequently.
These tests ensure that added compatibility is working properly
and no unnoticed regression have slipped in.

Test 1 and 2 add basic regression tests for shrink_icache_memory
and shrink_dcache_memory.  These are simply functional tests to
ensure we can call these functions safely.  Checking for correct
behavior is more difficult since other running processes will
influence the behavior.  However, these functions are provided
by the kernel so if we can successfully call them we assume they
are working correctly.

Test 3 checks that shrinker functions are being registered and
called correctly.  As of Linux 3.0 the shrinker API has changed
four different times so I felt the need to add a trivial test
case to ensure each variant works as expected.

12 years agoLinux 3.0: Shrinker compatibility
Brian Behlendorf [Thu, 16 Jun 2011 22:39:08 +0000 (15:39 -0700)]
Linux 3.0: Shrinker compatibility

Update the the wrapper macros for the memory shrinker to handle
this 4th API change.  The callback function now takes a
shrink_control structure.  This is certainly a step in the
right direction but it's annoying to have to accomidate yet
another version of the API.

12 years agoAvoid 'rpm -q' bug for 'make pkg'
Brian Behlendorf [Thu, 16 Jun 2011 18:49:38 +0000 (11:49 -0700)]
Avoid 'rpm -q' bug for 'make pkg'

RPM version 4.9.0 has been observed to generate extra debug
messages in certain cases.  These debug messages prevent us
from cleanly acquiring the architecture.  This is clearly
an upstream RPM bug which will get fixed.  But until then
a safe solution is to pipe the result through 'tail -1'
to just grab the architecture bit we care about.

Example 'rpm -qp spl-0.6.0-rc4.src.rpm --qf %{arch}' output:

Freeing read locks for locker 0x166: 28031/47480843735008
Freeing read locks for locker 0x168: 28031/47480843735008
x86_64

13 years agoAdd TASKQ_NORECLAIM flag
Brian Behlendorf [Fri, 6 May 2011 22:21:58 +0000 (15:21 -0700)]
Add TASKQ_NORECLAIM flag

It has become necessary to be able to optionally disable
direct memory reclaim for certain taskqs.  To support
this the TASKQ_NORECLAIM flags has been added which sets
the PF_MEMALLOC bit for all threads in the taskq.

13 years agoPrep spl-0.6.0-rc4 tag
Brian Behlendorf [Tue, 3 May 2011 17:31:12 +0000 (10:31 -0700)]
Prep spl-0.6.0-rc4 tag

Create the fourth 0.6.0 release candidate tag (rc4).

13 years agoCorrect MAXUID
Brian Behlendorf [Fri, 29 Apr 2011 20:58:45 +0000 (13:58 -0700)]
Correct MAXUID

The uid_t on most systems is in fact and unsigned 32-bit value.
This is almost always correct, however you could compile your
kernel to use an unsigned 16-bit value for uid_t.  In practice
I've never encountered a distribution which does this so I'm
willing to overlook this corner case for now.

13 years agoRenamed 'struct fid' for NFS
Gunnar Beutner [Sun, 24 Apr 2011 08:19:28 +0000 (10:19 +0200)]
Renamed 'struct fid' for NFS

Renamed 'struct fid' because its name conflicts with another
struct in the Linux kernel headers.  The fid_t typedef remains
unchanged intentionally.

13 years agoMerged pull request #40 from dajhorn/spl-proc-typos.
Brian Behlendorf [Mon, 25 Apr 2011 21:51:48 +0000 (14:51 -0700)]
Merged pull request #40 from dajhorn/spl-proc-typos.

Correct typos in the spl proc handler.

13 years agoCorrect typos in the spl proc handler.
Darik Horn [Mon, 25 Apr 2011 01:48:56 +0000 (20:48 -0500)]
Correct typos in the spl proc handler.

Correct a format typo that causes /proc/sys/kernel/spl/hostid
to return a decimal number instead of a hexadecimal number.

13 years agoFix 32-bit MAXOFFSET_T definition
Brian Behlendorf [Fri, 22 Apr 2011 23:17:13 +0000 (16:17 -0700)]
Fix 32-bit MAXOFFSET_T definition

The correct definition of MAXOFFSET_T under Solaris is in reality
tied to the maximum size of a 'long long' type.  With this in mind
MAXOFFSET_T is now defined as LLONG_MAX which ensures the correct
value is used on both 32-bit and 64-bit systems.

13 years agoMake the SPL kernel messages consistent with ZFS.
Darik Horn [Thu, 21 Apr 2011 15:11:45 +0000 (10:11 -0500)]
Make the SPL kernel messages consistent with ZFS.

Change the SPL kernel messages for module loading and module
unloading so that they are similar to the ZFS kernel messages.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
13 years agoRemove the gawk dependency.
Darik Horn [Thu, 14 Apr 2011 19:01:22 +0000 (14:01 -0500)]
Remove the gawk dependency.

This reverts commit 1814251453c8140f50170ad29d9105c1273d7e08.

Demote the gawk call back to awk and ensure that stderr is attached.  GNU gawk
tolerates a missing stderr handle, but many utilities do not, which could be
why a regular awk call was unexplainably failing on some systems.

Use argv[0] instead of sh_path for consistency internally and with other Linux
drivers.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
13 years agoImport spl_hostid as a module parameter.
Darik Horn [Mon, 11 Apr 2011 19:49:50 +0000 (14:49 -0500)]
Import spl_hostid as a module parameter.

Provide a call_usermodehelper() alternative by letting the hostid be passed as
a module parameter like this:

  $ modprobe spl spl_hostid=0x12345678

Internally change the spl_hostid variable to unsigned long because that is the
type that the coreutils /usr/bin/hostid returns.

Move the hostid command into GET_HOSTID_CMD for consistency with the similar
GET_KALLSYMS_ADDR_CMD invocation.

Use argv[0] instead of sh_path for consistency internally and with other Linux
drivers.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
13 years agoLinux 2.6.39 compat, zlib_deflate_workspacesize()
Brian Behlendorf [Wed, 20 Apr 2011 21:22:35 +0000 (14:22 -0700)]
Linux 2.6.39 compat, zlib_deflate_workspacesize()

The function zlib_deflate_workspacesize() now take 2 arguments.
This was done to avoid always having to allocate the maximum size
workspace (268K).  The caller can now specific the windowBits and
memLevel compression parameters to get a smaller workspace.

For our purposes we introduce a spl_zlib_deflate_workspacesize()
wrapper which accepts both arguments.  When the two argument
version of zlib_deflate_workspacesize() is available the arguments
are passed through.  When it's not we assume the worst case and
a maximally sized workspace is used.

13 years agoLinux 2.6.39 compat, kern_path_parent()
Brian Behlendorf [Wed, 20 Apr 2011 19:25:59 +0000 (12:25 -0700)]
Linux 2.6.39 compat, kern_path_parent()

The path_lookup() function has been renamed to kern_path_parent()
and the flags argument has been removed.  The only behavior now
offered is that of LOOKUP_PARENT.  The spl already always passed
this flag so dropping the flag does not impact us.

13 years agoLinux 2.6.39 compat, DEFINE_SPINLOCK()
Brian Behlendorf [Wed, 20 Apr 2011 19:01:11 +0000 (12:01 -0700)]
Linux 2.6.39 compat, DEFINE_SPINLOCK()

This is a long over due compatibility change.  Way, way, way back
in 2007 there was a push to remove all consumers of SPIN_LOCK_UNLOCKED.
Finally, in 2011 with 2.6.39 all the consumers have been updated
and SPIN_LOCK_UNLOCKED was removed.  It's about time we use the
new API as well, this change does exactly that.  DEFINE_SPINLOCK()
was available as far back as 2.6.12 so there doesn't need to be
any additional autoconf-foo for this change.

13 years agoFix unused variable
Brian Behlendorf [Tue, 19 Apr 2011 16:45:36 +0000 (09:45 -0700)]
Fix unused variable

Flagged by the default -Wunused-but-set-variable gcc option when
running under Fedora 15.  Since it's correct this variable is
entirely unused this commit removes it.

13 years agoFix gcc configure warnings
Brian Behlendorf [Tue, 19 Apr 2011 16:26:48 +0000 (09:26 -0700)]
Fix gcc configure warnings

Newer versions of gcc are getting smart enough to detect the sloppy
syntax used for the autoconf tests.  It is now generating warnings
for unused/undeclared variables.  Newer version of gcc even have
the -Wunused-but-set-variable option set by default.  This isn't a
problem except when -Werror is set and they get promoted to an error.
In this case the autoconf test will return an incorrect result which
will result in a build failure latter on.

To handle this I'm tightening up many of the autoconf tests to
explicitly mark variables as unused to suppress the gcc warning.
Remember, all of the autoconf code can never actually be run we
just want to get a clean build error to detect which APIs are
available.  Never using a variable is absolutely fine for this.

13 years agoLinux 2.6.39 compat, invalidate_inodes()
Brian Behlendorf [Mon, 18 Apr 2011 20:47:43 +0000 (13:47 -0700)]
Linux 2.6.39 compat, invalidate_inodes()

To resolve a potiential filesystem corruption issue a second
argument was added to invalidate_inodes().  This argument controls
whether dirty inodes are dropped or treated as busy when invalidating
a super block.  When only the legacy API is available the second
argument will be dropped for compatibility.

13 years agoFix rebuildable RPMs for el6/ch5
Brian Behlendorf [Fri, 8 Apr 2011 17:20:08 +0000 (10:20 -0700)]
Fix rebuildable RPMs for el6/ch5

When rebuilding the source RPM under el5 you need to append the
target_cpu.  However, under el6/ch5 things are packaged correctly
and the arch is already part of kver.  For this reason it also
needs to be stripped from kver when setting kverpkg.

13 years agoPrep spl-0,6,0-rc3 tag
Brian Behlendorf [Thu, 7 Apr 2011 03:10:57 +0000 (20:10 -0700)]
Prep spl-0,6,0-rc3 tag

Create the third 0.6.0 release candidate tag (rc3).

13 years agoAdd dnlc_reduce_cache() support
Brian Behlendorf [Thu, 31 Mar 2011 00:44:35 +0000 (17:44 -0700)]
Add dnlc_reduce_cache() support

Provide the dnlc_reduce_cache() function which attempts to prune
cached entries from the dcache and icache.  After the entries are
pruned any slabs which they may have been using are reaped.

Note the API takes a reclaim percentage but we don't have easy
access to the total number of cache entries to calculate the
reclaim count.  However, in practice this doesn't need to be
exactly correct.  We simply need to reclaim some useful fraction
(but not all) of the cache.  The caller can determine if more
needs to be done.

13 years agoDecrease target objects per slab
Brian Behlendorf [Wed, 30 Mar 2011 05:38:53 +0000 (22:38 -0700)]
Decrease target objects per slab

By decreasing the number of target objects per slab we increase
the likelyhood that a slab can be freed.  This reduces the level
of fragmentation in the slab which has been observed to be a
problem for certain workloads.  The penalty for this is that we
also decrease the speed which need objects can be allocated.

13 years agoAdd slab usage summeries to /proc
Brian Behlendorf [Sat, 26 Mar 2011 07:03:32 +0000 (00:03 -0700)]
Add slab usage summeries to /proc

One of the most common things you want to know when looking at
the slab is how much memory is being used.  This information was
available in /proc/spl/kmem/slab but only on a per-slab basis.
This commit adds the following /proc/sys/kernel/spl/kmem/slab*
entries to make total slab usage easily available at a glance.

  slab_kmem_total - Total kmem slab size
  slab_kmem_avail - Alloc'd kmem slab size
  slab_kmem_max   - Max observed kmem slab size
  slab_vmem_total - Total vmem slab size
  slab_vmem_avail - Alloc'd vmem slab size
  slab_vmem_max   - Max observed vmem slab size

NOTE: The slab_*_max values are expected to over report because
they show maximum values since boot, not current values.

13 years agoUpdate /proc/spl/kmem/slab output
Brian Behlendorf [Sat, 26 Mar 2011 04:50:40 +0000 (21:50 -0700)]
Update /proc/spl/kmem/slab output

The 'slab_fail', 'slab_create', and 'slab_destroy' columns in the slab
output have been removed because they are virtually always zero and
not very useful.

The much more useful 'size' and 'alloc' columns have been added which
show the total slab size and how much of the total size has been
allocated to objects.

Finally, the formatting has been updated to be much more human
readable while still being friendly for tool like awk to parse.

13 years agoLinux shrinker compat
Brian Behlendorf [Wed, 23 Mar 2011 22:45:55 +0000 (15:45 -0700)]
Linux shrinker compat

The Linux shrinker has gone through three API changes since 2.6.22.
Rather than force every caller to understand all three APIs this
change consolidates the compatibility code in to the mm-compat.h
header.  The caller then can then use a single spl provided
shrinker API which does the right thing for your kernel.

SPL_SHRINKER_CALLBACK_PROTO(shrinker_callback, cb, nr_to_scan, gfp_mask);
SPL_SHRINKER_DECLARE(shrinker_struct, shrinker_callback, seeks);
spl_register_shrinker(&shrinker_struct);
spl_unregister_shrinker(&&shrinker_struct);
spl_exec_shrinker(&shrinker_struct, nr_to_scan, gfp_mask);

13 years agoAdd .va_dentry helper
Brian Behlendorf [Wed, 30 Mar 2011 05:46:38 +0000 (22:46 -0700)]
Add .va_dentry helper

While this extra structure memory does not exist under Solaris
it is needed under Linux to pass the dentry.  This allows the
dentry to be easily instantiated before the inode is unlocked.

13 years agoUpdate CHAOS 5 Packaging
Brian Behlendorf [Thu, 31 Mar 2011 20:43:49 +0000 (13:43 -0700)]
Update CHAOS 5 Packaging

The CHAOS 5 kernels are now packaged identially to the RHEL6 kernels.
Therefore we can simply use the RHEL6 rules in the spec file when
building packages.

13 years agoAdd crgetfsuid()/crgetfsgid() helpers
Brian Behlendorf [Tue, 22 Mar 2011 18:18:15 +0000 (11:18 -0700)]
Add crgetfsuid()/crgetfsgid() helpers

Solaris credentials don't have an fsuid/fsguid field but Linux
credentials do.  To handle this case the Solaris API is being
modestly extended to include the crgetfsuid()/crgetfsgid()
helper functions.

Addititionally, because the crget*() helpers are implemented
identically regardless of HAVE_CRED_STRUCT they have been
moved outside the #ifdef to common code.  This simplification
means we only have one version of the helper to keep to to date.

13 years agoLoad zlib_inflate.ko
Brian Behlendorf [Mon, 21 Mar 2011 23:32:29 +0000 (16:32 -0700)]
Load zlib_inflate.ko

Certain stock kernels (Debian Lenny) are built with zlib_inflate.ko
as a kernel module.  To ensure 'make check' works in-tree load this
module before loading the spl module.  This is now required for the
zlib splat regression test.

13 years agoDisable vmalloc() direct reclaim
Brian Behlendorf [Sun, 20 Mar 2011 22:03:18 +0000 (15:03 -0700)]
Disable vmalloc() direct reclaim

As part of vmalloc() a __pte_alloc_kernel() allocation may occur.  This
internal allocation does not honor the gfp flags passed to vmalloc().
This means even when vmalloc(GFP_NOFS) is called it is possible that a
synchronous reclaim will occur.  This reclaim can trigger file IO which
can result in a deadlock.  This issue can be avoided by explicitly
setting PF_MEMALLOC on the process to subvert synchronous reclaim when
vmalloc() is called with !__GFP_FS.

An example stack of the deadlock can be found here (1), along with the
upstream kernel bug (2), and the original bug discussion on the
linux-mm mailing list (3).  This code can be properly autoconf'ed
when the upstream bug is fixed.

1) http://github.com/behlendorf/zfs/issues/labels/Vmalloc#issue/133
2) http://bugzilla.kernel.org/show_bug.cgi?id=30702
3) http://marc.info/?l=linux-mm&m=128942194520631&w=4

13 years agoRemove default GFP_NOFS allocations
Brian Behlendorf [Sat, 19 Mar 2011 20:49:14 +0000 (13:49 -0700)]
Remove default GFP_NOFS allocations

As originally described in commit 82b8c8fa64737edfb203156b245b48840139d2c1
this was done to prevent certain deadlocks from occuring in the system.
However, as suspected the price for doing this proved to be too high.
The VM is having a hard time effectively reclaiming memory thus we are
reverting this change.

However, we still need to fundamentally handle the issue.  Under
Solaris the KM_PUSHPAGE mask is used commonly in I/O paths to ensure
a memory allocations will succeed.  We leverage this fact and redefine
KM_PUSHPAGE to include GFP_NOFS.  This ensures that in these common
I/O path we don't trigger additional reclaim.  This minimizes the
change to the Solaris code.

13 years agoPrep spl-0.6.0-rc2 tag
Brian Behlendorf [Wed, 9 Mar 2011 23:16:10 +0000 (15:16 -0800)]
Prep spl-0.6.0-rc2 tag

Create the second 0.6.0 release candidate tag (rc2).

13 years agoLinux 2.6.31 compat, include linux/seq_file.h
Brian Behlendorf [Mon, 7 Mar 2011 21:52:00 +0000 (13:52 -0800)]
Linux 2.6.31 compat, include linux/seq_file.h

Explicitly include the linux/seq_file.h header in vfs.h.  This header
is required for the sequence handlers and is included indirectly in
newer kernels.

13 years agoMake Missing Modules.symvers Fatal
Brian Behlendorf [Mon, 7 Mar 2011 20:59:30 +0000 (12:59 -0800)]
Make Missing Modules.symvers Fatal

Detect early on in configure if the Modules.symvers file is missing.
Without this file there will be build failures later and it's best
to catch this early and provide a useful error.  In this case the
most likely problem is the kernel-devel packages are not installed.
It may also be possible that they are using an unbuilt custom kernel
in which case they must build the kernel first.

13 years agoMake CONFIG_PREEMPT Fatal
Brian Behlendorf [Mon, 7 Mar 2011 18:58:07 +0000 (10:58 -0800)]
Make CONFIG_PREEMPT Fatal

Until support is added for preemptible kernels detect this at
configure time and make it fatal.  Otherwise, it is possible to
have a successful build and kernel modules with flakey behavior.

13 years agoRemove xvattr support
Brian Behlendorf [Tue, 1 Mar 2011 22:02:06 +0000 (14:02 -0800)]
Remove xvattr support

The xvattr support in the spl has always simply consisted of
defining a couple structures and a few #defines.  This was enough
to enable compilation of code which just passed xvattr types
around but not enough to effectively manipulate them.

This change removes even this minimal support leaving it up
to packages which leverage the spl to prove the full xvattr
support.  By removing it from the spl we ensure not conflict
with the higher level packages.

This just leaves minimal vnode support for basical manipulation
of files.  This code is does have the proper support functions
in the spl and a set of regression tests.

Additionally, this change removed the unused 'caller_context_t *'
type and replaces it with a 'void *'.

13 years agoAdd TIMESPEC_OVERFLOW helper
Brian Behlendorf [Tue, 1 Mar 2011 23:21:38 +0000 (15:21 -0800)]
Add TIMESPEC_OVERFLOW helper

Add the TIMESPEC_OVERFLOW helper macro to allow easy checking
of timespec overflow.

13 years agoAdd zlib regression test
Brian Behlendorf [Fri, 25 Feb 2011 23:48:18 +0000 (15:48 -0800)]
Add zlib regression test

A zlib regression test has been added to verify the correct behavior
of z_compress_level() and z_uncompress.  The test case simply takes
a 128k buffer, it compresses the buffer, it them uncompresses the
buffer, and finally it compares the buffers after the transform.
If the buffers match then everything is fine and no data was lost.
It performs this test for all 9 zlib compression levels.

13 years agoFix zlib compression
Brian Behlendorf [Fri, 25 Feb 2011 21:26:19 +0000 (13:26 -0800)]
Fix zlib compression

While portions of the code needed to support z_compress_level() and
z_uncompress() where in place.  In reality the current implementation
was non-functional, it just was compilable.

The critical missing component was to setup a workspace for the
compress/uncompress stream structures to use.  A kmem_cache was
added for the workspace area because we require a large chunk
of memory.  This avoids to need to continually alloc/free this
memory and vmap() the pages which is very slow.  Several objects
will reside in the per-cpu kmem_cache making them quick to acquire
and release.  A further optimization would be to adjust the
implementation to additional ensure the memory is local to the cpu.
Currently that may not be the case.

13 years agoUse Linux flock struct
Brian Behlendorf [Sun, 20 Feb 2011 22:02:48 +0000 (14:02 -0800)]
Use Linux flock struct

Rather than defining our own structure which will conflict with
Linux's version when building 32-bit.  Simply setup a typedef
to always use the correct Linux version for both 32 ad 64-bit
builds.

13 years agoLinux compat 2.6.37, invalidate_inodes()
Brian Behlendorf [Wed, 23 Feb 2011 20:25:45 +0000 (12:25 -0800)]
Linux compat 2.6.37, invalidate_inodes()

In the 2.6.37 kernel the function invalidate_inodes() is no longer
exported for use by modules.  This memory management functionality
is needed to invalidate the inodes attached to a super block without
unmounting the filesystem.

Because this function still exists in the kernel and the prototype
is available is a common header all we strictly need is the symbol
address.  The address is obtained using spl_kallsyms_lookup_name()
and assigned to the variable invalidate_inodes_fn.  Then a #define
is used to replace all instances of invalidate_inodes() with a
call to the acquired address.  All the complexity is hidden behind
HAVE_INVALIDATE_INODES and invalidate_inodes() can be used as usual.

Long term we should try to get this, or another, interface made
available to modules again.

13 years agoPrep spl-0.6.0-rc1 tag
Brian Behlendorf [Fri, 18 Feb 2011 17:20:02 +0000 (09:20 -0800)]
Prep spl-0.6.0-rc1 tag

Create the first 0.6.0 release candidate tag (rc1).

13 years agoPrefer /lib/modules/$(uname -r)/ links
Brian Behlendorf [Thu, 10 Feb 2011 22:40:57 +0000 (14:40 -0800)]
Prefer /lib/modules/$(uname -r)/ links

Preferentially use the /lib/modules/$(uname -r)/source and
/lib/modules/$(uname -r)/build links.  Only if neither of these
links exist fallback to alternate methods for deducing which
kernel to build with.  This resolves the need to manually
specify --with-linux= and --with-linux-obj= on Debian systems.

13 years agoUpdate META to 0.6.0
Brian Behlendorf [Tue, 8 Feb 2011 00:41:08 +0000 (16:41 -0800)]
Update META to 0.6.0

Roll the version forward to 0.6.0.  While no major changes
really warrant this I want to keep the version in step with
ZFS for now which is the only SPL consumer.

13 years agoBlock in cv_destroy() on all waiters
Brian Behlendorf [Fri, 4 Feb 2011 22:09:08 +0000 (14:09 -0800)]
Block in cv_destroy() on all waiters

Previously we would ASSERT in cv_destroy() if it was ever called
with active waiters.  However, I've now seen several instances in
OpenSolaris code where they do the following:

  cv_broadcast();
  cv_destroy();

This leaves no time for active waiters to be woken up and scheduled
and we trip the ASSERT.  This has not been observed to be an issue
on OpenSolaris because their cv_destroy() basically does nothing.
They still do run the risk of the memory being free'd after the
cv_destroy() and hitting a bad paging request.  But in practice
this race is so small and unlikely it either doesn't happen, or
is so unlikely when it does happen the root cause has not yet been
identified.

Rather than risk the same issue in our code this change updates
cv_destroy() to block until all waiters have been woken and
scheduled.  This may take some time because each waiter must
acquire the mutex.

This change may have an impact on performance for frequently
created and destroyed condition variables.  That however is a price
worth paying it avoid crashing your system.  If performance issues
are observed they can be addressed by the caller.

13 years agoMinor policy interface
Brian Behlendorf [Wed, 22 Dec 2010 21:45:02 +0000 (13:45 -0800)]
Minor policy interface

Simply add the policy function wrappers.  They are completely
non-functional and always return that everything is OK, but once
again they simplify compilation of dependent packages for now.
These can/should be removed once the security policy of the
dependent application is completely understood and intergrade
as appropriate with Linux.

13 years agoAdd missing headers
Brian Behlendorf [Wed, 22 Dec 2010 21:41:57 +0000 (13:41 -0800)]
Add missing headers

Dependent packages require the following missing headers to
simplify compilation.  The headers are basically just stubbed
out with minimal content required.

13 years agoAdd VSA_ACE_* and MAX_ACL_ENTRIES defines
Brian Behlendorf [Wed, 12 Jan 2011 19:34:07 +0000 (11:34 -0800)]
Add VSA_ACE_* and MAX_ACL_ENTRIES defines

The following flags are use to get the proper mask when getting
and setting ACLs.  I'm hopeful this can all largely go away at
some point.

We also add a define for the maximum number of ACL entries.
MAX_ACL_ENTRIES is used as the maximum number of entries for
each type.

13 years agoAdd MAXUID define
Brian Behlendorf [Wed, 12 Jan 2011 19:29:17 +0000 (11:29 -0800)]
Add MAXUID define

For Linux the maximum uid can vary depending on how your kernel
is built.  The Linux kernel still can be compiled with 16 but uids
and gids, although I'm not aware of a major distribution which does
this (maybe an embedded one?).  Given that caviot it is reasonably
safe to define the MAXUID as 2147483647.

13 years agoAdd FIGNORECASE define
Brian Behlendorf [Wed, 12 Jan 2011 19:27:07 +0000 (11:27 -0800)]
Add FIGNORECASE define

The FIGNORECASE case define is now needed, place it with the
related flags.

13 years agoAdd ksid_index_t and ksid_t types
Brian Behlendorf [Wed, 12 Jan 2011 19:25:20 +0000 (11:25 -0800)]
Add ksid_index_t and ksid_t types

Add the ksid_index_t enum and ksid_t type for use.  These types
are now used by packages which depend on the SPL.

13 years agoMinimal VFS additions
Brian Behlendorf [Wed, 12 Jan 2011 19:22:34 +0000 (11:22 -0800)]
Minimal VFS additions

This patch simply removes the place holder vfs_t type and includes
some generic Linux VFS headers.  It also makes some minor fid_t
additions for compatibility.

13 years agoRemove VN_HOLD/VN_RELE/VOP_PUTPAGE
Brian Behlendorf [Tue, 11 Jan 2011 19:46:49 +0000 (11:46 -0800)]
Remove VN_HOLD/VN_RELE/VOP_PUTPAGE

Previously these were defined to noops but rather than give
the misleading impression that these are actually implemented
I'm removing the type entirely for clarity.

13 years agoAdd a few additional vnode #defines
Brian Behlendorf [Tue, 11 Jan 2011 20:00:35 +0000 (12:00 -0800)]
Add a few additional vnode #defines

These additional constants now have users in dependant packages.

13 years agoMake vn_cache|vn_file_cache kmem caches
Brian Behlendorf [Tue, 11 Jan 2011 19:57:02 +0000 (11:57 -0800)]
Make vn_cache|vn_file_cache kmem caches

Both of these caches were previously allowed to be either a
vmem or kmem cache based on the size of the object involved.
Since we know the object won't be to large and performce is
much better for a kmem cache for them to be kmem backed.

13 years agoClean vattr_t and vsecattr_t types
Brian Behlendorf [Tue, 11 Jan 2011 19:56:00 +0000 (11:56 -0800)]
Clean vattr_t and vsecattr_t types

Minor cleanup for the vattr_t and vsecattr_t types.

13 years agoFRSYNC Should Use O_SYNC
Brian Behlendorf [Tue, 11 Jan 2011 19:54:21 +0000 (11:54 -0800)]
FRSYNC Should Use O_SYNC

The Solaris FRSYNC maps most logically to the Linux O_SYNC.  There
is no O_RSYNC on Linux but this wasn't noticed until just recently.

13 years agoAdd vn_mode_to_vtype/vn_vtype to_mode helpers
Brian Behlendorf [Tue, 11 Jan 2011 19:53:05 +0000 (11:53 -0800)]
Add vn_mode_to_vtype/vn_vtype to_mode helpers

Add simple helpers to convert a vnode->v_type to a inode->i_mode.
These should be used sparingly but they are handy to have.

13 years agoAdd cv_timedwait_interruptible() function
Neependra Khare [Mon, 6 Dec 2010 11:35:58 +0000 (17:05 +0530)]
Add cv_timedwait_interruptible() function

The cv_timedwait() function by definition must wait unconditionally
for cv_signal()/cv_broadcast() before waking.  This causes processes
to go in the D state which increases the load average.  The load
average is the summation of processes in D state and run queue.

To avoid this it can be desirable to sleep interruptibly.  These
processes do not count against the load average but may be woken by
a signal.  It is up to the caller to determine why the process
was woken it may be for one of three reasons.

  1) cv_signal()/cv_broadcast()
  2) the timeout expired
  3) a signal was received

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
13 years agoLinux Compat: inode->i_mutex/i_sem
Brian Behlendorf [Mon, 10 Jan 2011 20:35:22 +0000 (12:35 -0800)]
Linux Compat: inode->i_mutex/i_sem

Create spl_inode_lock/spl_inode_unlock compability macros to simply
access to the inode mutex/sem.  This avoids the need to have to ugly
up the code with the required #define's at every call site.  At the
moment the SPL only uses this in one place but higher layers can
benefit from the macro.

13 years agoAdd Thread Specific Data (TSD) Regression Test
Brian Behlendorf [Fri, 3 Dec 2010 23:49:57 +0000 (15:49 -0800)]
Add Thread Specific Data (TSD) Regression Test

To validate the correct behavior of the TSD interfaces it's
important that we add a regression test.  This test is designed
to minimally exercise the fundamental TSD behavior, it does not
attempt to validate all potential corner cases.

The test will first create 32 keys via tsd_create() and register
a common destructor.  Next 16 wait threads will be created each
of which set/verify a random value for all 32 keys, then block
waiting to be released by the control thread.  Meanwhile the
control thread verifies that none of the destructors have been
run prematurely.

The next phase of the test is to create 16 exit threads which
set/verify a random value for all 32 keys.  They then immediately
exit.  This is is designed to verify tsd_exit() which will be
called via thread_exit().  This must result in all registered
destructors being run and the memory for the tsd being free'd.

After this tsd_destroy() is verified by destroying all 32 keys.
Once again we must see the expected number of destructors run
and the tsd memory free'd.  At this point the blocked threads
are released and they exit calling tsd_exit() which should do
very little since all the tsd has already been destroyed.

If this all goes off without a hitch the test passes.  To ensure
no memory has been leaked, I have manually verified that after
spl module unload no memory is reported leaked.

13 years agoAdd Thread Specific Data (TSD) Implementation
Brian Behlendorf [Tue, 30 Nov 2010 17:51:46 +0000 (09:51 -0800)]
Add Thread Specific Data (TSD) Implementation

Thread specific data has implemented using a hash table, this avoids
the need to add a member to the task structure and allows maximum
portability between kernels.  This implementation has been optimized
to keep the tsd_set() and tsd_get() times as small as possible.

The majority of the entries in the hash table are for specific tsd
entries.  These entries are hashed by the product of their key and
pid because by design the key and pid are guaranteed to be unique.
Their product also has the desirable properly that it will be uniformly
distributed over the hash bins providing neither the pid nor key is zero.
Under linux the zero pid is always the init process and thus won't be
used, and this implementation is careful to never to assign a zero key.
By default the hash table is sized to 512 bins which is expected to
be sufficient for light to moderate usage of thread specific data.

The hash table contains two additional type of entries.  They first
type is entry is called a 'key' entry and it is added to the hash during
tsd_create().  It is used to store the address of the destructor function
and it is used as an anchor point.  All tsd entries which use the same
key will be linked to this entry.  This is used during tsd_destory() to
quickly call the destructor function for all tsd associated with the key.
The 'key' entry may be looked up with tsd_hash_search() by passing the
key you wish to lookup and DTOR_PID constant as the pid.

The second type of entry is called a 'pid' entry and it is added to the
hash the first time a process set a key.  The 'pid' entry is also used
as an anchor and all tsd for the process will be linked to it.  This
list is using during tsd_exit() to ensure all registered destructors
are run for the process.  The 'pid' entry may be looked up with
tsd_hash_search() by passing the PID_KEY constant as the key, and
the process pid.  Note that tsd_exit() is called by thread_exit()
so if your using the Solaris thread API you should not need to call
tsd_exit() directly.

13 years agoRefresh autogen.sh products
Brian Behlendorf [Tue, 30 Nov 2010 18:36:58 +0000 (10:36 -0800)]
Refresh autogen.sh products

Refresh the autogen.sh products based on the versions which are
installed by default in the GA RHEL6.0 release.

autoconf (GNU Autoconf) 2.63
automake (GNU automake) 1.11.1
ltmain.sh (GNU libtool) 2.2.6b

13 years agoMake kmutex_t typesafe in all cases.
Ricardo M. Correia [Mon, 22 Nov 2010 08:20:58 +0000 (00:20 -0800)]
Make kmutex_t typesafe in all cases.

When HAVE_MUTEX_OWNER and CONFIG_SMP are defined, kmutex_t is just
a typedef for struct mutex.

This is generally OK but has the downside that it can make mistakes
such as mutex_lock(&kmutex_var) to pass by unnoticed until someone
compiles the code without HAVE_MUTEX_OWNER or CONFIG_SMP (in which
case kmutex_t is a real struct). Note that the correct API to call
should have been mutex_enter() rather than mutex_lock().

We prevent these kind of mistakes by making kmutex_t a real structure
with only one field. This makes kmutex_t typesafe and it shouldn't
have any impact on the generated assembly code.

Signed-off-by: Ricardo M. Correia <ricardo.correia@oracle.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
13 years agoClear cv->cv_mutex when not in use
Brian Behlendorf [Tue, 23 Nov 2010 18:56:55 +0000 (10:56 -0800)]
Clear cv->cv_mutex when not in use

For debugging purposes the condition varaibles keep track of the
mutex used during a wait.  The idea is to validate that all callers
always use the same mutex.  Unfortunately, we have seen cases where
the caller reuses the condition variable with a different mutex but
in a way which is known to be safe.  My reading of the man pages
suggests you should not do this and always cv_destroy()/cv_init()
a new mutex.  However, there is overhead in doing this and it does
appear to be allowed under Solaris.

To accomidate this behavior cv_wait_common() and __cv_timedwait()
have been modified to clear the associated mutex when the last
waiter is dropped.  This ensures that while the condition variable
is in use the incorrect mutex case is detected.  It also allows the
condition variable to be safely recycled without requiring the
overhead of a cv_destroy()/cv_init() as long as it isn't currently
in use.

Finally, spin lock cv->cv_lock was removed because it is not required.
When the condition variable is used properly the caller will always
be holding the mutex so the spin lock is redundant.  The lock was
originally added because I expected to need to protect more than
just the cv->cv_mutex.  It turns out that was not the case.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
13 years agoGive ENOTSUP a valid user space error value
Ned Bass [Tue, 9 Nov 2010 22:06:13 +0000 (14:06 -0800)]
Give ENOTSUP a valid user space error value

The ZFS module returns ENOTSUP for several error conditions where an operation
is not (yet) supported.  The SPL defined ENOTSUP in terms of ENOTSUPP, but that
is an internal Linux kernel error code that should not be seen by user
programs.  As a result the zfs utilities print a confusing error message if an
unsupported operation is attempted:

    internal error: Unknown error 524
    Aborted

This change defines ENOTSUP in terms of EOPNOTSUPP which is consistent with
user space.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
13 years agoLinux 2.6.36 compat, use fops->unlocked_ioctl()
Brian Behlendorf [Wed, 10 Nov 2010 20:58:07 +0000 (12:58 -0800)]
Linux 2.6.36 compat, use fops->unlocked_ioctl()

As of linux-2.6.36 the last in-tree consumer of fops->ioctl() has
been removed and thus fops()->ioctl() has also been removed.  The
replacement hook is fops->unlocked_ioctl() which has existed in
kernel since 2.6.12.  Since the SPL only contains support back
to 2.6.18 vintage kernels, I'm not adding an autoconf check for
this and simply moving everything to use fops->unlocked_ioctl().

13 years agoLinux 2.6.36 compat, fs_struct->lock type change
Brian Behlendorf [Tue, 9 Nov 2010 19:15:32 +0000 (11:15 -0800)]
Linux 2.6.36 compat, fs_struct->lock type change

In the linux-2.6.36 kernel the fs_struct lock was changed from a
rwlock_t to a spinlock_t.  If the kernel would export the set_fs_pwd()
symbol by default this would not have caused us any issues, but they
don't.  So we're forced to add a new autoconf check which sets the
HAVE_FS_STRUCT_SPINLOCK define when a spinlock_t is used.  We can
then correctly use either spin_lock or write_lock in our custom
set_fs_pwd() implementation.

13 years agoLinux 2.6.36 compat, wrap RLIM64_INFINITY
Brian Behlendorf [Tue, 9 Nov 2010 18:34:10 +0000 (10:34 -0800)]
Linux 2.6.36 compat, wrap RLIM64_INFINITY

As of linux-2.6.36 RLIM64_INFINITY is defined in linux/resource.h.
This is handled by conditionally defining RLIM64_INFINITY in the
SPL only when the kernel does not provide it.

13 years agoFix incorrect krw_type_t type
Brian Behlendorf [Tue, 9 Nov 2010 05:32:47 +0000 (21:32 -0800)]
Fix incorrect krw_type_t type

Flagged by the default compile options on archlinux 2010.05, we should
be using the krw_t type not the krw_type_t type in the private data.

  module/splat/splat-rwlock.c: In function ‘splat_rwlock_test4_func’:
  module/splat/splat-rwlock.c:432:6: warning: case value ‘1’ not in
  enumerated type ‘krw_type_t’

13 years agoPrep for 0.5.2 tag
Brian Behlendorf [Fri, 5 Nov 2010 18:52:46 +0000 (11:52 -0700)]
Prep for 0.5.2 tag

Update META file to prep for 0.5.2 tag.

13 years agoClear owner after dropping mutex
Brian Behlendorf [Wed, 3 Nov 2010 22:56:53 +0000 (15:56 -0700)]
Clear owner after dropping mutex

It's important to clear mp->owner after calling mutex_unlock()
because when CONFIG_DEBUG_MUTEXES is defined the mutex owner
is verified in mutex_unlock().  If we set it to NULL this check
fails and the lockdep support is immediately disabled.

13 years agoFix 2.6.35 shrinker callback API change
Brian Behlendorf [Fri, 22 Oct 2010 21:16:43 +0000 (14:16 -0700)]
Fix 2.6.35 shrinker callback API change

As of linux-2.6.35 the shrinker callback API now takes an additional
argument.  The shrinker struct is passed to the callback so that users
can embed the shrinker structure in private data and use container_of()
to access it.  This removes the need to always use global state for the
shrinker.

To handle this we add the SPL_AC_3ARGS_SHRINKER_CALLBACK autoconf
check to properly detect the API.  Then we simply setup a callback
function with the correct number of arguments.  For now we do not make
use of the new 3rd argument.

13 years agoatomic_*_*_nv() functions need to return the new value atomically.
Ricardo M. Correia [Fri, 17 Sep 2010 23:03:15 +0000 (16:03 -0700)]
atomic_*_*_nv() functions need to return the new value atomically.

A local variable must be used for the return value to avoid a
potential race once the spin lock is dropped.

Signed-off-by: Ricardo M. Correia <ricardo.correia@oracle.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
13 years agoFix markdown rendering
Brian Behlendorf [Wed, 15 Sep 2010 16:05:34 +0000 (09:05 -0700)]
Fix markdown rendering

These two lines were being rendered incorrectly on the GitHub
site.  To fix the issue there needs to be leading whitespace
before each line to ensure each command is rendered on its
own line.

$ ./configure
$ make pkg

13 years agoReference new zfsonlinux.org website
Brian Behlendorf [Tue, 14 Sep 2010 22:54:15 +0000 (15:54 -0700)]
Reference new zfsonlinux.org website

The wiki contents have been converted to html and made available
at their new home http://zfsonlinux.org.  The wiki has also been
disabled the html pages are now the official documentation.

13 years agoSupport custom build directories
Brian Behlendorf [Thu, 2 Sep 2010 19:12:39 +0000 (12:12 -0700)]
Support custom build directories

One of the neat tricks an autoconf style project is capable of
is allow configurion/building in a directory other than the
source directory.  The major advantage to this is that you can
build the project various different ways while making changes
in a single source tree.

For example, this project is designed to work on various different
Linux distributions each of which work slightly differently.  This
means that changes need to verified on each of those supported
distributions perferably before the change is committed to the
public git repo.

Using nfs and custom build directories makes this much easier.
I now have a single source tree in nfs mounted on several different
systems each running a supported distribution.  When I make a
change to the source base I suspect may break things I can
concurrently build from the same source on all the systems each
in their own subdirectory.

wget -c http://github.com/downloads/behlendorf/spl/spl-x.y.z.tar.gz
tar -xzf spl-x.y.z.tar.gz
cd spl-x-y-z

------------------------- run concurrently ----------------------
<ubuntu system>  <fedora system>  <debian system>  <rhel6 system>
mkdir ubuntu     mkdir fedora     mkdir debian     mkdir rhel6
cd ubuntu        cd fedora        cd debian        cd rhel6
../configure     ../configure     ../configure     ../configure
make             make             make             make
make check       make check       make check       make check

This is something the project has almost supported for a long time
but finishing this support should save me lots of time.