aboutsummaryrefslogtreecommitdiffstats
path: root/etc/systemd
Commit message (Collapse)AuthorAgeFilesLines
* systemd: read initconfdirKrzysztof Piecuch2022-02-227-1/+8
| | | | | | | | | | | Systemd units do not read @initconfdir@ but refer to variables defined there, also a minor fixup in zfs-scrub service file. Reviewed-by: Ahelenia Ziemiańska <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Damian Szuberski <[email protected]> Signed-off-by: Krzysztof Piecuch <[email protected]> Closes #12946
* systemd: add weekly and monthly scrub timersGeorgy Yakovlev2021-12-165-1/+43
| | | | | | | | | | | | | | | | Timers can be enabled as follows: systemctl enable [email protected] --now systemctl enable [email protected] --now Each timer will pull in zfs-scrub@${poolname}.service, which is not schedule-specific. Added PERIODIC SCRUB section to zpool-scrub.8. Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Georgy Yakovlev <[email protected]> Closes #12193
* etc/systemd/zfs-mount-generator: serialise, handle keylocation=http[s]://наб2021-11-301-260/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/systemd/zfs-mount-generator: serialise The wins for a relatively normal workload are rather slim: real 0.02119s/0.00985s=2.15029x user 0.02130s/0.00346s=6.15560x sys 0.03858s/0.00643s=6.00062x wall-total 0.014518s/0.005925s=2.45009x wall-init 0.014518s/0.002457s=5.90684x wall-real 0.014518s/0.003467s=4.18668x But this is a big win on machines with a lot of datasets and expensive forks. For example, the gain on a VM on my work laptop with 900+ legacy-mount Docker datasets, the original gains from the C rewrite were only five-fold: real 0.516s/0.102s=5.05882x user 0.237s/0.143s=1.65734x sys 0.287s/0.100s=2.87x And this serial variant gains this back there as well: real 0.102s/0.008s=12.75x user 0.143s/0.007s=20.42857 sys 0.100s/0.001s=100x wall-total 0.09717s/0.00319s=30.40255x wall-init 0.00203s/0.00200s=1.015941x wall-real 0.09513s/0.00118s=80.02043x For a total of real 0.516s/0.008s=64.5x user 0.237s/0.007s=33.85714x sys 0.287s/0.001s=287x Suggested-by: Richard Laager <[email protected]> * etc/systemd/zfs-mount-generator: pull in network for keylocation=https Also simplify RequiresMountsFor= handling Ref: #11956 Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Tony Nguyen <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12138
* systemd: import: expand $ZPOOL_IMPORT_OPTS correctlyнаб2021-06-142-2/+2
| | | | | | | | | | | | | | | | Turns out $ZPOOL_IMPORT_OPTS expands in a shell-like fashion, yielding 'import' '-aN' '-o' 'cachefile=none' for an unset variable, and 'import' '-aN' '-o' 'cachefile=none' 'word1' 'word2' for a white-spaced one, but ${ZPOOL_IMPORT_OPTS} expands like "${Z_I_O}" would in a shell, yielding 'import' '-aN' '-o' 'cachefile=none' '' (empty) and 'import' '-aN' '-o' 'cachefile=none' 'word1 word2' (spaced) Fixes eec5ba113e1d285d445333079a3e8184872ad00a "dracut: 90zfs: respect zfs_force=1 on systemd systems" Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: John Kennedy <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes: #12231
* dracut: 90zfs: respect zfs_force=1 on systemd systemsнаб2021-06-102-2/+2
| | | | | | | | | | On systemd systems provide an environment generator in order to respect the zfs_force=1 kernel command line option. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tony Nguyen <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11403 Closes #12195
* Turn shellcheck into a normal make target. Fix new files it caughtнаб2021-06-011-0/+3
| | | | | | | | | | | This checks every file it checked (and a few more), but explicitly instead of "if it works it works" best-effort (which wasn't that good anyway) Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #10512 Closes #12101
* etc/systemd/zfs-mount-generator: output tweaksнаб2021-05-271-14/+8
| | | | | | | | | | | | | | | | git-diff--w-dirty, but: * zfs-load-key-$DSET.service -> zfs-load-key@$DSET.service * flattened set -eu into other /bin/sh flags * simpler (for 1 2 3 vs while [ counter ]; counter+=1) prompt loop * exec $ZFS where applicable Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: Richard Laager <[email protected]> Reviewed-by: InsanePrawn <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue #11915 Closes #11917
* etc/systemd/zfs-mount-generator: rewrite in Cнаб2021-05-273-477/+1100
| | | | | | | | | | | | | | | | | | | | | | | | A plain rewrite of the shell version, and generates identical units, save for replacing some empty lines with nothing, having fewer meaningless spaces in After=s and different spacing in the lock scripts, for a clean git diff -w This is a gain of anywhere from 0m0.336s vs 0m0.022s (15.27x) to 0m0.202s vs 0m0.006s (33.67x), depending on the hardware, a.k.a. from "absolutely unusable" to "perfectly fine" This also properly deals with canmount=noauto units across multiple pools See PR for detailed timings (of an early version) and diffs Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: Richard Laager <[email protected]> Reviewed-by: InsanePrawn <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue #11915 Closes #11917
* etc/systemd/zfs-mount-generator: don't fail if no cached poolsнаб2021-04-191-0/+1
| | | | | | | | | If $FSLIST exists but is empty, the generator fails with sort: cannot read: '/etc/zfs/zfs-list.cache/*': No such file or directory Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11915
* zfs-import-{cache,scan}: change condition to FileNotEmptyнаб2021-02-052-2/+2
| | | | | | | | | | | | | | | | When all pools are exported ZFS will generate an empty cache file. This will cause the import service to fail, which is sub-optimal, since this means that dracut fails, and it necessary to run `zpool import -a` to boot, delete the file, and regenerate+reinstall the initrd. This resolves the issue by treating an zero-length cache files the same as a missing cache file. This aligns the behavior with that of the `zpool` command itself. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11568
* Verify zfs module loaded before starting servicesBrian Behlendorf2020-11-283-0/+3
| | | | | | | | | Extend the change made in ae12b02 to verify the zfs kernel modules are loaded to the rest of the OpenZFS services. If the modules aren't loaded the neither the share, volume, or and zed services can be started. Signed-off-by: Brian Behlendorf <[email protected]> Closes #11243
* Fix another dependency loopRichard Laager2020-08-281-0/+4
| | | | | | | | | | | | | | | | | | zfs-load-key-DATASET.service was gaining an After=systemd-journald.socket due to its stdout/stderr going to the journal (which is the default). systemd-journald.socket has an After (via RequiresMountsFor=/run/systemd/journal) on -.mount. If the root filesystem is encrypted, -.mount gets an After zfs-load-key-DATASET.service. By setting stdout and stderr to null on the key load services, we avoid this loop. Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: InsanePrawn <[email protected]> Signed-off-by: Richard Laager <[email protected]> Closes #10356 Closes #10388
* Fix a dependency loopRichard Laager2020-08-282-7/+25
| | | | | | | | | | | | | | | | | When generating units with zfs-mount-generator, if the pool is already imported, zfs-import.target is not needed. This avoids a dependency loop on root-on-ZFS systems: systemd-random-seed.service After (via RequiresMountsFor) var-lib.mount After zfs-import.target After zfs-import-{cache,scan}.service After cryptsetup.service After systemd-random-seed.service Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: InsanePrawn <[email protected]> Signed-off-by: Richard Laager <[email protected]> Closes #10388
* Verify zfs module loaded before starting servicesJonathon2020-08-013-3/+3
| | | | | | | | | | | | | | | This is a minor change to the systemd service templates that verifies the zfs kernel module is loaded by the kernel prior to attempting to import any zpool. The services check for the presence of /sys/module/zfs which indicates the zfs is module is loaded. This uses the systemd built-in check ConditionPathIsDirectory. Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Matthew Thode <[email protected]> Signed-off-by: Jonathon Fernyhough <[email protected]> Closes #10663
* Verify zfs module loaded before starting servicesJonathon2020-07-293-0/+3
| | | | | | | | | This is a minor change to the systemd service templates that verifies the zfs kernel module is loaded by the kernel prior to attempting to import any zpool. Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Jonathon Fernyhough <[email protected]> Closes #10627
* Make unloading the key more robustJean-Baptiste Lallement2020-07-191-1/+7
| | | | | | | | | | | | | | The unit was failing instead of stopping if someone manually unloaded the key before stopping the unit (zfs unload-key is failing on an unavailable key). Follow a similar logic than for loading the key, checking for the key status before unloading it. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Richard Laager <[email protected]> Co-authored-by: Didier Roche <[email protected]> Signed-off-by: Didier Roche <[email protected]> Closes #10477
* BindsTo dataset keyload unit to mount associate unitJean-Baptiste Lallement2020-07-191-1/+4
| | | | | | | | | | | | | | | | | | | We need a stronger dependency between the mount unit and its keyload unit when we know that the dataset is encrypted. If the keyload unit fails, Wants= will still try to mount the dataset, which will then fail. It’s better to show that the failure is due to a dependency failing, the keyload unit, by tighting up the dependency. We can do this as we know that we generate both units in the generator and so, it’s not an optional dependency. BindsTo enable as well that if the keyload unit fails at any point, the associated mountpoint will be then unmounted. Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Co-authored-by: Didier Roche <[email protected]> Signed-off-by: Didier Roche <[email protected]> Closes #10477
* Ensure mount unit pilots when its ZFS key is loadedJean-Baptiste Lallement2020-07-191-1/+0
| | | | | | | | | | | | | | | | Drop Before=zfs.mount dependency explicity on generated key-load .service unit. Indeed, the associated mount unit is After=<dataset-key-load>.service. This is thus the mount point which controls at what point it wants to be mounted (Before=zfs-mount.service in stock generator), but this can be an automount point, or triggered by another service. This additional dependency from the key load service is not needed thus. Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Co-authored-by: Didier Roche <[email protected]> Signed-off-by: Didier Roche <[email protected]> Closes #10477
* Centralize variable substitutionArvind Sankar2020-07-142-31/+6
| | | | | | | | | | | | A bunch of places need to edit files to incorporate the configured paths i.e. bindir, sbindir etc. Move this logic into a common file. Create arc_summary by copying arc_summary[23] as appropriate at build time instead of install time. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Arvind Sankar <[email protected]> Closes #10559
* Remove dependency on sharetab file and refactor sharing logicGeorge Wilson2020-07-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | == Motivation and Context The current implementation of 'sharenfs' and 'sharesmb' relies on the use of the sharetab file. The use of this file is os-specific and not required by linux or freebsd. Currently the code must maintain updates to this file which adds complexity and presents a significant performance impact when sharing many datasets. In addition, concurrently running 'zfs sharenfs' command results in missing entries in the sharetab file leading to unexpected failures. == Description This change removes the sharetab logic from the linux and freebsd implementation of 'sharenfs' and 'sharesmb'. It still preserves an os-specific library which contains the logic required for sharing NFS or SMB. The following entry points exist in the vastly simplified libshare library: - sa_enable_share -- shares a dataset but may not commit the change - sa_disable_share -- unshares a dataset but may not commit the change - sa_is_shared -- determine if a dataset is shared - sa_commit_share -- notify NFS/SMB subsystem to commit the shares - sa_validate_shareopts -- determine if sharing options are valid The sa_commit_share entry point is provided as a performance enhancement and is not required. The sa_enable_share/sa_disable_share may commit the share as part of the implementation. Libshare provides a framework for both NFS and SMB but some operating systems may not fully support these protocols or all features of the protocol. NFS Operation: For linux, libshare updates /etc/exports.d/zfs.exports to add and remove shares and then commits the changes by invoking 'exportfs -r'. This file, is automatically read by the kernel NFS implementation which makes for better integration with the NFS systemd service. For FreeBSD, libshare updates /etc/zfs/exports to add and remove shares and then commits the changes by sending a SIGHUP to mountd. SMB Operation: For linux, libshare adds and removes files in /var/lib/samba/usershares by calling the 'net' command directly. There is no need to commit the changes. FreeBSD does not support SMB. == Performance Results To test sharing performance we created a pool with an increasing number of datasets and invoked various zfs actions that would enable and disable sharing. The performance testing was limited to NFS sharing. The following tests were performed on an 8 vCPU system with 128GB and a pool comprised of 4 50GB SSDs: Scale testing: - Share all filesystems in parallel -- zfs sharenfs=on <dataset> & - Unshare all filesystems in parallel -- zfs sharenfs=off <dataset> & Functional testing: - share each filesystem serially -- zfs share -a - unshare each filesystem serially -- zfs unshare -a - reset sharenfs property and unshare -- zfs inherit -r sharenfs <pool> For 'zfs sharenfs=on' scale testing we saw an average reduction in time of 89.43% and for 'zfs sharenfs=off' we saw an average reduction in time of 83.36%. Functional testing also shows a huge improvement: - zfs share -- 97.97% reduction in time - zfs unshare -- 96.47% reduction in time - zfs inhert -r sharenfs -- 99.01% reduction in time Reviewed-by: Matt Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Bryant G. Ly <[email protected]> Signed-off-by: George Wilson <[email protected]> External-Issue: DLPX-68690 Closes #1603 Closes #7692 Closes #7943 Closes #10300
* Fixes for make distArvind Sankar2020-06-262-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduce the usage of EXTRA_DIST. If files are conditionally included in _SOURCES, _HEADERS etc, automake is smart enough to dist all files that could possibly be included, but this does not apply to EXTRA_DIST, resulting in make dist depending on the configuration. Add some files that were missing altogether in various Makefile's. The changes to disted files in this commit (excluding deleted files): +./cmd/zed/agents/README.md +./etc/init.d/README.md +./lib/libspl/os/freebsd/getexecname.c +./lib/libspl/os/freebsd/gethostid.c +./lib/libspl/os/freebsd/getmntany.c +./lib/libspl/os/freebsd/mnttab.c -./lib/libzfs/libzfs_core.pc -./lib/libzfs/libzfs.pc +./lib/libzfs/os/freebsd/libzfs_compat.c +./lib/libzfs/os/freebsd/libzfs_fsshare.c +./lib/libzfs/os/freebsd/libzfs_ioctl_compat.c +./lib/libzfs/os/freebsd/libzfs_zmount.c +./lib/libzutil/os/freebsd/zutil_compat.c +./lib/libzutil/os/freebsd/zutil_device_path_os.c +./lib/libzutil/os/freebsd/zutil_import_os.c +./module/lua/README.zfs +./module/os/linux/spl/README.md +./tests/README.md +./tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_rm_nested.ksh +./tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_encrypted_unloaded.ksh +./tests/zfs-tests/tests/functional/inheritance/README.config +./tests/zfs-tests/tests/functional/inheritance/README.state +./tests/zfs-tests/tests/functional/rsend/rsend_016_neg.ksh +./tests/zfs-tests/tests/perf/fio/sequential_readwrite.fio Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Arvind Sankar <[email protected]> Closes #10501
* Drop unnecessary srcdir pathsArvind Sankar2020-06-242-11/+11
| | | | | | | | | | There's no need to specify the srcdir explicitly in _HEADERS and EXTRA_DIST. Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Arvind Sankar <[email protected]> Closes #10493
* Systemd mount generator: don't fail keyload from file if already loadedInsanePrawn2020-03-091-7/+11
| | | | | | | | | | | | | Previously the generated keyload units for encryption roots with keylocation=file://* didn't contain the code to detect if the key was already loaded and would be marked failed in such situations. Move the code to check whether the key is already loaded from keylocation=prompt handling to general key loading code. Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: InsanePrawn <[email protected]> Closes #10103
* Systemd mount generator: Generate noauto units; add control propertiesInsanePrawn2020-02-141-26/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit refactors the systemd mount generators and makes the following major changes: - The generator now generates units for datasets marked canmount=noauto, too. These units are NOT WantedBy local-fs.target. If there are multiple noauto datasets for a path, no noauto unit will be created. Datasets with canmount=on are prioritized. - Introduces handling of new user properties which are now included in the zfs-list.cache files: - org.openzfs.systemd:requires: List of units to require for this mount unit - org.openzfs.systemd:requires-mounts-for: List of mounts to require by this mount unit - org.openzfs.systemd:before: List of units to order after this mount unit - org.openzfs.systemd:after: List of units to order before this mount unit - org.openzfs.systemd:wanted-by: List of units to add a Wants dependency on this mount unit to - org.openzfs.systemd:required-by: List of units to add a Requires dependency on this mount unit to - org.openzfs.systemd:nofail: Toggles between a wants and a requires dependency. - org.openzfs.systemd:ignore: Do not generate a mount unit for this dataset. Consult the updated man page for detailed documentation. - Restructures and extends the zfs-mount-generator(8) man page with the above properties, information on unit ordering and a license header. Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: InsanePrawn <[email protected]> Closes #9649
* Systemd mount generator: Silence shellcheck warningsInsanePrawn2020-02-141-11/+14
| | | | | | | | | | | | Silences a warning about an intentionally unquoted variable. Fixes a warning caused by strings split across lines by slightly refactoring keyloadcmd. Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: InsanePrawn <[email protected]> Closes #9649
* zfs-mount-generator: Fix escaping for /Richard Laager2020-02-131-1/+1
| | | | | | | | | The correct name for the mount unit for / is "-.mount", not ".mount". Reviewed-by: InsanePrawn <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Co-authored-by: Antonio Russo <[email protected]> Signed-off-by: Richard Laager <[email protected]> Closes #9970
* Order zfs-import-*.service after multipathdRichard Laager2020-01-222-0/+2
| | | | | | | | | | | If someone is using both multipathd and ZFS, they are probably using them together. Ordering the zpool imports after multipathd is ready fixes import issues for multipath configurations. Tested-by: Mike Pastore <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Laager <[email protected]> Closes #9863
* Avoid here-documents in systemd mount generatorlorenz2020-01-071-8/+14
| | | | | | | | | | | | | | | On some systems - openSUSE, for example - there is not yet a writeable temporary file system available, so bash bails out with an error, 'cannot create temp file for here-document: Read-only file system', on the here documents in zfs-mount-generator. The simple fix is to change these into a multi-line echo statement. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-By: Richard Laager <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Lorenz Hüdepohl <[email protected]> Closes #9802
* Fix encryption logic in systemd mount generatorInsanePrawn2019-11-271-50/+57
| | | | | | | | | | | | Previously the generator would skip a dataset if it wasn't mountable by 'zfs mount -a' (legacy/none mountpoint, canmount off/noauto). This also skipped the generation of key-load units for such datasets, breaking the dependency handling for mountable child datasets. Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: InsanePrawn <[email protected]> Closes #9611
* Fix non-absolute path in systemd mount generatorInsanePrawn2019-11-271-1/+1
| | | | | | | | | | Systemd will ignore units that try to execute programs from non-absolute paths. Use hardcoded /bin/sh instead. Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: InsanePrawn <[email protected]> Closes #9611
* Fix small typo in systemd mount generatorInsanePrawn2019-11-271-1/+1
| | | | | | | Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: InsanePrawn <[email protected]> Closes #9611
* Skip loading already loaded keyWitaut Bajaryn2019-11-081-0/+2
| | | | | | | | | | | | | | | Don't ask for the password / try to load the key if the key for the encryptionroot is already loaded. The user might have loaded the key manually or by other means before the scripts get called. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Witaut Bajaryn <[email protected]> Closes #9495 Closes #9529
* Workaround to avoid a race when /var/lib is a persistent datasetDidier Roche2019-10-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If /var/lib is a dataset not under <pool>/ROOT/<root_dataset>, as proposed in the ubuntu root on zfs upstream guide (https://github.com/zfsonlinux/zfs/wiki/Ubuntu-18.04-Root-on-ZFS), we end up with a race where some services, like systemd-random-seed are writing under /var/lib, while zfs-mount is called. zfs mount will then potentially fail because of /var/lib isn't empty and so, can't be mounted. Order those 2 units for now (more may be needed) as we can't declare virtually a provide mount point to match "RequiresMountsFor=/var/lib/systemd/random-seed" from systemd-random-seed.service. The optional generator for zfs 0.8 fixes it, but it's not enabled by default nor necessarily required. Example: - rpool/ROOT/ubuntu (mountpoint = /) - rpool/var/ (mountpoint = /var) - rpool/var/lib (mountpoint = /var/lib) Both zfs-mount.service and systemd-random-seed.service are starting After=systemd-remount-fs.service. zfs-mount.service should be done before local-fs.target while systemd-random-seed.service should finish before sysinit.target (which is a later target). Ideally, we would have a way for zfs mount -a unit to declare all paths or move systemd-random-seed after local-fs.target. Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Didier Roche <[email protected]> Closes #9360
* Restore :: in Makefile.amRyan Moeller2019-08-262-0/+2
| | | | | | | | | | | | The double-colon looked like a typo, but it's actually an obscure feature. Rules with :: may appear multiple times and are run independently of one another in the order they appear. The use of :: for distclean-local was conventional, not accidental. Add comments to indicate the intentional use of double-colon rules. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #9210
* Fix install error introduced by #9089 (#9205)Brian Behlendorf2019-08-221-1/+1
|\ | | | | Signed-off-by: Paul Dagnelie <[email protected]>
| * Fix install error introduced by #9089Paul Dagnelie2019-08-221-1/+1
| | | | | | | | Signed-off-by: Paul Dagnelie <[email protected]>
* | zfs-mount-genrator: dependencies should be space-separatedyshui2019-08-221-1/+1
|/ | | | | | Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Yuxuan Shui <[email protected]> Closes #9174
* initramfs: fixes for (debian) initramfsMichael Niewöhner2019-08-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * contrib/initramfs: include /etc/default/zfs and /etc/zfs/zfs-functions At least debian needs /etc/default/zfs and /etc/zfs/zfs-functions for its initramfs. Include both in build when initramfs is configured. * contrib/initramfs: include 60-zvol.rules and zvol_id Include 60-zvol.rules and zvol_id and set udev as predependency instead of debians zdev. This makes debians additional zdev hook unneeded. * Correct initconfdir substitution for some distros Not every Linux distro is using @sysconfdir@/default but @initconfdir@ which is already determined by configure. Let's use it. * systemd: prevent possible conflict between systemd and sysvinit Systemd will not load a sysvinit service if a unit exists with the same name. This prevents conflicts between sysvinit and systemd. In ZFS there is one sysvinit service that does not have a systemd service but a target counterpart, zfs-import.target. Usually it does not make any sense to install both but it is possisble. Let's prevent any conflict by masking zfs-import.service by default. This does not harm even if init.d/zfs-import does not exist. Reviewed-by: Chris Wedgwood <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Tested-by: Alex Ingram <[email protected]> Tested-by: Dreamcat4 <[email protected]> Signed-off-by: Michael Niewöhner <[email protected]> Closes #7904 Closes #9089
* Race between zfs-share and zfs-mount servicesGeorge Wilson2019-07-281-0/+1
| | | | | | | | | | | | | | | | | | When a system boots the zfs-mount.service and the zfs-share.service can start simultaneously. What may be unclear is that sharing a filesystem will first mount the filesystem if it's not already mounted. This means that both service can race to mount the same fileystem. This race can result in a SEGFAULT or EBUSY conditions. This change explicitly defines the start ordering between the two services such that the zfs-mount.service is solely responsible for mounting filesystems eliminating the race between "zfs mount -a" and "zfs share -a" commands. Reviewed-by: Sebastien Roy <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: George Wilson <[email protected]> Closes #9083
* New service that waits on zvol links to be createdPavel Zakharov2019-07-174-0/+25
| | | | | | | | | | | | | | | | The zfs-volume-wait.service scans existing zvols and waits for their links under /dev to be created. Any service that depends on zvol links to be there should add a dependency on zfs-volumes.target. By default, this target is not enabled. Reviewed-by: Fabian Grünbichler <[email protected]> Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: Richard Laager <[email protected]> Reviewed-by: loli10K <[email protected]> Reviewed-by: John Gallagher <[email protected]> Reviewed-by: George Wilson <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Pavel Zakharov <[email protected]> Closes #8975
* systemd encryption key supportAntonio Russo2019-07-151-2/+52
| | | | | | | | | | | | | | | | | | | | | | Modify zfs-mount-generator to produce a dependency on new zfs-import-key-*.service units, dynamically created at boot to call zfs load-key for the encryption root, before attempting to mount any encrypted datasets. These units are created by zfs-mount-generator, and RequiresMountsFor on the keyfile, if present, or call systemd-ask-password if a passphrase is requested. This patch includes suggestions from @Fabian-Gruenbichler, @ryanjaeb and @rlaager, as well an adaptation of @rlaager's script to retry on incorrect password entry. Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Fabian Grünbichler <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Antonio Russo <[email protected]> Closes #8750 Closes #8848
* Fix zfs-mount-generator for datasets with spacesAntonio Russo2019-05-071-6/+11
| | | | | | | | | | | | | | | | Alternative implementation of @rlaager's original modification of zfs-mount-generator fix, with @chrisrd's comments. Set IFS to be only the tab character, matching our `-H` call in `zfs list`, allowing spaces to appear in dataset names (and mountpoints). Also adds comments explaining our rationale. Reviewed-by: Chris Dunlop <[email protected]> Reviewed-by: Richard Laager <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Antonio Russo <[email protected]> Closes #8708 Closes #8718
* Move dracut specifics to dracut moduleMichael Niewöhner2019-04-022-2/+0
| | | | | | | | | | | | Dracut depends on the environment variable BOOTFS to be set after pool import. This dracut specific systemd ExecStartPost command should not be called for any non-dracut systems, so let's move it to a static systemd unit that. Reviewed-by: Manuel Amador (Rudd-O) <[email protected]> Reviewed-by: Matthew Thode <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Michael Niewöhner <[email protected]> Closes #8510
* Fix systemd-import servicesMichael Niewöhner2019-03-292-2/+2
| | | | | | | | | | | | | | | | On debian, systemd complains about missing /bin/awk because it actually is located at /usr/bin/awk. It is not a good idea to hardcode binary paths because different linux distros use different paths. According to systemd's man page it is absolutely safe to miss paths for binaries located at standard locations (/bin, /sbin, /usr/bin, ...). Further, replace this more or less complicated awk command by grep. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Michael Niewöhner <[email protected]> Issue #8510
* Remove hard dependency on bashMichael Niewöhner2019-03-292-2/+2
| | | | | | | | | | zfs-import-* services have a hard dependency on bash while not everyone has bash installed. At this point /bin/sh is sufficient, so use that. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Michael Niewöhner <[email protected]> Issue #8510
* ZFS mounted NFSv3 shares fail lock reclaimsDon Brady2019-02-151-0/+1
| | | | | | | | | | ZFS NFS shares mounted on a client with NFSv3 and with open locks will fail to reclaim those locks after a server reboot. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Wilson <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Don Brady <[email protected]> Closes #8398
* Minor documentation, logging, and testing typosAntonio Russo2018-06-071-9/+9
| | | | | | | | | This patch collects some minor inconsistencies and typos in the documentation, logging and testing infrastructure. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Antonio Russo <[email protected]> Closes #7608
* Add canonical mount options zfs-mount-generatorAntonio Russo2018-05-111-14/+99
| | | | | | | | | | | | | | | | | | lib/libzfs/libzfs_mount.c:zfs_add_options provides the canonical mount options used by a `zfs mount` command. Because we cannot call `zfs mount` directly from a systemd.mount unit, we mirror that logic in zfs-mount-generator. The zed script is updated to cache these properties as well. Include a mini-tutorial in the manual page, properly substitute configuration paths in zfs-mount-generator.8.in, and standardize the Makefile. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Antonio Russo <[email protected]> Closes #7453
* systemd mount generator and tracking ZEDLETAntonio Russo2018-04-064-1/+132
| | | | | | | | | | | | | | | | | | | | | | | | zfs-mount-generator implements the "systemd generator" protocol, producing systemd.mount units from the cached outputs of zfs list, during early boot, integrating with systemd. Each pool has an indpendent cache of the command zfs list -H -oname,mountpoint,canmount -tfilesystem -r $pool which is kept synchronized by the ZEDLET history_event-zfs-list-cacher.sh Datasets not in the cache will be loaded later in the boot process by zfs-mount.service, including pools without a cache. Among other things, this allows for complex mount hierarchies. Reviewed-by: Fabian Grünbichler <[email protected]> Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Antonio Russo <[email protected]> Closes #7329
* Add kernel module auto-loadingBrian Behlendorf2018-03-133-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Historically a dynamic misc minor number was registered for the /dev/zfs device in order to prevent minor number collisions. This was fine but it prevented us from being able to use the kernel module auto-loaded which requires a known reserved value. Resolve this issue by adding a configure test to find an available misc minor number which can then be used in MODULE_ALIAS_MISCDEV at build time. By adding this alias the zfs kmod is added to the list of known static-nodes and the systemd-tmpfiles-setup-dev service will create a /dev/zfs character device at boot time. This in turn allows us to update the 90-zfs.rules file to make it aware this is a static node. The upshot of this is that whenever a process (zpool, zfs, zed) opens the /dev/zfs the kmods will be automatic loaded. This even works for unprivileged users so there is no longer a need to manually load the modules at boot time. As an additional bonus the zed now no longer needs to start after the zfs-import.service since it will trigger the module load. In the unlikely event the minor number we selected conflicts with another out of tree unregistered minor number the code falls back to dynamically allocating it. In this case the modules again must be manually loaded. Note that due to the change in the method of registering the minor number the zimport.sh test case may incorrectly fail when the static node for the installed packages is created instead of the dynamic one. This issue will only transiently impact zimport.sh for this single commit when we transition and are mixing and matching methods. Reviewed-by: Fabian Grünbichler <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> TEST_ZIMPORT_SKIP="yes" Closes #7287