summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix NULL pointer dereference on PaX/GRSecurity patched Linux 3.3 and later ↵Richard Yao2012-07-202-12/+15
| | | | | | | | | | | | | | | kernels Support for PaX/GRSecurity patched kernels was developed against Linux 3.2. Unfortunately, an autotools check introduced for a Linux 3.3 API fails on PaX/GRSecurity patched kernels. This causes the module to be built against the Linux 3.2 ABI, which results in a NULL pointer dereference at runtime. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #794 Closes #809
* Disable .zfs directory on 32-bit systemsBrian Behlendorf2012-07-201-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | The .zfs control directory implementation currently relies on the fact that there is a direct 1:1 mapping from an object id to its inode number. This works well as long as the system uses a 64-bit value to store the inode number. Unfortunately, the Linux kernel defines the inode number as an 'unsigned long' type. This means that for 32-bit systems will only have 32-bit inode numbers but we still have 64-bit object ids. This problem is particularly acute for the .zfs directories which leverage those upper 32-bits. This is done to avoid conflicting with object ids which are allocated monotonically starting from 0. This is likely to also be a problem for datasets on 32-bit systems with more than ~2 billion files. The right long term fix must remove the simple 1:1 mapping. Until that's done the only safe thing to do is to disable the .zfs directory on 32-bit systems. Signed-off-by: Brian Behlendorf <[email protected]>
* Add ddt_object_load() error handlingBrian Behlendorf2012-07-201-1/+3
| | | | | | | | | Add the missing error handling to ddt_object_load(). There's no good reason this needs to be fatal. It is preferable that an error be returned. This will allow 'zpool import -FX' to safely attempt to rollback through previous txgs looking for a good one. Signed-off-by: Brian Behlendorf <[email protected]>
* Add 'inline' keywordBrian Behlendorf2012-07-191-4/+4
| | | | | | | | | | | | The '__attribute__((always_inline))' does not strictly imply 'inline'. Newer versions of gcc detect this misuse and issue the following warning. Including the missing 'inline' resolves the build warning. ./module/zfs/dsl_scan.c:758:1:error: always_inline function might not be inlinable [-Werror=attributes] Signed-off-by: Brian Behlendorf <[email protected]>
* Fix build failures on PaX/GRSecurity patched kernelsRichard Yao2012-07-177-40/+640
| | | | | | | | | | | | | | | | | | | | | | | Gentoo Hardened kernels include the PaX/GRSecurity patches. They use a dialect of C that relies on a GCC plugin. In particular, struct file_operations has been marked do_const in the PaX/GRSecurity dialect, which causes GCC to consider all instances of it as const. This caused failures in the autotools checks and the ZFS source code. To address this, we modify the autotools checks to take into account differences between the PaX C dialect and the regular C dialect. We also modify struct zfs_acl's z_ops member to be a pointer to a function pointer table. Lastly, we modify zpl_put_link() to address a PaX change to the function prototype of nd_get_link(). This avoids compiler errors in the PaX/GRSecurity dialect. Note that the change in zpl_put_link() causes a warning that becomes a build failure when debugging is enabled. Fixing that warning requires ryao/spl@5ca50ef459c59bc74b7a7cd3af7311da2b1cd2c3. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #484
* Move partition scanning from userspace to module.Etienne Dechamps2012-07-1764-13/+464
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, zpool online -e (dynamic vdev expansion) doesn't work on whole disks because we're invoking ioctl(BLKRRPART) from userspace while ZFS still has a partition open on the disk, which results in EBUSY. This patch moves the BLKRRPART invocation from the zpool utility to the module. Specifically, this is done just before opening the device in vdev_disk_open() which is called inside vdev_reopen(). This requires jumping through some hoops to get to the disk device from the partition device, and to make sure we can still open the partition after the BLKRRPART call. Note that this new code path is triggered on dynamic vdev expansion only; other actions, like creating a new pool, are unchanged and still call BLKRRPART from userspace. This change also depends on API changes which are available in 2.6.37 and latter kernels. The build system has been updated to detect this, but there is no compatibility mode for older kernels. This means that online expansion will NOT be available in older kernels. However, it will still be possible to expand the vdev offline. Signed-off-by: Brian Behlendorf <[email protected]> Closes #808
* Move zfs.release generation to configure stepBrian Behlendorf2012-07-125-12/+14
| | | | | | | | | | | | | | Previously, the zfs.release file was created at 'make install' time. This is slightly problematic when the file is needed without running 'make install'. Because of this, the step creating the file was removed from 'make install' and replaced with a more appropriate zfs.release.in file. As a result, the zfs.release file will now be created earlier as part of the 'configure' step as opposed to the 'make install' step. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Add PowerPC to supported VTOCsBrian Behlendorf2012-07-121-1/+1
| | | | | | | | | | | | This code was was inherited from Solaris which was careful to define the expected VTOC for various supported architectures. While this check may have made sense there it's something we should be able to safely drop under Linux. However, I'm not quite ready to do that yet. So for the moment I'm just doing the very safe thing of adding PowerPC as a supported type. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix efi_use_whole_disk() when efi_nparts == 128.Etienne Dechamps2012-07-121-24/+26
| | | | | | | | | | | | | | | | | | Commit e5dc681a changed EFI_NUMPAR from 9 to 128. This means that the on-disk EFI label has efi_nparts = 128 instead of 9. The index of the reserved partition, however, is still 8. This breaks efi_use_whole_disk(), which uses efi_nparts-1 as the index of the reserved partition. This commit fixes efi_use_whole_disk() when the index of the reserved partition is not efi_nparts-1. It rewrites the algorithm and makes it more robust by using the order of the partitions instead of their numbering. It assumes that the last non-empty partition is the reserved partition, and that the non-empty partition before that is the data partition. Signed-off-by: Brian Behlendorf <[email protected]> Issue #808
* Use the right device path when relabeling.Etienne Dechamps2012-07-121-5/+14
| | | | | | | | | | | | | | | Currently, zpool_vdev_online() calls zpool_relabel_disk() with a short partition device name, which is obviously wrong because (1) zpool_relabel_disk() expects a full, absolute path to use with open() and (2) efi_write() must be called on an opened disk device, not a partition device. With this patch, zpool_relabel_disk() gets called with a full disk device path. The path is determined using the same algorithm as zpool_find_vdev(). Signed-off-by: Brian Behlendorf <[email protected]> Issue #808
* Fix error handling for "zpool online -e".Etienne Dechamps2012-07-121-5/+7
| | | | | | | | | | | | | | | | | | | | | | The error handling code around zpool_relabel_disk() is either inexistent or wrong. The function call itself is not checked, and zpool_relabel_disk() is generating error messages from an unitialized buffer. Before: # zpool online -e homez sdb; echo $? `: cannot relabel 'sdb1': unable to open device: 2 0 After: # zpool online -e homez sdb; echo $? cannot expand sdb: cannot relabel 'sdb1': unable to open device: 2 1 Signed-off-by: Brian Behlendorf <[email protected]> Issue #808
* Illumos #1949, #1953George Wilson2012-07-114-9/+16
| | | | | | | | | | | | | | | | | | | | | | 1949 crash during reguid causes stale config 1953 allow and unallow missing from zpool history since removal of pyzfs Reviewed by: Adam Leventhal <[email protected]> Reviewed by: Matt Ahrens <[email protected]> Reviewed by: Eric Schrock <[email protected]> Reviewed by: Bill Pijewski <[email protected]> Reviewed by: Richard Lowe <[email protected]> Reviewed by: Garrett D'Amore <[email protected]> Reviewed by: Dan McDonald <[email protected]> Reviewed by: Steve Gonczi <[email protected]> Approved by: Eric Schrock <[email protected]> References: https://www.illumos.org/issues/1949 https://www.illumos.org/issues/1953 Ported by: Brian Behlendorf <[email protected]> Closes #665
* Illumos #1748: desire support for reguid in zfsGarrett D'Amore2012-07-1115-15/+225
| | | | | | | | | | | | | | | | | | | | | | Reviewed by: George Wilson <[email protected]> Reviewed by: Igor Kozhukhov <[email protected]> Reviewed by: Alexander Eremin <[email protected]> Reviewed by: Alexander Stetsenko <[email protected]> Approved by: Richard Lowe <[email protected]> References: https://www.illumos.org/issues/1748 This commit modifies the user to kernel space ioctl ABI. Extra care should be taken when updating to ensure both the kernel modules and utilities are updated. If only the user space component is updated both the 'zpool events' command and the 'zpool reguid' command will not work until the kernel modules are updated. Ported by: Martin Matuska <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #665
* Relicense zfs.gentoo.in from GPLv2 to 2-clause BSDRichard Yao2012-07-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | As the Gentoo sys-fs/zfs maintainer, I receive license compatibility questions and at times, those questions can be harassing. I feel that the presence of the GPL in Gentoo's package metadata promotes such questions. zfs.gentoo.in is the only GPLv2 licensed file in ZFS, so I have taken the liberty of contacting all contributors to this file to request permission to relicense it. All of the contributors to this file have agreed to relicense it under the 2-clause BSD license. I have added their Signed-offs to this commit, in order of first contribution. Thank you everyone for being so understanding. Signed-off-by: devsk <[email protected]> Signed-off-by: Alexey Shvetsov <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Andrew Tselischev <[email protected]> Signed-off-by: Zachary Bedell <[email protected]> Signed-off-by: Gunnar Beutner <[email protected]> Signed-off-by: Kyle Fuller <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #819
* Use ULL suffix in constantsRichard Yao2012-07-101-4/+4
| | | | | | | | | | | | | | | The lack of the ULL suffix causes warnings such as the following on 32-bit systems: In function 'zfsctl_is_snapdir': zfs-0.6.0//module/zfs/zfs_ctldir.c:151: warning: integer constant is too large for 'long' type We add the ULL suffix to fix that. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #813
* Update incorrect ddt_zap_lookup() assertionBrian Behlendorf2012-07-031-1/+1
| | | | | | | | | | | When the ddt_zap_lookup() function was updated to dynamically allocate memory for the cbuf variable, to save stack space, the 'csize <= sizeof (cbuf)' assertion was not updated. The result of this was that the size of the pointer was being used in the comparison rather than the buffer size. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Prakash Surya <[email protected]>
* Remove Chaos 4.x RPM supportBrian Behlendorf2012-07-021-41/+0
| | | | | | | The Chaos 4.x distribution is based on RHEL 5.x which is no longer supported by ZoL since it uses a 2.6.18 kernel. Signed-off-by: Brian Behlendorf <[email protected]>
* Support debug and debug-devel sub packagesPrakash Surya2012-07-021-75/+350
| | | | | | | | | | | | | | | | | | | | | | | | | This commit adds support for building debug and debug-devel sub packages of the zfs-modules main package. This is to allow building packages which are built against a debug kernel. By default, only packages are built against a regular non-debug kernel. This can be toggled by passing the '--with kernel-debug' parameter to rpmbuild. Examples: # To build packages against only the non-debug kernel $ rpmbuild --rebuild --with kernel --without kernel-debug $SRPM # To build packages against only the debug kernel $ rpmbuild --rebuild --without kernel --with kernel-debug $SRPM # To build packages against debug and non-debug kernel $ rpmbuild --rebuild --with kernel --with kernel-debug $SRPM Note: Only the RHEL 5/6, CHAOS 5, and Fedora distributions are supported for building the debug and debug-devel packages. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Add ZIL statistics.Etienne Dechamps2012-06-292-2/+120
| | | | | | | | | | | | | | | | | The performance of the ZIL is usually the main bottleneck when dealing with synchronous, write-heavy workloads (e.g. databases). Understanding the behavior of the ZIL is required to diagnose performance issues for these workloads, and to tune ZIL parameters (like zil_slog_limit) accordingly. This commit adds a new kstat page dedicated to the ZIL with some counters which, hopefully, scheds some light into what the ZIL is doing, and how it is doing it. Currently, these statistics are available in /proc/spl/kstat/zfs/zil. A description of the fields can be found in zil.h. Signed-off-by: Brian Behlendorf <[email protected]> Closes #786
* ZFS 0.6.0-rc9zfs-0.6.0-rc9Brian Behlendorf2012-06-141-1/+1
|
* Speed up 'zfs list -t snapshot -o name -s name'Pawel Jakub Dawidek2012-06-148-18/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FreeBSD #xxx: Dramatically optimize listing snapshots when user requests only snapshot names and wants to sort them by name, ie. when executes: # zfs list -t snapshot -o name -s name Because only name is needed we don't have to read all snapshot properties. Below you can find how long does it take to list 34509 snapshots from a single disk pool before and after this change with cold and warm cache: before: # time zfs list -t snapshot -o name -s name > /dev/null cold cache: 525s warm cache: 218s after: # time zfs list -t snapshot -o name -s name > /dev/null cold cache: 1.7s warm cache: 1.1s NOTE: This patch only appears in FreeBSD. If/when Illumos picks up the change we may want to drop this patch and adopt their version. However, for now this addresses a real issue. Ported-by: Brian Behlendorf <[email protected]> Issue #450
* Add zvol_inhibit_dev module option.Darik Horn2012-06-131-0/+10
| | | | | | | | | | | | | | | | | ZoL can create more zvols at runtime than can be configured during system start, which hangs the init stack at reboot. When a slow system has more than a few hundred zvols, udev will fork bomb during system start and spend too much time in device detection routines, so upstart kills it. The zfs_inhibit_dev option allows an affected system to be rescued by skipping /dev/zd* creation and thereby avoiding the udev overload. All zvols are made inaccessible if this option is set, but the `zfs destroy` and `zfs send` commands still work, and ZFS filesystems can be mounted. Signed-off-by: Brian Behlendorf <[email protected]>
* Make zvol_remove_link() print a more useful error messageRichard Yao2012-06-131-1/+1
| | | | Signed-off-by: Brian Behlendorf <[email protected]>
* Mark zdev.conf as a config fileBrian Behlendorf2012-06-131-4/+7
| | | | | | | | Prevent 'rpm -Uvh *.rpm" from automatically replacing your vdev.conf file by flagging it as a non replacable config file. Signed-off-by: Brian Behlendorf <[email protected]> Closes #486
* Workaround for failing zvol_idBrian Behlendorf2012-06-132-1/+8
| | | | | | | | | | This is not a proper fix. It is just a workaround for the stack smashing detected by gcc in zvol_id. We simply disable the gcc stack protector for now when building the zvol_id udev helper. Once the root cause is resolved this patch should be reverted. Signed-off-by: Brian Behlendorf <[email protected]> Issues #569
* Make zil_slog_limit a tunable module parameter.Etienne Dechamps2012-06-121-1/+4
| | | | | | | | | | | | | | | | | | zil_slog_limit specifies the maximum commit size to be written to the separate log device. Larger commits bypass the separate log device and go directly to the data devices. The optimal value for zil_slog_limit directly depends on the latency and throughput characteristics of both the separate log device and the data disks. Small synchronous writes are faster on low-latency separate log devices (e.g. SSDs) whereas large synchronous writes are faster on high-latency data disks (e.g. spindles) because of higher throughput, especially with a large array. The point is, the line between "small" and "large" synchronous writes in this scenario is heavily dependent on the hardware used. That's why it should be made configurable. Signed-off-by: Brian Behlendorf <[email protected]> Closes #783
* Retry removal of busy minorsDaniel Verite2012-06-111-1/+20
| | | | | | | | | | | When failing to remove a zvol device link because it's busy, wait a bit and retry in a loop instead of giving up immediately. This technique is similar to the loop in zpool_label_disk_wait(), with the same goal: waiting for the asynchronous udev processes to finish their work. Signed-off-by: Brian Behlendorf <[email protected]> Closes #692
* Include <locale.h> to avoid error: 'LC_ALL' undeclared.Daniel Verite2012-06-111-0/+1
| | | | | | | | | | | | | | When compiling ZFS with CFLAGS=-O0 it will trigger the following error. Resolve the issue by properly including locale.h. ../../cmd/mount_zfs/mount_zfs.c: In function 'main': ../../cmd/mount_zfs/mount_zfs.c:318:2: warning: implicit declaration of function 'setlocale' [-Wimplicit-function-declaration] ../../cmd/mount_zfs/mount_zfs.c:318:19: error: 'LC_ALL' undeclared (first use in this function) Signed-off-by: Brian Behlendorf <[email protected]> Closes #724
* Linux 3.4 compat, d_make_root() replaces d_alloc_root()Richard Yao2012-06-1161-1/+182
| | | | | | | | | | | | | | | | | | | | torvalds/linux@adc0e91ab142abe93f5b0d7980ada8a7676231fe introduced introduced d_make_root() as a replacement for d_alloc_root(). Further commits appear to have removed d_alloc_root() from the Linux source tree. This causes the following failure: error: implicit declaration of function 'd_alloc_root' [-Werror=implicit-function-declaration] To correct this we update the code to use the current d_make_root() interface for readability. Then we introduce an autotools check to determine if d_make_root() is available. If it isn't then we define some compatibility logic which used the older d_alloc_root() interface. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #776
* Honor logbias when writing to ZVOLs.Etienne Dechamps2012-06-111-2/+6
| | | | | | | | | The logbias option is not taken into account when writing to ZVOLs. We fix that by using the same logic as in the zfs filesystem write code (see zfs_log.c). Signed-off-by: Brian Behlendorf <[email protected]> Closes #774
* Improve CONFIG_DEBUG_LOCK_ALLOC error messageNed Bass2012-06-112-10/+15
| | | | | | | | | | The configure script error message for kernels built with CONFIG_DEBUG_LOCK_ALLOC may give the impression that the issue is strictly with license compliance. To avoid confusion add some words indicating that the linking stage will fail if the build continues. Signed-off-by: Brian Behlendorf <[email protected]> Closes #773
* Improve 'zpool import' EBUSY error messageBrian Behlendorf2012-06-011-0/+6
| | | | | | | | | | | | | | | | | | When a device is already open O_EXCL by another process the `zpool import` will correctly fail. However, the default failure message isn't very helpful. It may in fact be harmful if you take its advise and destroy your pool. cannot import 'tank': pool is busy Destroy and re-create the pool from a backup source. Improve the error message in the EBUSY case to simply print a message indicating that the devices are current in use. The user will need to manually identify which process has the device open exclusively and why. Signed-off-by: Brian Behlendorf <[email protected]>
* Add /dev/mapper/ to search pathBrian Behlendorf2012-06-011-1/+13
| | | | | | | | When creating pools short device names may be used when those devices appear in certain well known locations under /dev/. This change adds /dev/mapper/ to that list. Signed-off-by: Brian Behlendorf <[email protected]>
* Add vdev_id for JBOD-friendly udev aliasesNed A. Bass2012-06-0128-115/+1171
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vdev_id parses the file /etc/zfs/vdev_id.conf to map a physical path in a storage topology to a channel name. The channel name is combined with a disk enclosure slot number to create an alias that reflects the physical location of the drive. This is particularly helpful when it comes to tasks like replacing failed drives. Slot numbers may also be re-mapped in case the default numbering is unsatisfactory. The drive aliases will be created as symbolic links in /dev/disk/by-vdev. The only currently supported topologies are sas_direct and sas_switch: o sas_direct - a channel is uniquely identified by a PCI slot and a HBA port o sas_switch - a channel is uniquely identified by a SAS switch port A multipath mode is supported in which dm-mpath devices are handled by examining the first running component disk, as reported by 'multipath -l'. In multipath mode the configuration file should contain a channel definition with the same name for each path to a given enclosure. vdev_id can replace the existing zpool_id script on systems where the storage topology conforms to sas_direct or sas_switch. The script could be extended to support other topologies as well. The advantage of vdev_id is that it is driven by a single static input file that can be shared across multiple nodes having a common storage toplogy. zpool_id, on the other hand, requires a unique /etc/zfs/zdev.conf per node and a separate slot-mapping file. However, zpool_id provides the flexibility of using any device names that show up in /dev/disk/by-path, so it may still be needed on some systems. vdev_id's functionality subsumes that of the sas_switch_id script, and it is unlikely that anyone is using it, so sas_switch_id is removed. Finally, /dev/disk/by-vdev is added to the list of directories that 'zpool import' will scan. Signed-off-by: Brian Behlendorf <[email protected]> Closes #713
* Extend CONFIG_DEBUG_LOCK_ALLOC checkBrian Behlendorf2012-06-012-59/+237
| | | | | | | | | | The CONFIG_DEBUG_LOCK_ALLOC check at configure time was added to detect when mutex_lock() is defined as a GPL-only symbol. However, the check as written only inferred this from this configuration setting, it never actually checked. This change introduces that missing check to prevent false positives. Signed-off-by: Brian Behlendorf <[email protected]>
* Define the needed ISA types for ARMJorgen Lundman2012-05-032-2/+21
| | | | | | Add the minimum required ISA types to support the ARM architecture. Signed-off-by: Brian Behlendorf <[email protected]>
* Revert "Disable direct reclaim on zvols"Brian Behlendorf2012-04-301-7/+1
| | | | | | | | | | | This reverts commit ce90208cf9e04df966429f115d8831371ea9afce. This change was observed to cause problems when using a zvol to back a VM under 2.6.32.59 kernels. This issue was filed as #710. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #342 Issue #710
* Add mdadm and bc dependenciesBrian Behlendorf2012-04-301-1/+1
| | | | | | | | The zfs-test package additionally depends on mdadm and bc to run the zfault.sh tests. Signed-off-by: Brian Behlendorf <[email protected]> Closes #690
* Linux 3.3 compat, iops->create()/mkdir()/mknod()Brian Behlendorf2012-04-3062-6/+241
| | | | | | | | | | The mode argument of iops->create()/mkdir()/mknod() was changed from an 'int' to a 'umode_t'. To prevent a compiler warning an autoconf check was added to detect the API change and then correctly set a zpl_umode_t typedef. There is no functional change. Signed-off-by: Brian Behlendorf <[email protected]> Closes #701
* Disable direct reclaim on zvolsRichard Yao2012-04-301-1/+7
| | | | | | | | | | | Previously, it was possible for the direct reclaim path to be invoked when a write to a zvol was made. When a zvol is used as a swap device, this often causes swap requests to depend on additional swap requests, which deadlocks. We address this by disabling the direct reclaim path on zvols. Signed-off-by: Brian Behlendorf <[email protected]> Closes #342
* Update ARC memory limits to account for SLUB internal fragmentationRichard Yao2012-04-301-5/+1
| | | | | | | | | | | | | | | | 23bdb07d4e4c435205d25d3efdb5fef2d089ce5e updated the ARC memory limits to be 1/2 of memory or all but 4GB. Unfortunately, these values assume zero internal fragmentation in the SLUB allocator, when in reality, the internal fragmentation could be as high as 50%, effectively doubling memory usage. This poses clear safety issues, because it permits the size of ARC to exceed system memory. This patch changes this so that the default value of arc_c_max is always 1/2 of system memory. This effectively limits the ARC to the memory that the system has physically installed. Signed-off-by: Brian Behlendorf <[email protected]> Closes #660
* Integrate ARC more tightly with LinuxBrian Behlendorf2012-04-301-155/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Under Solaris the ARC was designed to stay one step ahead of the VM subsystem. It would attempt to recognize low memory situtions before they occured and evict data from the cache. It would also make assessments about if there was enough free memory to perform a specific operation. This was all possible because Solaris exposes a fairly decent view of the memory state of the system to other kernel threads. Linux on the other hand does not make this information easily available. To avoid extensive modifications to the ARC the SPL attempts to provide these same interfaces. While this works it is not ideal and problems can arise when the ARC and Linux have different ideas about when your out of memory. This has manifested itself in the past as a spinning arc_reclaim_thread. This patch abandons the emulated Solaris interfaces in favor of the prefered Linux interface. That means moving the bulk of the memory reclaim logic out of the arc_reclaim_thread and in to the evict driven shrinker callback. The Linux VM will call this function when it needs memory. The ARC is then responsible for attempting to free the requested amount of memory if possible. Several interfaces have been modified to accomidate this approach, however the basic user space implementation remains the same. The following changes almost exclusively just apply to the kernel implementation. * Removed the hdr_recl() reclaim callback which is redundant with the broader arc_shrinker_func(). * Reduced arc_grow_retry to 5 seconds from 60. This is now used internally in the ARC with arc_no_grow to indicate that direct reclaim was recently performed. This typically indicates a rapid change in memory demands which the kswapd threads were unable to keep ahead of. As long as direct reclaim is happening once every 5 seconds arc growth will be paused to avoid further contributing to the existing memory pressure. The more common indirect reclaim paths will not set arc_no_grow. * arc_shrink() has been extended to take the number of bytes by which arc_c should be reduced. This allows for a more granual reduction of the arc target. Since the kernel provides a reclaim value to the arc_shrinker_func() this value is used instead of 1<<arc_shrink_shift. * arc_reclaim_needed() has been removed. It was used to determine if the system was under memory pressure and relied extensively on Solaris specific VM interfaces. In most case the new code just checks arc_no_grow which indicates that within the last arc_grow_retry seconds direct memory reclaim occurred. * arc_memory_throttle() has been updated to always include the amount of evictable memory (arc and page cache) in its free space calculations. This space is largely available in most call paths due to direct memory reclaim. * The Solaris pageout code was also removed to avoid confusion. It has always been disabled due to proc_pageout being defined as NULL in the Linux port. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Add zfs_mdcomp_disable module optionBrian Behlendorf2012-04-271-0/+3
| | | | | | | | | | Expose the zfs_mdcomp_disable variable as a module option. This can be used to disable compression of zfs meta data which is enabled by default. This shouldn't need to be tuned but for most workloads, however there may be very specific instances where it makes sense to trade disk capacity for extra cpu cycles. Signed-off-by: Brian Behlendorf <[email protected]>
* Illumos #2067: uninitialized variables in zfs(1M) may make snapshots ↵Richard Lowe2012-04-271-16/+16
| | | | | | | | | | | | | | | | | | undestroyable Reviewed by: Joshua M. Clulow <[email protected]> Reviewed by: Milan Jurik <[email protected]> Reviewed by: Igor Kozhukhov <[email protected]> Reviewed by: Garrett D'Amore <[email protected]> Reviewed by: Matt Ahrens <[email protected]> Reviewed by: Steve Gonczi <[email protected]> Approved by: Garrett D'Amore <[email protected]> References: https://www.illumos.org/issues/2067 Ported by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Illumos #1946: incorrect formatting when listing output of multiple pools ↵Frederik Wessels2012-04-271-1/+5
| | | | | | | | | | | | | | with zpool iostat -v Reviewed by: Richard Elling <[email protected]> Reviewed by: Joshua M. Clulow <[email protected]> Approved by: Richard Lowe <[email protected]> Reference to Illumos issue: https://www.illumos.org/issues/1946 Ported by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Illumos #952: separate intent logs should be obvious in 'zpool iostat' outputMike Harsch2012-04-271-3/+33
| | | | | | | | | | | | | | | | Reviewed by: Adam Leventhal <[email protected]> Reviewed by: Matt Ahrens <[email protected]> Reviewed by: Eric Schrock <[email protected]> Reviewed by: Dan McDonald <[email protected]> Reviewed by: Garrett D'Amore <[email protected]> Approved by: Eric Schrock <[email protected]> Refererce to Illumos issue: https://www.illumos.org/issues/952 Ported-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #607
* Illumos #1909: disk sync write perf regression when slog is used post oi_148Brian Behlendorf2012-04-192-7/+16
| | | | | | | | | | | | | | | | | | | Reviewed by: Matt Ahrens <[email protected]> Reviewed by: Eric Schrock <[email protected]> Reviewed by: Robert Mustacchi <[email protected]> Reviewed by: Bill Pijewski <[email protected]> Reviewed by: Richard Elling <[email protected]> Reviewed by: Steve Gonczi <[email protected]> Reviewed by: Garrett D'Amore <[email protected]> Reviewed by: Dan McDonald <[email protected]> Reviewed by: Albert Lee <[email protected]> Approved by: Eric Schrock <[email protected]> Refererces to Illumos issue: https://www.illumos.org/issues/1909 Signed-off-by: Brian Behlendorf <[email protected]> Closes #680
* Use KM_PUSHPAGE in l2arc_write_buffersPrakash Surya2012-04-171-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is potential for deadlock in the l2arc_feed thread if KM_PUSHPAGE is not used for the allocations made in l2arc_write_buffers. Specifically, if KM_PUSHPAGE is not used for these allocations, it is possible for reclaim to be triggered which can cause the l2arc_feed thread to deadlock itself on the ARC_mru mutex. An example of this is demonstrated in the following backtrace of the l2arc_feed thread: crash> bt 4123 PID: 4123 TASK: ffff88062f8c1500 CPU: 6 COMMAND: "l2arc_feed" 0 [ffff88062511d610] schedule at ffffffff814eeee0 1 [ffff88062511d6d8] __mutex_lock_slowpath at ffffffff814f057e 2 [ffff88062511d748] mutex_lock at ffffffff814f041b 3 [ffff88062511d768] arc_evict at ffffffffa05130ca [zfs] 4 [ffff88062511d858] arc_adjust at ffffffffa05139a9 [zfs] 5 [ffff88062511d878] arc_shrink at ffffffffa0513a95 [zfs] 6 [ffff88062511d898] arc_kmem_reap_now at ffffffffa0513be8 [zfs] 7 [ffff88062511d8c8] arc_shrinker_func at ffffffffa0513ccc [zfs] 8 [ffff88062511d8f8] shrink_slab at ffffffff8112a17a 9 [ffff88062511d958] do_try_to_free_pages at ffffffff8112bfdf 10 [ffff88062511d9e8] try_to_free_pages at ffffffff8112c3ed 11 [ffff88062511da98] __alloc_pages_nodemask at ffffffff8112431d 12 [ffff88062511dbb8] kmem_getpages at ffffffff8115e632 13 [ffff88062511dbe8] fallback_alloc at ffffffff8115f24a 14 [ffff88062511dc68] ____cache_alloc_node at ffffffff8115efc9 15 [ffff88062511dcc8] __kmalloc at ffffffff8115fbf9 16 [ffff88062511dd18] kmem_alloc_debug at ffffffffa047b8cb [spl] 17 [ffff88062511dda8] l2arc_feed_thread at ffffffffa0511e71 [zfs] 18 [ffff88062511dea8] thread_generic_wrapper at ffffffffa047d1a1 [spl] 19 [ffff88062511dee8] kthread at ffffffff81090a86 20 [ffff88062511df48] kernel_thread at ffffffff8100c14a Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* ZFS list snapshot property aliasP.SCH2012-04-112-5/+6
| | | | | | | | Add support for the `zfs list -t snap` alias which is available under Oracle Solaris 11. Signed-off-by: Brian Behlendorf <[email protected]> Closes #640
* ZFS snapshot aliasP.SCH2012-04-112-5/+11
| | | | | | | | | For consistency, and because it's handy, add the 'zfs snap' alias which was introduced by Oracle Solaris 11. This includes an update to the man page to reflect all the available alias (snap, umount, and recv). Signed-off-by: Brian Behlendorf <[email protected]> Closes #640