aboutsummaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* libzfs: run_process: don't leak fd on reopen failureнаб2021-05-211-1/+3
| | | | | | | Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12082
* libzfs: run_process: reuse line, don't leak itнаб2021-05-211-13/+10
| | | | | | | | | | line will grow as wide as it needs (glibc starts off at 120), we can store a narrower view; this also fixes leaks in a few scenarios Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12082
* libzfs: run_process: set O_NONBLOCK on lines pipeнаб2021-05-211-2/+3
| | | | | | | | | | | | | | | | | | Without this, we can deadlock: the child is stuck writing to the pipe, and we are stuck waiting on the child With this, we the child fills up the pipe (a few hundred kBish) and starts getting EAGAINs, which allows it to either crash or ignore them libzfs_run_process_get_stdout*() is used only by zpool -c scripts, which output short runs of K=V pairs, so the likelihood of losing legitimate data there is relatively low Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12082
* FreeBSD: Don't force xattr mount optionRyan Moeller2021-05-131-5/+0
| | | | | | | | | | The kernel will use the xattr property by default when not overridden by a mount option. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #11997
* libzfs: add keylocation=https://, backed by fetch(3) or libcurlнаб2021-05-124-4215/+6609
| | | | | | | | | | | Add support for http and https to the keylocation properly to allow encryption keys to be fetched from the specified URL. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue #9543 Closes #9947 Closes #11956
* libzfs: zfs_asprintf(): don't return undefined pointerнаб2021-05-081-1/+3
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11993
* libzfsbootenv: lzbe_set_boot_device(): don't free undefined pointerнаб2021-05-081-4/+3
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11993
* zfs_get_enclosure_sysfs_path(): don't free undefined pointerнаб2021-05-081-2/+3
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11993
* zfs_get_enclosure_sysfs_path(): don't leak dev pathнаб2021-05-081-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also always free tmp2 at the end Before: nabijaczleweli@tarta:~/uwu$ valgrind --leak-check=full ./blergh ==8947== Memcheck, a memory error detector ==8947== Using Valgrind-3.14.0 and LibVEX ==8947== Command: ./blergh ==8947== (null) ==8947== ==8947== HEAP SUMMARY: ==8947== in use at exit: 23 bytes in 1 blocks ==8947== total heap usage: 3 allocs, 2 frees, 1,147 bytes allocated ==8947== ==8947== 23 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==8947== at 0x483577F: malloc (vg_replace_malloc.c:299) ==8947== by 0x48D74B7: vasprintf (vasprintf.c:73) ==8947== by 0x48B7833: asprintf (asprintf.c:35) ==8947== by 0x401258: zfs_get_enclosure_sysfs_path (zutil_device_path_os.c:191) ==8947== by 0x401482: main (blergh.c:107) ==8947== ==8947== LEAK SUMMARY: ==8947== definitely lost: 23 bytes in 1 blocks ==8947== indirectly lost: 0 bytes in 0 blocks ==8947== possibly lost: 0 bytes in 0 blocks ==8947== still reachable: 0 bytes in 0 blocks ==8947== suppressed: 0 bytes in 0 blocks ==8947== ==8947== For counts of detected and suppressed errors, rerun with: -v ==8947== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) nabijaczleweli@tarta:~/uwu$ sed -n 191p zutil_device_path_os.c tmpsize = asprintf(&tmp1, "/sys/block/%s/device", dev_name); After: nabijaczleweli@tarta:~/uwu$ valgrind --leak-check=full ./blergh ==9512== Memcheck, a memory error detector ==9512== Using Valgrind-3.14.0 and LibVEX ==9512== Command: ./blergh ==9512== (null) ==9512== ==9512== HEAP SUMMARY: ==9512== in use at exit: 0 bytes in 0 blocks ==9512== total heap usage: 3 allocs, 3 frees, 1,147 bytes allocated ==9512== ==9512== All heap blocks were freed -- no leaks are possible ==9512== ==9512== For counts of detected and suppressed errors, rerun with: -v ==9512== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11993
* libzfs: zpool_load_compat(): don't free undefined pointersнаб2021-05-081-4/+8
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11993
* libzfs: zpool_load_compat(): open feature file cloexecнаб2021-05-081-8/+10
| | | | | | | | | | | As a bonus, this also passes the open flags into the open flags instead of the mode (it worked by accident because O_RDONLY is 0), correctly detects a failed map, and prefaults the entire file since we're always writing to every page Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11993
* undocumented libzfs API changes broke "zfs list"Matthew Ahrens2021-05-064-16/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While OpenZFS does permit breaking changes to the libzfs API, we should avoid these changes when reasonably possible, and take steps to mitigate the impact to consumers when changes are necessary. Commit e4288a8397bb1f made a libzfs API change that is especially difficult for consumers because there is no change to the function signatures, only to their behavior. Therefore, consumers can't notice that there was a change at compile time. Also, the API change was incompletely and incorrectly documented. The commit message mentions `zfs_get_prop()` [sic], but all callers of `get_numeric_property()` are impacted: `zfs_prop_get()`, `zfs_prop_get_numeric()`, and `zfs_prop_get_int()`. `zfs_prop_get_int()` always calls `get_numeric_property(src=NULL)`, so it assumes that the filesystem is not mounted. This means that e.g. `zfs_prop_get_int(ZFS_PROP_MOUNTED)` always returns 0. The documentation says that to preserve the previous behavior, callers should initialize `*src=ZPROP_SRC_NONE`, and some callers were changed to do that. However, the existing behavior is actually preserved by initializing `*src=ZPROP_SRC_ALL`, not `NONE`. The code comment above `zfs_prop_get()` says, "src: ... NULL will be treated as ZPROP_SRC_ALL.". However, the code actually treats NULL as ZPROP_SRC_NONE. i.e. `zfs_prop_get(src=NULL)` assumes that the filesystem is not mounted. There are several existing calls which use `src=NULL` which are impacted by the API change, most noticeably those used by `zfs list`, which now assumes that filesystems are not mounted. For example, `zfs list -o name,mounted` previously indicated whether a filesystem was mounted or not, but now it always (incorrectly) indicates that the filesystem is not mounted (`MOUNTED: no`). Similarly, properties that are set at mount time are ignored. E.g. `zfs list -o name,atime` may display an incorrect value if it was set at mount time. To address these problems, this commit reverts commit e4288a8397bb1f: "zfs get: don't lookup mount options when using "-s local"" Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matthew Ahrens <[email protected]> Closes #11999
* libzutil: fix dm_get_underlying_path() return if not a DM deviceнаб2021-04-301-1/+1
| | | | | | | | For example, this would happily return "/dev/(null)" for /dev/sda1 Reviewed-by: Tony Hutter <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11935
* zfs get: don't lookup mount options when using "-s local"Alan Somers2021-04-294-11/+16
| | | | | | | | | | | | | | | Looking up mount options can be very expensive on servers with many mounted file systems. When doing "zfs get" with any "-s" option that does not include "temporary", the mount list will never be used. This commit optimizes for that case. This is a breaking commit for libzfs! Callers of zfs_get_prop are now required to initialize src. To preserve existing behavior, they should initialize it to ZPROP_SRC_NONE. Sponsored by: Axcient Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Alan Somers <[email protected]> Closes #11955
* receive: don't fail inheriting (-x) properties on wrong dataset typePrawn2021-04-261-18/+28
| | | | | | | | | | | | | | | | | | | | | Receiving datasets while blanket inheriting properties like zfs receive -x mountpoint can generally be desirable, e.g. to avoid unexpected mounts on backup hosts. Currently this will fail to receive zvols due to the mountpoint property being applicable to filesystems only. This limitation currently requires operators to special-case their minds and tools for zvols. This change gets rid of this limitation for inherit (-x) by Spiting up the dataset type handling: Warnings for inheriting (-x), errors for overriding (-o). Reviewed-by: Paul Dagnelie <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: InsanePrawn <[email protected]> Closes #11416 Closes #11840 Closes #11864
* libshare: nfs: commonify nfs_enable_share()наб2021-04-194-91/+62
| | | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Wilson <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11886
* freebsd/libshare: nfs: make nfs_is_shared() thread-safeнаб2021-04-191-5/+1
| | | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Wilson <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11886
* libshare: nfs: commonify nfs_{init,fini}_tmpfile(), nfs_disable_share()наб2021-04-195-132/+101
| | | | | | | | | Also open the temp file cloexec Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Wilson <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11886
* libshare: nfs: commonify nfs_exports_[un]lock(), FILE_HEADERнаб2021-04-195-104/+95
| | | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Wilson <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11886
* libshare: nfs: don't leak nfs_lock_fd when lock failsнаб2021-04-192-8/+18
| | | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Wilson <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11886
* libspl: implement atomics in terms of atomicsнаб2021-04-185-1696/+48
| | | | | | | | | | | | | This replaces the generic libspl atomic.c atomics implementation with one based on builtin gcc atomics. This functionality was added as an experimental feature in gcc 4.4. Today even CentOS 7 ships with gcc 4.8 as the default compiler we can make this the default. Furthermore, the builtin atomics are as good or better than our hand-rolled implementation so it's reasonable to drop that custom code. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11904
* libzfs: refresh property cache after inheriting userpropнаб2021-04-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This matches what happens when inheriting a system property Consider the following program: int main() { void *zhp = libzfs_init(); void *dataset = zfs_open(zhp, "zest/__test", 1); printf("before:"); dump_nvlist(zfs_get_user_props(dataset), 2); printf("\n"); zfs_prop_inherit(dataset, "xyz.nabijaczleweli:test", 0); printf("after:"); dump_nvlist(zfs_get_user_props(dataset), 2); printf("\n"); zfs_refresh_properties(dataset); printf("refreshed:"); dump_nvlist(zfs_get_user_props(dataset), 2); printf("\n"); } And the output before: # zfs set xyz.nabijaczleweli:test=hehe zest/__test # ./a.out before: xyz.nabijaczleweli:test: value: 'hehe' source: 'zest/__test' after: xyz.nabijaczleweli:test: value: 'hehe' source: 'zest/__test' refreshed: As compared to the output after: # zfs set xyz.nabijaczleweli:test=hehe zest/__test # ./a.out before: xyz.nabijaczleweli:test: value: 'hehe' source: 'zest/__test' after: refreshed: Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11064 Closes #11911
* libzfs: don't mark prompt+raw as retriableнаб2021-04-171-1/+1
| | | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11911 Closes #11031
* linux/libspl: gethostid: read from /proc/sys/kernel/spl/hostid, simplifyнаб2021-04-151-24/+17
| | | | | | | | | | Fixes get_system_hostid() if it was set via the aforementioned sysctl and simplifies the code a bit. The kernel and user-space must agree, after all. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11879
* libspl: lift common bits of getexecname()наб2021-04-155-72/+99
| | | | | | | | | Merge the actual implementations of getexecname() and slightly clean up the FreeBSD one. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11879
* libzfs: get rid of unused libzfs_handle::libzfs_{storeerr,chassis_id}наб2021-04-131-119/+113
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11868
* libzfs: get rid of libzfs_handle::libzfs_mnttabнаб2021-04-135-2738/+2598
| | | | | | | | | | | | | | All users did a freopen() on it. Even some non-users did! This is point-less ‒ just open the mtab when needed If I understand Solaris' getextmntent(3C) correctly, the non-user freopen()s are very likely an odd, twisted vestigial tail of that ‒ but it's got a completely different calling convention and caching semantics than any platform we support Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11868
* linux/libspl: getextmntent(): don't leak mnttab FILE*наб2021-04-131-0/+1
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11868
* libzfs: zfs_mount_at(): load key for encryption root if MS_CRYPTнаб2021-04-121-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | zfs_crypto_load_key() only works on encryption roots, and zfs mount -la would fail if it encounters a datasets that is sorted before their encroots. To trigger: truncate -s 40G /tmp/test dd if=/dev/urandom of=/tmp/k bs=128 count=1 status=none zpool create -O encryption=on -O keylocation=file:///tmp/k \ -O keyformat=passphrase test /tmp/test zfs create -o mountpoint=/a test/a zfs create -o mountpoint=/b test/b zfs umount test zfs unload-key test zfs mount -la The final mount errored out with: Key load error: Keys must be loaded for encryption root of 'test/a' (test). Key load error: Keys must be loaded for encryption root of 'test/b' (test). And only /test was mounted This technically breaks the libzfs API, but the previous behavior was decidedly a bug. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11870 Closes #11875
* cmd/zfs receive: allow dry-run (-n) to check property argsPrawn2021-04-121-20/+20
| | | | | | | | | | zfs recv -n does not report some errors it could. The code to bail out of the receive if in dry-run mode came a little early, skipping validation of cmdprops (recv -x and -o) among others. Move the check down to enable these additional checks. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: InsanePrawn <[email protected]> Closes #11862
* libuutil: purge unused functionsнаб2021-04-125-1143/+1102
| | | | | | | | | | | | | | | | | | | | | | | | | | | Remove vestigial uu_open_tmp(). The problems with this implementation are many, but the primary one is the TMPPATHFMT macro, which is unused, and always has been. Searching around for any users leads only to earlier imports of the same, identical file, i.a. into an apple repository (which does patch gethrtime() into it and gives us a copyright date of 2007), and a MidnightBSD one from 2008. Searching illumos-gate, uu_open_tmp appears, in current HEAD, three times: in the header, libuutil's mapfile ABI, and the implementation. This slowly grows up to eight occurrences as one moves back to the root "OpenSolaris Launch" commit: the header, implementation, twice in libuutil's spec ABI, twice (with multilib and non-multilib paths) in libuutil.so's i386 and SPARC binary db ABIs. That's 2005, and this file was abandonware even then, it's dead code. The situation is similar for the uu_dprintf() family of functions and uu_dump(). Nothing in accessibly recorded history has ever used them. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11873
* Improvements to the 'compatibility' propertyColm2021-04-123-2673/+2772
| | | | | | | | | | | | | | | | | | | | | | | | | | Several improvements to the operation of the 'compatibility' property: 1) Improved handling of unrecognized features: Change the way unrecognized features in compatibility files are handled. * invalid features in files under /usr/share/zfs/compatibility.d only get a warning (as these may refer to future features not yet in the library), * invalid features in files under /etc/zfs/compatibility.d get an error (as these are presumed to refer to the current system). 2) Improved error reporting from zpool_load_compat. Note: slight ABI change to zpool_load_compat for better error reporting. 3) compatibility=legacy inhibits all 'zpool upgrade' operations. 4) Detect when features are enabled outside current compatibility set * zpool set compatibility=foo <-- print a warning * zpool set feature@xxx=enabled <-- error * zpool status <-- indicate this state Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Colm Buckley <[email protected]> Closes #11861
* Update libzfs.abi for zfs_send() changeBrian Behlendorf2021-04-111-2602/+2537
| | | | | | | | | Commit 099fa7e4 intentionally modified the libzfs ABI. However, it failed to include an update for the libzfs.abi file. This commit resolves the `make checkabi` warning due to that omission. Signed-off-by: Brian Behlendorf <[email protected]> Closes #11710
* lib/: set O_CLOEXEC on all fdsнаб2021-04-1121-60/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As found by git grep -E '(open|setmntent|pipe2?)\(' | grep -vE '((zfs|zpool)_|fd|dl|lzc_re|pidfile_|g_)open\(' FreeBSD's pidfile_open() says nothing about the flags of the files it opens, but we can't do anything about it anyway; the implementation does open all files with O_CLOEXEC Consider this output with zpool.d/media appended with "pid=$$; (ls -l /proc/$pid/fd > /dev/tty)": $ /sbin/zpool iostat -vc media lrwx------ 0 -> /dev/pts/0 l-wx------ 1 -> 'pipe:[3278500]' l-wx------ 2 -> /dev/null lrwx------ 3 -> /dev/zfs lr-x------ 4 -> /proc/31895/mounts lrwx------ 5 -> /dev/zfs lr-x------ 10 -> /usr/lib/zfs-linux/zpool.d/media vs $ ./zpool iostat -vc vendor,upath,iostat,media lrwx------ 0 -> /dev/pts/0 l-wx------ 1 -> 'pipe:[3279887]' l-wx------ 2 -> /dev/null lr-x------ 10 -> /usr/lib/zfs-linux/zpool.d/media Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11866
* libzfs{,_core}: set O_CLOEXEC on persistent (ZFS_DEV and MNTTAB) fdsнаб2021-04-114-7/+7
| | | | | | | | | | | These were fd 3, 4, and 5 by the time zfs change-key hit execute_key_fob() glibc appends "e" to setmntent() mode, but musl's just returns fopen() Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11866
* libzfs: zfs_crypto_create() requires a new key by definition: set newkeyнаб2021-04-111-1/+1
| | | | | | | | | | | | | | | | This changes the password prompt for new encryption roots from Enter passphrase: Re-enter passphrase: to Enter new passphrase: Re-enter new passphrase: which makes more sense and is more consistent with "new passphrase" now always meaning "come up with something" and plain "passphrase" "remember that thing" Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11866
* libzfs_crypto.c: remove unused key_locator enumнаб2021-04-111-6/+0
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11866
* Allow zfs to send replication streams with missing snapshotspablofsf2021-04-111-13/+23
| | | | | | | | | | | | A tentative implementation and discussion was done in #5285. According to it a send --skip-missing|-s flag has been added. In a replication stream, when there are snapshots missing in the hierarchy, if -s is provided print a warning and ignore dataset (and its children) instead of throwing an error Reviewed-by: Paul Dagnelie <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Pablo Correa Gómez <[email protected]> Closes #11710
* zfs get -p only outputs 3 columns if "clones" property is emptymatt-fidd2021-04-061-1/+2
| | | | | | | | | | get_clones_string currently returns an empty string for filesystem snapshots which have no clones. This breaks parsable `zfs get` output as only three columns are output, instead of 4. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matt Fiddaman <[email protected]> Co-authored-by: matt <[email protected]> Closes #11837
* libzutil: zfs_isnumber(): return false if input emptyнаб2021-04-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | zpool list, which is the only user, would mistakenly try to parse the empty string as the interval in this case: $ zpool list "a" cannot open 'a': no such pool $ zpool list "" interval cannot be zero usage: <usage string follows> which is now symmetric with zpool get: $ zpool list "" cannot open '': name must begin with a letter Avoid breaking the "interval cannot be zero" string. There simply isn't a need for this, and it's user-facing. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11841 Closes #11843
* Fix various typosAndrea Gelmini2021-04-023-3/+3
| | | | | | | | | | Correct an assortment of typos throughout the code base. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Andrea Gelmini <[email protected]> Closes #11774
* Bump libzfs.so and libzpool.so versionsBrian Behlendorf2021-04-012-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Bump the library versions as advised by the libtool guidelines. https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html Two new functions were added but no existing functions were changed, so we increase the version and the age (version:revision:age). Added functions (2): - boolean_t zpool_is_draid_spare(const char *); - zpool_compat_status_t zpool_load_compat(const char *, boolean_t *, char *, char *); Additionally bump the libzpool.so version information. This library is for internal use but we still want to update the version to track major changes to the interfaces. The libzfsbootenv, libuutil, libnvpair and libzfs_core libraries have not been updated. Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11817
* When specifying raidz vdev name, parity count should matchMatthew Ahrens2021-03-261-0/+30
| | | | | | | | | | | | | | When specifying the name of a RAIDZ vdev on the command line, it can be specified as raidz-<vdevID> or raidzP-<vdevID>. e.g. `zpool clear poolname raidz-0` or `zpool clear poolname raidz2-0` If the parity is specified in the vdev name, it should match the actual parity of that RAIDZ vdev, otherwise the command should fail. This commit makes it so. Reviewed-by: Brian Behlendorf <[email protected]> Co-authored-by: Stuart Maybee <[email protected]> Signed-off-by: Matthew Ahrens <[email protected]> Closes #11742
* Support running FreeBSD buildworld on Arm-based macOS hostsJessica Clarke2021-03-261-0/+11
| | | | | | | | | Arm-based Macs are like FreeBSD and provide a full 64-bit stat from the start, so have no stat64 variants. Thus, define stat64 and fstat64 as aliases for the normal versions. Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Jessica Clarke <[email protected]> Closes #11771
* Removed duplicated includesAndrea Gelmini2021-03-226-7/+0
| | | | | | Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Andrea Gelmini <[email protected]> Closes #11775
* zpool import cachefile improvementsGeorge Wilson2021-03-121-36/+141
| | | | | | | | | | | | | | | | | | | | | | | Importing a pool using the cachefile is ideal to reduce the time required to import a pool. However, if the devices associated with a pool in the cachefile have changed, then the import would fail. This can easily be corrected by doing a normal import which would then read the pool configuration from the labels. The goal of this change is make importing using a cachefile more resilient and auto-correcting. This is accomplished by having the cachefile import logic automatically fallback to reading the labels of the devices similar to a normal import. The main difference between the fallback logic and a normal import is that the cachefile import logic will only look at the device directories that were originally used when the cachefile was populated. Additionally, the fallback logic will always import by guid to ensure that only the pools in the cachefile would be imported. External-issue: DLPX-71980 Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: George Wilson <[email protected]> Closes #11716
* Return finer grain errors in libzfs unmount_oneDon Brady2021-03-083-6/+30
| | | | | | | | | | Added errno mappings to unmount_one() in libzfs. Changed do_unmount() implementation to return errno errors directly like is done for do_mount() and others. Reviewed-by: Mark Maybee <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Don Brady <[email protected]> Closes #11681
* Don't bomb out when using keylocation=file://James Wah2021-03-031-3/+7
| | | | | | | | Avoid following the error path when the operation in fact succeeded. Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: James Wah <[email protected]> Closes #11651
* Add missing checks for unsupported featuresMartin Matuška2021-02-271-0/+2
| | | | | | | | | | | | | After 35ec517 it has become possible to import ZFS pools witn an active org.illumos:edonr feature on FreeBSD, leading to a panic. In addition, "zpool status" reported all pools without edonr as upgradable and "zpool upgrade -v" reported edonr in the list of upgradable features. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Martin Matuska <[email protected]> Closes #11653
* send_iterate_snap : doall send without fromsnapCedric Maunoury2021-02-241-0/+9
| | | | | | | | | | The behavior of a NULL fromsnap was inadvertently changed for a doall send when the send/recv logic in libzfs was updated. Restore the previous behavior by correcting send_iterate_snap() to include all the snapshots in the nvlist for this case. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Cedric Maunoury <[email protected]> Closes #11608