summaryrefslogtreecommitdiffstats
path: root/etc/init.d
Commit message (Collapse)AuthorAgeFilesLines
* zfs-functions: skip lines where mntpnt is 'none'Georgy Yakovlev2018-03-301-0/+2
| | | | | | | | | | | | | | This fixes zfs-mount initscript trying to mount swap volumes as filesystems or anything that has 'none' as a mountpoint in /etc/fstab. Additionally, fixes trying to mount swap volumes as a filesystem on RHEL. RHEL defines mountpoint for swap as `swap`. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Georgy Yakovlev <[email protected]> Closes #7346 Closes #7347
* chmod -x on etc/init.d/zfs-*.in automake filesTony Hutter2018-03-284-0/+0
| | | | | | | | | | | | Clear executable bit on zfs-import.in, zfs-mount.in, zfs-share.in, and zfs-zed.in. These are automake files and should not be marked executable. This fixes a RPM build error on Fedora 28. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #7355 Closes #7327
* OpenZFS 7431 - ZFS Channel ProgramsChris Williamson2018-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Authored by: Chris Williamson <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: John Kennedy <[email protected]> Reviewed by: Dan Kimmel <[email protected]> Approved by: Garrett D'Amore <[email protected]> Ported-by: Don Brady <[email protected]> Ported-by: John Kennedy <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7431 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/dfc11533 Porting Notes: * The CLI long option arguments for '-t' and '-m' don't parse on linux * Switched from kmem_alloc to vmem_alloc in zcp_lua_alloc * Lua implementation is built as its own module (zlua.ko) * Lua headers consumed directly by zfs code moved to 'include/sys/lua/' * There is no native setjmp/longjump available in stock Linux kernel. Brought over implementations from illumos and FreeBSD * The get_temporary_prop() was adapted due to VFS platform differences * Use of inline functions in lua parser to reduce stack usage per C call * Skip some ZFS Test Suite ZCP tests on sparc64 to avoid stack overflow
* Use /sbin/openrc-run for openrc init scriptsBtbN2017-08-161-1/+1
| | | | | | | | Using /sbin/runscript is deprecated and throws a QA warning when still used in init scripts. Reviewed-by: bunder2015 <[email protected]> Signed-off-by: BtbN <[email protected]> Closes #6519
* OpenZFS 7793 - ztest fails assertion in dmu_tx_willuse_spaceBrian Behlendorf2017-03-071-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed by: Steve Gonczi <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Pavel Zakharov <[email protected]> Ported-by: Brian Behlendorf <[email protected]> Background information: This assertion about tx_space_* verifies that we are not dirtying more stuff than we thought we would. We “need” to know how much we will dirty so that we can check if we should fail this transaction with ENOSPC/EDQUOT, in dmu_tx_assign(). While the transaction is open (i.e. between dmu_tx_assign() and dmu_tx_commit() — typically less than a millisecond), we call dbuf_dirty() on the exact blocks that will be modified. Once this happens, the temporary accounting in tx_space_* is unnecessary, because we know exactly what blocks are newly dirtied; we call dnode_willuse_space() to track this more exact accounting. The fundamental problem causing this bug is that dmu_tx_hold_*() relies on the current state in the DMU (e.g. dn_nlevels) to predict how much will be dirtied by this transaction, but this state can change before we actually perform the transaction (i.e. call dbuf_dirty()). This bug will be fixed by removing the assertion that the tx_space_* accounting is perfectly accurate (i.e. we never dirty more than was predicted by dmu_tx_hold_*()). By removing the requirement that this accounting be perfectly accurate, we can also vastly simplify it, e.g. removing most of the logic in dmu_tx_count_*(). The new tx space accounting will be very approximate, and may be more or less than what is actually dirtied. It will still be used to determine if this transaction will put us over quota. Transactions that are marked by dmu_tx_mark_netfree() will be excepted from this check. We won’t make an attempt to determine how much space will be freed by the transaction — this was rarely accurate enough to determine if a transaction should be permitted when we are over quota, which is why dmu_tx_mark_netfree() was introduced in 2014. We also won’t attempt to give “credit” when overwriting existing blocks, if those blocks may be freed. This allows us to remove the do_free_accounting logic in dbuf_dirty(), and associated routines. This logic attempted to predict what will be on disk when this txg syncs, to know if the overwritten block will be freed (i.e. exists, and has no snapshots). OpenZFS-issue: https://www.illumos.org/issues/7793 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/3704e0a Upstream bugs: DLPX-32883a Closes #5804 Porting notes: - DNODE_SIZE replaced with DNODE_MIN_SIZE in dmu_tx_count_dnode(), Using the default dnode size would be slightly better. - DEBUG_DMU_TX wrappers and configure option removed. - Resolved _by_dnode() conflicts these changes have not yet been applied to OpenZFS.
* Fix spellingka72017-01-032-5/+5
| | | | | | | | | Reviewed-by: Brian Behlendorf <[email protected] Reviewed-by: Giuseppe Di Natale <[email protected]>> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Haakan T Johansson <[email protected]> Closes #5547 Closes #5543
* Change /etc/mtab to /proc/self/mountsslashdd2016-09-202-3/+3
| | | | | | | | | | | Fix misleading error message: "The /dev/zfs device is missing and must be created.", if /etc/mtab is missing. Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Eric Desrochers <[email protected]> Closes #4680 Closes #5029
* Set proper dependency for string replacement targetsChunwei Chen2016-08-021-2/+2
| | | | | | | | | A lot of string replacement target don't have dependency or incorrect dependency. We setup proper dependency by pattern rules. Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #4908
* Add support for alpine linuxCarlo Landmeter2016-03-085-5/+5
| | | | | | | | | Both Alpine Linux and Gentoo use OpenRC so we share its logic Signed-off-by: Carlo Landmeter <[email protected]> Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #4386
* zfs-import: Perform verbatim import using cache fileJames Lee2015-10-132-64/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change modifies the import service to use the default cache file to perform a verbatim import of pools at boot. This fixes code that searches all devices and imported all visible pools. Using the cache file is in keeping with the way ZFS has always worked, how Solaris, Illumos, FreeBSD, and systemd performs imports, and is how it is written in the man page (zpool(1M,8)): All pools in this cache are automatically imported when the system boots. Importantly, the cache contains important information for importing multipath devices, and helps control which pools get imported in more dynamic environments like SANs, which may have thousands of visible and constantly changing pools, which the ZFS_POOL_EXCEPTIONS variable is not equipped to handle. Verbatim imports prevent rogue pools from being automatically imported and mounted where they shouldn't be. The change also stops the service from exporting pools at shutdown. Exporting pools is only meant to be performed explicitly by the administrator of the system. The old behavior of searching and importing all visible pools is preserved and can be switched on by heeding the warning and toggling the ZPOOL_IMPORT_ALL_VISIBLE variable in /etc/default/zfs. Signed-off-by: James Lee <[email protected]> Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3777 Closes #3526
* Init script fixesTurbo Fredriksson2015-09-296-49/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix regression - "OVERLAY_MOUNTS" should have been "DO_OVERLAY_MOUNTS". * Fix update-rc.d commands in postinst. Thanx to subzero79@GitHub. * Fix make sure a filesystem exists before trying to mount in mount_fs() * Fix local variable usage. * Fix to read_mtab(): * Strip control characters (space - \040) from /proc/mounts GLOBALY, not just first occurrence. * Don't replace unprintable characters ([/-. ]) for use in the variable name with underscore. No need, just remove them all together. * Add check_boolean() to check if a user configure option is set ('yes', 'Yes', 'YES' or any combination there of) OR '1'. Anything else is considered 'unset'. * Add a ZFS_POOL_IMPORT to the default config. * This is a semi colon separated list of pools to import ONLY. * This is intended for systems which have _a lot_ of pools (from a SAN for example) and it would be to many to put in the ZFS_POOL_EXCEPTIONS variable.. * Add a config option "ZPOOL_IMPORT_OPTS" for adding additional options to "zpool import". * Add documentation and the chance of overriding the ZPOOL_CACHE variable in the config file. * Remove "sort" from find_pools() and setup_snapshot_booting(). Sometimes not available, and not really necessary. Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Ned Bass <[email protected]> Issue #3816
* Fixed --signal typoyuina8222015-09-221-1/+1
| | | | | | Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #3773
* Add extra_started_commands because reload function is not defaultyuina8222015-09-221-0/+2
| | | | | | Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #3773
* Force create /run/sendsigs.omit.d link when starting zedSenH2015-09-081-1/+1
| | | | | | | | | | | | | | Resolve the following error when restarting the zed by force creating the /run/sendsigs.omit.d/zed link. sudo /etc/init.d/zfs-zed restart * Stopping ZFS Event Daemon [ OK ] * Starting ZFS Event Daemon ln: failed to create symbolic link `/run/sendsigs.omit.d/zed': File exists Signed-off-by: SenH <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3747
* Reorder zfs-* services to allow /var on separate datasetJames Lee2015-09-025-46/+45
| | | | | | | | | | | | | | | | | | | | | | | | | ZED depends on /var. When /var is a separate dataset, it must be mounted before starting ZED. This change moves the zfs-zed service from starting first, to starting after zfs-mount, but before zfs-share. As discussed in issue #3513, ZED does not need to start first in order to consume events made during the zfs-import and zfs-mount services. The events will be queued and can be handled later in the boot process. ZED may, however, handle sharing in the future, so it should be started before the zfs-share service. This commit also stops the zfs-import service from writing temp files to /var/tmp on shutdown and it corrects the return code for the OpenRC service. Other OpenRC-specific changes noted in issue #3513 were reitereated in issue #3715 and committed in da619f3. Signed-off-by: James Lee <[email protected]> Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3513
* Some OpenRC dependency logic belongs in mountRichard Yao2015-08-302-10/+12
| | | | | | | | | The dependencies for handling / on ZFS belong in the mount script, not the zed script. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3715
* Fix some minor issues with the SYSV init and initramfs scripts.Turbo Fredriksson2015-07-245-14/+18
| | | | | | | | | | | | | | | | | | | | | This is some minor fixes to commits 2cac7f5f11756663525a5d4604d9f0a3202d4024 and 2a34db1bdbcecf5019c4a59f2a44c92fe82010f2. * Make sure to alien'ate the new initramfs rpm package as well! The rpm package is build correctly, but alien isn't run on it to create the deb. * Before copying file from COPY_FILE_LIST, make sure the DESTDIR/dir exists. * Include /lib/udev/vdev_id file in the initrd. * Because the initrd needs to use '/sbin/modprobe' instead of 'modprobe', we need to use this in load_module() as well. * Make sure that load_module() can be used more globaly, instead of calling '/sbin/modprobe' all over the place. * Make sure that check_module_loaded() have a parameter - module to check. Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3626
* Support parallel build trees (VPATH builds)Turbo Fredriksson2015-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Build products from an out of tree build should be written relative to the build directory. Sources should be referred to by their locations in the source directory. This is accomplished by adding the 'src' and 'obj' variables for the module Makefile.am, using relative paths to reference source files, and by setting VPATH when source files are not co-located with the Makefile. This enables the following: $ mkdir build $ cd build $ ../configure \ --with-spl=$HOME/src/git/spl/ \ --with-spl-obj=$HOME/src/git/spl/build $ make -s This change also has the advantage of resolving the following warning which is generated by modern versions of automake. Makefile.am:00: warning: source file 'xxx' is in a subdirectory, Makefile.am:00: but option 'subdir-objects' is disabled Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #1082
* Add /dev/mapper to the list of possible sources for pool devices.Turbo Fredriksson2015-06-291-0/+9
| | | | | | | | This is especially needed when using LUKS backed pools. Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3536
* Additional SYSV init script fixes (3).Turbo Fredriksson2015-06-252-54/+22
| | | | | | | | | | | | | | | | | | * In read_mtab(), fix problems (!?) in the mounts file. It will record 'rpool 1' as 'rpool\0401' instead of 'rpool\00401' which seems to be the correct (at least as far as 'printf' is concerned). Use this using the external 'echo' command (and not the one built in to the shell) because the internal one would interpret the backslash code (incorrectly), giving us a  instead. * Remove reregister_mounts() - no longer needed. * For Gentoo, the zfs_log_failure_msg() should use eend(), not eerror() (which requires an error message, which we don't have). Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3488 Closes #3509 Closes #3514
* Revert "Additional SYSV init script fixes."Turbo Fredriksson2015-06-251-10/+7
| | | | | | | | | | | This reverts commit 036391c980c1e6504352b770eb385806a951b1cb. Because #3509 came just after this commit was accepted and is related to the original problem the commit was supposed to fix, we need to solve the problem in another way. Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Additional SYSV init script fixes.Turbo Fredriksson2015-06-171-7/+10
| | | | | | | | | | | | | | | | | | | | Use the 'mount' command instead of /proc/mounts to get a list of matching filesystems. This because /proc/mounts reports a pool with a space 'rpool 1' as 'rpool\0401'. The space is encoded as 3-digit octal which is legal. However 'printf "%b"', which we use to filter out other illegal characters (such as slash, space etc) can't properly interpret this because it expects 4-digit octal. We get a  instead of the space we expected. The correct value should have been 'rpool\00401' (note the additional leading zero). So use 'mount', which interprets all backslash-escapes correctly, instead. Signed-off-by: Turbo Fredriksson [email protected] Signed-off-by: Brian Behlendorf <[email protected]> Closes #3488
* SYSV init script fixes.Turbo Fredriksson2015-06-054-17/+35
| | | | | | | | | | | | | | | | | | | | | * Change the order of the function library check/load. Redhat based system _can_ have a /lib/lsb/init-functions file (from the redhat-lsb-core package), but it's only partially what we can use. Instead, look for that file last, giving the script a chance to catch the 'real' distribution file. * Filter out dashes and dots in dataset name in read_mtab(). * Get rid of 'awk' entirely. This is usually in /usr, which might not be availible. * Get rid of the 'find /dev/disk/by-*' (find is on /usr, which might not be availible). Instead use echo in a for loop. * Rebuild scripts if any of the *.in files changed. * Move the sed part that filters out duplicates inside the check fo valid variable. Signed-off-by: Turbo Fredriksson [email protected] Signed-off-by: Brian Behlendorf <[email protected]> Closes #3463 Closes #3457
* Base init scripts for SYSV systemsTurbo Fredriksson2015-05-2814-786/+1443
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Based on the init scripts included with Debian GNU/Linux, then take code from the already existing ones, trying to merge them into one set of scripts that will work for 'everyone' for better maintainability. * Add configurable variables to control the workings of the init scripts: * ZFS_INITRD_PRE_MOUNTROOT_SLEEP Set a sleep time before we load the module (used primarily by initrd scripts to allow for slower media (such as USB devices etc) to be availible before we load the zfs module). * ZFS_INITRD_POST_MODPROBE_SLEEP Set a timed sleep in the initrd to after the load of the zfs module. * ZFS_INITRD_ADDITIONAL_DATASETS To allow for mounting additional datasets in the initrd. Primarily used in initrd scripts to allow for when filesystem needed to boot (such as /usr, /opt, /var etc) isn't directly under the root dataset. * ZFS_POOL_EXCEPTIONS Exclude pools from being imported (in the initrd and/or init scripts). * ZFS_DKMS_ENABLE_DEBUG, ZFS_DKMS_ENABLE_DEBUG_DMU_TX, ZFS_DKMS_DISABLE_STRIP Set to control how dkms should build the dkms packages. * ZPOOL_IMPORT_PATH Set path(s) where "zpool import" should import pools from. This was previously the job of "USE_DISK_BY_ID" (which is still used for backwards compatibility) but was renamed to allow for better control of import path(s). * If old USE_DISK_BY_ID is set, but not new ZPOOL_IMPORT_PATH, then we set ZPOOL_IMPORT_PATH to sane defaults just to be on the safe side. * ZED_ARGS To allow for local options to zed without having to change the init script. * The import function, do_import(), imports pools by name instead of '-a' for better control of pools to import and from where. * If USE_DISK_BY_ID is set (for backwards compatibility), but isn't 'yes' then ignore it. * If pool(s) isn't found with a simple "zpool import" (seen it happen), try looking for them in /dev/disk/by-id (if it exists). Any duplicates (pools found with both commands) is filtered out. * IF we have found extra pool(s) this way, we must force USE_DISK_BY_ID so that the first, simple "zpool import $pool" is able to find it. * Fallback on importing the pool using the cache file (if it exists) only if 'simple' import (either with ZPOOL_IMPORT_PATH or the 'built in' defaults) didn't work. * The export function, do_export(), will export all pools imported, EXCEPT the root pool (if there is one). * ZED script from the Debian GNU/Linux packages added. * Refreshed ZED init script from behlendorf@5e7a660 to be portable so it may be used on both LSB and Redhat style systems. * If there is no pool(s) imported and zed successfully shut down, we will unload the zfs modules. * The function library file for the ZoL init script is installed as /etc/init.d/zfs-functions. * The four init scripts, the /etc/{defaults,sysconfig,conf.d}/zfs config file as well as the common function library is tagged as '%config(noreplace)' in the rpm rules file to make sure they are not replaced automatically if locally modifed. * Pitfals and workarounds: * If we're running from init, remove stale /etc/dfs/sharetab before importing pools in the zfs-import init script. * On Debian GNU/Linux, there's a 'sendsigs' script that will kill basically everything quite early in the shutdown phase and zed is/should be stopped much later than that. We don't want zed to be among the ones killed, so add the zed pid to list of pids for 'sendsigs' to ignore. * CentOS uses echo_success() and echo_failure() to print out status of command. These in turn uses "echo -n \0xx[etc]" to move cursor and choose colour etc. This doesn't work with the modified IFS variable we need to use in zfs-import for some reason, so work around that when we define zfs_log_{end,failure}_msg() for RedHat and derivative distributions. * All scripts passes ShellCheck (with one false positive in do_mount()). Signed-off-by: Turbo Fredriksson [email protected] Signed-off-by: Brian Behlendorf <[email protected]> Reviewed by: Richard Yao <[email protected]> Reviewed by: Chris Dunlap <[email protected]> Closes #2974 Closes #2107
* Rebuild init scripts on source file updatesDHE2015-04-141-1/+1
| | | | | | | | | | The resulting script is not removed by 'make clean' or rebuilt when the source files are changed. Users with long standing git trees may find their init script is out of date. Signed-off-by: DHE <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3273
* Actually source /etc/sysconfig/zfs instead of /etc/default/zfsHajo Möller2015-03-091-1/+1
| | | | | | Signed-off-by: Hajo M<C3><B6>ller <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3162
* Add ZED to zfs.redhat.in scriptChris Dunlap2015-03-052-0/+7
| | | | | | | | This commit updates the zfs.redhat.in script to start/stop ZED. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #3153
* Replace zfs.redhat.in with zfs.lsb.in init scriptBrian Behlendorf2015-03-041-104/+73
| | | | | | | | | | | | | | | | | | | | | | | | | This commit replaces the zfs.redhat.in init script with a slightly modified version of the existing zfs.lsb.in init script. This was done to minimize the functional differences between platforms. The lsb version of the script was choosen because it's heavily tested and provides the most functionality. Changes made for RHEL systems: * Configuration: /etc/default/zfs -> /etc/sysconfig/zfs * LSB functions: /lib/lsb/init-functions -> /etc/rc.d/init.d/functions * Logging: log_begin_msg/log_end_msg -> action Features in LSB which are now in RHEL: * USE_DISK_BY_ID=0 - Use the by-id names * VERBOSE_MOUNT=0 - Verbose mounts by default * DO_OVERLAY_MOUNTS=0 - Overlay mounts by default * MOUNT_EXTRA_OPTIONS=0 - Generic extra options Existing RHEL features which were removed: * Automatically mounting FSs on ZVOLs listed in /etc/fstab Signed-off-by: Brian Behlendorf <[email protected]> Issue #3153
* Do not export pool to prevent cache from been removedDerek Dai2014-06-051-7/+0
| | | | | | | Signed-off-by: Derek Dai <[email protected]> Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2353
* Remove SELinux enforcing check from init scriptsBrian Behlendorf2014-05-023-20/+0
| | | | | | | | | | | | | | The default SELinux policy for RHEL and Fedora has been updated to include ZFS in the list of filesystems which support xattrs. Therefore, there's no longer a need to detect this in the init scripts. References: https://bugzilla.redhat.com/show_bug.cgi?id=811532 https://bugzilla.redhat.com/show_bug.cgi?id=816543 Signed-off-by: Brian Behlendorf <[email protected]> Closes #2166
* Allow specifying '-o <opts>' in defaults/init script.Turbo Fredriksson2014-04-041-1/+2
| | | | | | Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2103
* Support using overlay mounts in defaults/init script.Turbo Fredriksson2014-04-041-1/+6
| | | | | | Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2103
* Inform OpenRC that ZFS uses mtabRichard Yao2014-03-041-0/+1
| | | | | | | | | | | | p_l in #zfsonlinux reported that he had issues mounting filesystems that were resolved by adding rc_need="mtab" to /etc/init.d/zfs. Closer inspection revealed that we do have a race, but it is not clear how this race caused mounting to fail. What is clear is that this race should be fixed, so lets add the proper `use mtab` line to handle it. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2148
* Add UNSHARING of filesystems and EXPORTING poolsTurbo Fredriksson2014-01-071-0/+11
| | | | | | | | | | As a 'stop' action ensure the filesystem is unshared before it is unmounted, just in case. Additionally, export the pool so it may be cleanly imported by a different host. Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2003
* Update init script to allow verbose mountsTurbo Fredriksson2013-12-061-1/+6
| | | | | | | | | | Allow verbose mounts to make is easier to monitor progress when mounting a large number of filesystems. This functionality is disabled by default. Signed-off-by: Brian Behlendorf <[email protected]> Closes #1929
* Update init script to allow /dev/disk/by-id importTurbo Fredriksson2013-12-061-2/+13
| | | | | | | | | | | | Many people prefer to use by-id at import time instead of using the cache file. This can be a much better solution than the cache file in some environments so we're adding some infrastructure to allow it. This functionality is disabled by default. Signed-off-by: Brian Behlendorf <[email protected]> Closes #1929
* Updating init scripts to have more robust greppingMatthew Thode2013-11-085-5/+5
| | | | | | | | | | The previous pattern could accidentally match on things like 'real_root=ZFS=node02-zp00/ROOT/rootfs' due to the 'ZFS=no' substring. Signed-off-by: Matthew Thode <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #1837
* Improve OpenRC init scriptRichard Yao2013-06-181-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current zfs OpenRC script's dependencies cause OpenRC to attempt to unmount ZFS filesystems at shutdown while things were still using them, which would fail. This is a cosmetic issue, but it should still be addressed. It probably does not affect systems where the rootfs is a legacy filesystem, but any system with the rootfs on ZFS needs to run the ZFS init script after the system is ready to shutdown filesystems. OpenRC's shutdown process occurs in the reverse order of the startup process. Therefore running the ZFS shutdown procedure after filesystems are ready to be unmounted requires running the startup procedure before fstab. This patch changes the dependencies of the script to expliclty run before fstab at boot when the rootfs is ZFS and to run after fstab at boot whenever the rootfs is not ZFS. This should cover most use cases. The only cases not covered well by this are systems with legacy root filesystems where people want to configure fstab to mount a non-ZFS filesystem off a zvol and possibly also systems whose pools are stored on network block devices. The former requires that the ZFS script run before fstab, which could cause ZFS datasets to mount too early and appear under the fstab mount points. The latter requires that the ZFS script run after networking starts, which precludes the ability to store any system information on ZFS. An additional OpenRC script could be written to handle non-root pools on network block devices, but that will depend on user demand and developer time. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #1479
* Possibility to disable (not start) zfs at bootup.Turbo Fredriksson2013-04-245-0/+25
| | | | | Signed-off-by: Brian Behlendorf <[email protected]> Issue #1402
* Remove ARCH packagingBrian Behlendorf2013-03-062-64/+1
| | | | | | | | | | | | | | The kernel modules are now available in the Arch User Repository (AUR) via zfs. Since their packaging is maintained and superior to ours it is being removed from the tree. https://wiki.archlinux.org/index.php/ZFS Now that various distributions are picking up the packages we should eventually be able to remove most of this infrastructure. Packaging belongs with the distributions not upstream. Signed-off-by: Brian Behlendorf <[email protected]>
* Remove autotools productsBrian Behlendorf2012-08-271-570/+0
| | | | | | | | Remove all of the generated autotools products from the repository and update the .gitignore files accordingly. Signed-off-by: Brian Behlendorf <[email protected]> Closes #718
* Set zvol discard_granularity to the volblocksize.Etienne Dechamps2012-08-071-0/+1
| | | | | | | | | | | | | | | | | | Currently, zvols have a discard granularity set to 0, which suggests to the upper layer that discard requests of arbirarily small size and alignment can be made efficiently. In practice however, ZFS does not handle unaligned discard requests efficiently: indeed, it is unable to free a part of a block. It will write zeros to the specified range instead, which is both useless and inefficient (see dnode_free_range). With this patch, zvol block devices expose volblocksize as their discard granularity, so the upper layer is aware that it's not supposed to send discard requests smaller than volblocksize. Signed-off-by: Brian Behlendorf <[email protected]> Closes #862
* Linux 3.5 compat, end_writeback() changed to clear_inode()Richard Yao2012-07-231-0/+1
| | | | | | | | | | | | | | | | The end_writeback() function was changed by moving the call to inode_sync_wait() earlier in to evict(). This effecitvely changes the ordering of the sync but it does not impact the details of the zfs implementation. However, as part of this change end_writeback() was renamed to clear_inode() to reflect the new semantics. This change does impact us and clear_inode() now maps to end_writeback() for kernels prior to 3.5. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #784
* Linux 3.5 compat, iops->truncate_range() removedRichard Yao2012-07-231-0/+1
| | | | | | | | | The vmtruncate_range() support has been removed from the kernel in favor of using the fallocate method in the file_operations table. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #784
* Linux 3.5 compat, eops->encode_fh() takes inodesRichard Yao2012-07-231-0/+1
| | | | | | | | | | | | | | The export_operations member ->encode_fh() has been updated to take both the child and parent inodes. This interface used to take the child dentry and a bool describing if the parent is needed. NOTE: While updating this code I noticed that we do not currently cleanly handle the case where we're passed a connectable parent. This code should be audited to make sure we're doing the right thing. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #784
* Move partition scanning from userspace to module.Etienne Dechamps2012-07-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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
* Linux 3.4 compat, d_make_root() replaces d_alloc_root()Richard Yao2012-06-111-0/+1
| | | | | | | | | | | | | | | | | | | | 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
* Linux 3.3 compat, iops->create()/mkdir()/mknod()Brian Behlendorf2012-04-301-0/+1
| | | | | | | | | | 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
* Make Gentoo initscript use modinfoRichard Yao2012-04-031-1/+1
| | | | | | | | | The -l parameter to modprobe has been removed from the latest upstream code and this change has entered Gentoo. Using modinfo as a substitute addresses this. Signed-off-by: Brian Behlendorf <[email protected]> Closes #636