aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Swap taskq_ent_t with taskqid_t in taskq_thread_tPrakash Surya2011-12-162-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The taskq_t's active thread list is sorted based on its tqt_ent->tqent_id field. The list is kept sorted solely by inserting new taskq_thread_t's in their correct sorted location; no other means is used. This means that once inserted, if a taskq_thread_t's tqt_ent->tqent_id field changes, the list runs the risk of no longer being sorted. Prior to the introduction of the taskq_dispatch_prealloc() interface, this was not a problem as a taskq_ent_t actively being serviced under the old interface should always have a static tqent_id field. Thus, once the taskq_thread_t is added to the taskq_t's active thread list, the taskq_thread_t's tqt_ent->tqent_id field would remain constant. Now, this is no longer the case. Currently, if using the taskq_dispatch_prealloc() interface, any given taskq_ent_t actively being serviced _may_ have its tqent_id value incremented. This happens when the preallocated taskq_ent_t structure is recursively dispatched. Thus, a taskq_thread_t could potentially have its tqt_ent->tqent_id field silently modified from under its feet. If this were to happen to a taskq_thread_t on a taskq_t's active thread list, this would compromise the integrity of the order of the list (as the list _may_ no longer be sorted). To get around this, the taskq_thread_t's taskq_ent_t pointer was replaced with its own static copy of the tqent_id. So, as a taskq_ent_t is pulled off of the taskq_t's pending list, a static copy of its tqent_id is made and this copy is used to sort the active thread list. Using a static copy is key in ensuring the integrity of the order of the active thread list. Even if the underlying taskq_ent_t is recursively dispatched (as has its tqent_id modified), this static copy stored inside the taskq_thread_t will remain constant. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #71
* Add make rule for building Arch Linux packagesPrakash Surya2011-12-1412-20/+296
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added the necessary build infrastructure for building packages compatible with the Arch Linux distribution. As such, one can now run: $ ./configure $ make pkg # Alternatively, one can run 'make arch' as well on an Arch Linux machine to create two binary packages compatible with the pacman package manager, one for the spl userland utilties and another for the spl kernel modules. The new packages can then be installed by running: # pacman -U $package.pkg.tar.xz In addition, source-only packages suitable for an Arch Linux chroot environment or remote builder can also be built using the 'sarch' make rule. NOTE: Since the source dist tarball is created on the fly from the head of the build tree, it's MD5 hash signature will be continually influx. As a result, the md5sum variable was intentionally omitted from the PKGBUILD files, and the '--skipinteg' makepkg option is used. This may or may not have any serious security implications, as the source tarball is not being downloaded from an outside source. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes: #68
* Exercise new taskq interface in splat-taskq testsPrakash Surya2011-12-131-49/+280
| | | | | | | | | | | | The splat-taskq test functions were slightly modified to exercise the new taskq interface in addition to the old interface. If the old interface passes each of its tests, the new interface is exercised. Both sub tests (old interface and new interface) must pass for each test as a whole to pass. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #65
* Implement taskq_dispatch_prealloc() interfacePrakash Surya2011-12-132-6/+95
| | | | | | | | | | | | | | | | | | | This patch implements the taskq_dispatch_prealloc() interface which was introduced by the following illumos-gate commit. It allows for a preallocated taskq_ent_t to be used when dispatching items to a taskq. This eliminates a memory allocation which helps minimize lock contention in the taskq when dispatching functions. commit 5aeb94743e3be0c51e86f73096334611ae3a058e Author: Garrett D'Amore <[email protected]> Date: Wed Jul 27 07:13:44 2011 -0700 734 taskq_dispatch_prealloc() desired 943 zio_interrupt ends up calling taskq_dispatch with TQ_SLEEP Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #65
* Add Test: "Single task queue, recursive dispatch"Prakash Surya2011-12-131-0/+77
| | | | | | | | | | | | | Added another splat taskq test to ensure tasks can be recursively submitted to a single task queue without issue. When the taskq_dispatch_prealloc() interface is introduced, this use case can potentially cause a deadlock if a taskq_ent_t is dispatched while its tqent_list field is not empty. This _should_ never be a problem with the existing taskq_dispatch() interface. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #65
* Replace tq_work_list and tq_threads in taskq_tPrakash Surya2011-12-132-57/+95
| | | | | | | | | | | | | | | | | | | | | | | | To lay the ground work for introducing the taskq_dispatch_prealloc() interface, the tq_work_list and tq_threads fields had to be replaced with new alternatives in the taskq_t structure. The tq_threads field was replaced with tq_thread_list. Rather than storing the pointers to the taskq's kernel threads in an array, they are now stored as a list. In addition to laying the ground work for the taskq_dispatch_prealloc() interface, this change could also enable taskq threads to be dynamically created and destroyed as threads can now be added and removed to this list relatively easily. The tq_work_list field was replaced with tq_active_list. Instead of keeping a list of taskq_ent_t's which are currently being serviced, a list of taskq_threads currently servicing a taskq_ent_t is kept. This frees up the taskq_ent_t's tqent_list field when it is being serviced (i.e. now when a taskq_ent_t is being serviced, it's tqent_list field will be empty). Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #65
* Replace struct spl_task with struct taskq_entPrakash Surya2011-12-131-63/+62
| | | | | | | | | | | | The spl_task structure was renamed to taskq_ent, and all of its fields were renamed to have a prefix of 'tqent' rather than 't'. This was to align with the naming convention which the ZFS code assumes. Previously these fields were private so the name never mattered. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #65
* Add SPLAT_TEST_FINI call for SPLAT_TASKQ_TEST6_IDPrakash Surya2011-12-131-0/+1
| | | | | | | | | | This change adds the neglected SPLAT_TEST_FINI call for the SPLAT_TASKQ_TEST6_ID, just as is done for the other 5 SPLAT_TASKQ_* tests. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #64
* Fix usage of MUTEX macro in mutex_enter_nestedPrakash Surya2011-12-131-1/+1
| | | | | | | | | | A call site of the MUTEX macro had incorrectly placed its closing parenthesis, causing two parameters to be passed rather than one. This change moves the misplaced parenthesis to fix the typographical error. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #70
* Allow 64-bit timestamps to be set on 64-bit kernelsChris Dunlop2011-12-121-3/+8
| | | | | | | | | | | ZFS and 64-bit linux are perfectly capable of dealing with 64-bit timestamps, but ZFS deliberately prevents setting them. Adjust the SPL such that TIMESPEC_OVERFLOW will not always assume 32-bit values and instead use the correct values for your kernel build. This effectively allows 64-bit timestamps on 64-bit systems. Signed-off-by: Brian Behlendorf <[email protected]> Closes ZFS issue #487
* Fix a typo referencing an incorrect symbolPrakash Surya2011-11-211-1/+1
| | | | | | | | | The splat_taskq_test4_common function was incorrectly referencing the splat_taskq-test13_func symbol, when it meant to be using the splat_taskq_test4_func symbol. Signed-off-by: Brian Behlendorf <[email protected]> Closes #61
* Prepend spl_ to all init/fini functionsBrian Behlendorf2011-11-1111-35/+39
| | | | | | | | | | This is a bit of cleanup I'd been meaning to get to for a while to reduce the chance of a type conflict. Well that conflict finally occurred with the kstat_init() function which conflicts with a function in the 2.6.32-6-pve kernel. Signed-off-by: Brian Behlendorf <[email protected]> Closes #56
* Fix depmod warningBrian Behlendorf2011-11-101-4/+4
| | | | | | | | | | | | The depmod utility from module-init-tools 3.12-pre3 generates a warning when the -e option is used without -E or -F. This was observed under OpenSuse 11.4. To resolve the issue when the exact System.map-* for your kernel cannot be found fallback to a generic safe '/sbin/depmod -a'. WARNING: -e needs -E or -F Signed-off-by: Brian Behlendorf <[email protected]>
* Linux 3.1 compat, shrink_*cache_memoryBrian Behlendorf2011-11-092-16/+52
| | | | | | | | | | | | | | | | | | | | | | As of Linux 3.1 the shrink_dcache_memory and shrink_icache_memory functions have been removed. This same task is now accomplished more cleanly with per super block shrinkers. This unfortunately leaves us no easy way to support the dnlc_reduce_cache() function. This support has always been entirely optional. So when no reasonable interface is available allow the dnlc_reduce_cache() function to effectively become a no-op. The downside of this change is that it will prevent the zfs arc meta data limts from being enforced. However, the current zfs implementation in this regard is already flawed and needs to be reworked. If the arc needs to enfore a meta data limit it will need to be extended to coordinate directly with the zpl. This will allow us to drop all this compatibility code and get more fine grained control over the cache management. Signed-off-by: Brian Behlendorf <[email protected]> Issue #52
* Linux 3.1 compat, vfs_fsync()Brian Behlendorf2011-11-094-146/+247
| | | | | | | | | | | Preferentially use the vfs_fsync() function. This function was initially introduced in 2.6.29 and took three arguments. As of 2.6.35 the dentry argument was dropped from the function. For older kernels fall back to using file_fsync() which also took three arguments including the dentry. Signed-off-by: Brian Behlendorf <[email protected]> Issue #52
* Linux 3.1 compat, kern_path_parent()Brian Behlendorf2011-11-097-19/+152
| | | | | | | | | | 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 <[email protected]> Issue #52
* Fix NULL deref in balance_pgdat()Brian Behlendorf2011-11-031-5/+8
| | | | | | | | | | | | | | | 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 <[email protected]> Closes ZFS issue #287
* Include distribution in releaseBrian Behlendorf2011-10-192-2/+2
| | | | | | Common practice is to include the distribution in the package release. Signed-off-by: Brian Behlendorf <[email protected]>
* Cleaned up MUTEX() #defineGunnar Beutner2011-10-191-1/+1
| | | | | | | 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 <[email protected]>
* Remove the spinlocks for mutex_enter()/mutex_exit()Gunnar Beutner2011-10-191-27/+1
| | | | | | | | 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 <[email protected]>
* Fix race condition in mutex_exit()Gunnar Beutner2011-10-191-12/+2
| | | | | | | | | | 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 <[email protected]> Closes ZFS issue #167
* vn_rdwr() didn't properly advance the file positionGunnar Beutner2011-10-181-0/+1
| | | | | | | | | 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 <[email protected]> Closes ZFS issue #391
* Fix package URLs to use the github repositoryBrian Behlendorf2011-10-172-2/+2
| | | | | | | 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 <[email protected]>
* Fix various typos in commentsBrian Behlendorf2011-10-111-27/+27
| | | | | | | Just clean up some of the typos and spelling mistakes in the comments of spl-kmem.c. Signed-off-by: Brian Behlendorf <[email protected]>
* Fixed typo in spl_slab_alloc()Gunnar Beutner2011-10-111-1/+1
| | | | | | | | 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 <[email protected]>
* Properly destroy work items in spl_kmem_cache_destroy()Gunnar Beutner2011-10-111-3/+3
| | | | | | | | | | | | | 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 <[email protected]> Closes ZFS bugs #279, #62, #363, #418
* Fixed invalid resource re-use in file_find()Gunnar Beutner2011-10-112-1/+3
| | | | | | | | | 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 <[email protected]> Closes ZFS issue #386
* Prep spl-0.6.0-rc6 tagBrian Behlendorf2011-10-061-1/+1
| | | | Create the sixth 0.6.0 release candidate tag (rc6).
* Remove /etc/hostid missing warningBrian Behlendorf2011-10-061-5/+1
| | | | | | | | | | | 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 <[email protected]>
* Revert "Stabilize the hostid for RPM installations."Brian Behlendorf2011-09-301-11/+0
| | | | | | | | | | 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.
* Fix HAVE_FS_STRUCT_SPINLOCK check for gcc-4.1.2Brian Behlendorf2011-09-192-0/+9
| | | | | | | | | | | 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 <[email protected]>
* Fix the configure CONFIG_* option detectionBrian Behlendorf2011-07-222-9/+3
| | | | | | | | | | | | | | | 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 <[email protected]> Closes #320
* Fix 'make install' overly broad 'rm'Brian Behlendorf2011-07-201-1/+5
| | | | | | | | | | | | | | | | | | | 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 <[email protected]> Closes #328
* Prep spl-0.6.0-rc5 tagBrian Behlendorf2011-07-011-1/+1
| | | | Create the fifth 0.6.0 release candidate tag (rc5).
* Linux 2.6.39 compat, mutex ownerBrian Behlendorf2011-06-244-12/+177
| | | | | | | | | | | | 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.
* Stabilize the hostid for RPM installations.Darik Horn2011-06-241-0/+11
| | | | | | | | | | | | | | | | | 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.
* 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]>