summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Read the /etc/hostid file directly.Darik Horn2011-06-242-5/+109
| | | | | | | | | | | | 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.
* Add linux compatibility testsBrian Behlendorf2011-06-215-0/+248
| | | | | | | | | | | | | | | | | | | | | 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.
* Linux 3.0: Shrinker compatibilityBrian Behlendorf2011-06-215-29/+281
| | | | | | | | 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.
* Avoid 'rpm -q' bug for 'make pkg'Brian Behlendorf2011-06-163-8/+8
| | | | | | | | | | | | | | | 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
* Add TASKQ_NORECLAIM flagBrian Behlendorf2011-05-062-0/+5
| | | | | | | 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.
* Prep spl-0.6.0-rc4 tagBrian Behlendorf2011-05-031-1/+1
| | | | Create the fourth 0.6.0 release candidate tag (rc4).
* Correct MAXUIDBrian Behlendorf2011-04-291-1/+1
| | | | | | | | 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.
* Renamed 'struct fid' for NFSGunnar Beutner2011-04-291-1/+1
| | | | | | Renamed 'struct fid' because its name conflicts with another struct in the Linux kernel headers. The fid_t typedef remains unchanged intentionally.
* Merged pull request #40 from dajhorn/spl-proc-typos.Brian Behlendorf2011-04-251-3/+3
|\ | | | | Correct typos in the spl proc handler.
| * Correct typos in the spl proc handler.Darik Horn2011-04-241-3/+3
|/ | | | | Correct a format typo that causes /proc/sys/kernel/spl/hostid to return a decimal number instead of a hexadecimal number.
* Fix 32-bit MAXOFFSET_T definitionBrian Behlendorf2011-04-221-7/+1
| | | | | | | 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.
* Make the SPL kernel messages consistent with ZFS.Darik Horn2011-04-212-7/+7
| | | | | | | 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 <[email protected]>
* Remove the gawk dependency.Darik Horn2011-04-213-59/+18
| | | | | | | | | | | | | 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 <[email protected]>
* Import spl_hostid as a module parameter.Darik Horn2011-04-213-13/+18
| | | | | | | | | | | | | | | | | | 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 <[email protected]>
* Linux 2.6.39 compat, zlib_deflate_workspacesize()Brian Behlendorf2011-04-206-2/+198
| | | | | | | | | | | | | 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.
* Linux 2.6.39 compat, kern_path_parent()Brian Behlendorf2011-04-205-3/+111
| | | | | | | 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.
* Linux 2.6.39 compat, DEFINE_SPINLOCK()Brian Behlendorf2011-04-203-4/+4
| | | | | | | | | | 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.
* Fix unused variableBrian Behlendorf2011-04-191-3/+0
| | | | | | 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.
* Fix gcc configure warningsBrian Behlendorf2011-04-192-60/+75
| | | | | | | | | | | | | | | | 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.
* Linux 2.6.39 compat, invalidate_inodes()Brian Behlendorf2011-04-195-3/+181
| | | | | | | | 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.
* Fix rebuildable RPMs for el6/ch5Brian Behlendorf2011-04-081-2/+6
| | | | | | | 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.
* Prep spl-0,6,0-rc3 tagBrian Behlendorf2011-04-061-1/+1
| | | | Create the third 0.6.0 release candidate tag (rc3).
* Add dnlc_reduce_cache() supportBrian Behlendorf2011-04-066-1/+283
| | | | | | | | | | | | | 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.
* Decrease target objects per slabBrian Behlendorf2011-04-061-1/+1
| | | | | | | | 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.
* Add slab usage summeries to /procBrian Behlendorf2011-04-062-1/+125
| | | | | | | | | | | | | | | | | | 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.
* Update /proc/spl/kmem/slab outputBrian Behlendorf2011-04-061-22/+24
| | | | | | | | | | | | | 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.
* Linux shrinker compatBrian Behlendorf2011-04-062-41/+55
| | | | | | | | | | | | | | 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);
* Add .va_dentry helperBrian Behlendorf2011-04-061-0/+1
| | | | | | 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.
* Update CHAOS 5 PackagingBrian Behlendorf2011-03-311-4/+4
| | | | | | 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.
* Add crgetfsuid()/crgetfsgid() helpersBrian Behlendorf2011-03-222-78/+60
| | | | | | | | | | | | 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.
* Load zlib_inflate.koBrian Behlendorf2011-03-221-0/+1
| | | | | | | 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.
* Disable vmalloc() direct reclaimBrian Behlendorf2011-03-201-2/+22
| | | | | | | | | | | | | | | | | | | 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
* Remove default GFP_NOFS allocationsBrian Behlendorf2011-03-191-7/+6
| | | | | | | | | | | | | | | 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.
* Prep spl-0.6.0-rc2 tagBrian Behlendorf2011-03-091-1/+1
| | | | Create the second 0.6.0 release candidate tag (rc2).
* Linux 2.6.31 compat, include linux/seq_file.hBrian Behlendorf2011-03-071-0/+1
| | | | | | 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.
* Make Missing Modules.symvers FatalBrian Behlendorf2011-03-072-0/+36
| | | | | | | | | 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.
* Make CONFIG_PREEMPT FatalBrian Behlendorf2011-03-072-0/+154
| | | | | | 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.
* Remove xvattr supportBrian Behlendorf2011-03-022-72/+28
| | | | | | | | | | | | | | | | | | | 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 *'.
* Add TIMESPEC_OVERFLOW helperBrian Behlendorf2011-03-021-0/+3
| | | | | Add the TIMESPEC_OVERFLOW helper macro to allow easy checking of timespec overflow.
* Add zlib regression testBrian Behlendorf2011-02-256-0/+172
| | | | | | | | | 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.
* Fix zlib compressionBrian Behlendorf2011-02-256-100/+238
| | | | | | | | | | | | | | | | 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.
* Use Linux flock structBrian Behlendorf2011-02-231-7/+5
| | | | | | | 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.
* Linux compat 2.6.37, invalidate_inodes()Brian Behlendorf2011-02-235-0/+128
| | | | | | | | | | | | | | | | | | 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.
* Prep spl-0.6.0-rc1 tagBrian Behlendorf2011-02-181-1/+1
| | | | Create the first 0.6.0 release candidate tag (rc1).
* Prefer /lib/modules/$(uname -r)/ linksBrian Behlendorf2011-02-102-9/+24
| | | | | | | | 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.
* Update META to 0.6.0Brian Behlendorf2011-02-071-1/+1
| | | | | | 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.
* Block in cv_destroy() on all waitersBrian Behlendorf2011-02-042-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Minor policy interfaceBrian Behlendorf2011-01-271-5/+18
| | | | | | | | | 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.
* Add missing headersBrian Behlendorf2011-01-274-0/+99
| | | | | | Dependent packages require the following missing headers to simplify compilation. The headers are basically just stubbed out with minimal content required.
* Add VSA_ACE_* and MAX_ACL_ENTRIES definesBrian Behlendorf2011-01-271-0/+7
| | | | | | | | | | 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.