summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* 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: 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
* libzfs: refresh property cache after inheriting userpropнаб2021-04-191-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-191-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-191-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
* linux/libspl: getextmntent(): don't leak mnttab FILE*наб2021-04-141-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-141-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-141-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
* Improvements to the 'compatibility' propertyColm2021-04-143-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-141-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-1421-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-144-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-141-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-141-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-141-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-071-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-071-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-073-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-072-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
* Better zfs_get_enclosure_sysfs_path() enclosure supportTony Hutter2021-02-201-110/+142
| | | | | | | | | | | | | | | | | | | | | A multpathed disk will have several 'underlying' paths to the disk. For example, multipath disk 'dm-0' may be made up of paths: /dev/{sda,sdb,sdc,sdd}. On many enclosures those underlying sysfs paths will have a symlink back to their enclosure device entry (like 'enclosure_device0/slot1'). This is used by the statechange-led.sh script to set/clear the fault LED for a disk, and by 'zpool status -c'. However, on some enclosures, those underlying paths may not all have symlinks back to the enclosure device. Maybe only two out of four of them might. This patch updates zfs_get_enclosure_sysfs_path() to favor returning paths that have symlinks back to their enclosure devices, rather than just returning the first path. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #11617
* libzpool: set_global_var: refactor to not modify 'arg'Christian Schwarz2021-02-191-18/+54
| | | | | | | | | | Also fixes leak of the dlopen handle in the error case. Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Pavel Zakharov <[email protected]> Signed-off-by: Christian Schwarz <[email protected]> Closes #11602
* libzpool: set_global_var: fix endianness handling (fixes zdb -o )Christian Schwarz2021-02-191-1/+1
| | | | | | | | | | | | | | Without this patch I get the error Setting global variables is only supported on little-endian systems when using `zdb -o` on my amd64 machine. Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Pavel Zakharov <[email protected]> Signed-off-by: Christian Schwarz <[email protected]> Closes #11602
* Restore FreeBSD resource usage accountingRyan Moeller2021-02-191-0/+1
| | | | | | | Add zfs_racct_* interfaces for platform-dependent read/write accounting. Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #11613
* Add "compatibility" property for zpool feature setsColm2021-02-174-2783/+4411
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Property to allow sets of features to be specified; for compatibility with specific versions / releases / external systems. Influences the behavior of 'zpool upgrade' and 'zpool create'. Initial man page changes and test cases included. Brief synopsis: zpool create -o compatibility=off|legacy|file[,file...] pool vdev... compatibility = off : disable compatibility mode (enable all features) compatibility = legacy : request that no features be enabled compatibility = file[,file...] : read features from specified files. Only features present in *all* files will be enabled on the resulting pool. Filenames may be absolute, or relative to /etc/zfs/compatibility.d or /usr/share/zfs/compatibility.d (/etc checked first). Only affects zpool create, zpool upgrade and zpool status. ABI changes in libzfs: * New function "zpool_load_compat" to load and parse compat sets. * Add "zpool_compat_status_t" typedef for compatibility parse status. * Add ZPOOL_PROP_COMPATIBILITY to the pool properties enum * Add ZPOOL_STATUS_COMPATIBILITY_ERR to the pool status enum An initial set of base compatibility sets are included in cmd/zpool/compatibility.d, and the Makefile for cmd/zpool is modified to install these in $pkgdatadir/compatibility.d and to create symbolic links to a reasonable set of aliases. Reviewed-by: ericloewe Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Colm Buckley <[email protected]> Closes #11468
* Fix a resource leak in uu_avl_pool_destroyAlan Somers2021-01-261-0/+1
| | | | | | | | | | | | Need to destroy the pthread mutex created in uu_avl_pool_create. https://svnweb.freebsd.org/base?view=revision&revision=262912 Obtained from: FreeBSD Sponsored by: Spectra Logic Corporation Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Alan Somers <[email protected]> Closes #11528
* cppcheck: integrete cppcheckBrian Behlendorf2021-01-2616-6/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order for cppcheck to perform a proper analysis it needs to be aware of how the sources are compiled (source files, include paths/files, extra defines, etc). All the needed information is available from the Makefiles and can be leveraged with a generic cppcheck Makefile target. So let's add one. Additional minor changes: * Removing the cppcheck-suppressions.txt file. With cppcheck 2.3 and these changes it appears to no longer be needed. Some inline suppressions were also removed since they appear not to be needed. We can add them back if it turns out they're needed for older versions of cppcheck. * Added the ax_count_cpus m4 macro to detect at configure time how many processors are available in order to run multiple cppcheck jobs. This value is also now used as a replacement for nproc when executing the kernel interface checks. * "PHONY =" line moved in to the Rules.am file which is included at the top of all Makefile.am's. This is just convenient becase it allows us to use the += syntax to add phony targets. * One upside of this integration worth mentioning is it now allows `make cppcheck` to be run in any directory to check that subtree. * For the moment, cppcheck is not run against the FreeBSD specific kernel sources. The cppcheck-FreeBSD target will need to be implemented and testing on FreeBSD to support this. Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11508
* cppcheck: resolve double freeBrian Behlendorf2021-01-261-0/+1
| | | | | | | | | | | | The double free reported for the realloc() failure branch is a false positive. It should be resolved in cppcheck 2.4 but for the benefit of older versions we supress the warning. https://trac.cppcheck.net/ticket/9292 Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11508
* Speed up "zpool import" in the presence of many zvolsAlan Somers2021-01-241-5/+15
| | | | | | | | | | | | | | | | | | | | | By default, FreeBSD does not allow zpools to be backed by zvols (that can be changed with the "vfs.zfs.vol.recursive" sysctl). When that sysctl is set to 0, the kernel does not attempt to read zvols when looking for vdevs. But the zpool command still does. This change brings the zpool command into line with the kernel's behavior. It speeds "zpool import" when an already imported pool has many zvols, or a zvol with many snapshots. https://svnweb.freebsd.org/base?view=revision&revision=357235 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=241083 https://reviews.freebsd.org/D22077 Obtained from: FreeBSD Reported by: Martin Birgmeier <[email protected]> Sponsored by: Axcient Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Alan Somers <[email protected]> Closes #11502
* FreeBSD: fix HEAD build, conditionally remove FDSYNC definesMatt Macy2021-01-234-0/+76
| | | | | | | Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #11458
* Only add supported features during pool creationBrian Behlendorf2021-01-221-3/+48
| | | | | | | | | | | When creating a pool only features supported by both user and kernel space should be enabled. Furthermore, improve the error messages when attempting to create, or add, a dRAID vdev when the dRAID feature is not supported by the kernel modules. Reviewed-by: Mark Maybee <[email protected]> Reviewed-by: Matthew Ahrens <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11492
* zpool: speed up importing large pools (#11469)Alan Somers2021-01-211-1/+1
| | | | | | | | | | | | | | | | | The ZFS_IOC_POOL_TRYIMPORT ioctl returns an nvlist from the kernel to a preallocated buffer in userland. Userland must guess how large the buffer should be. If it undersizes it, it must reallocate and try again. That can cost a lot of time for large pools. OpenZFS commit 28b40c8a6e3 set the guess at "zc.zc_nvlist_conf_size * 4" without explanation. On my system, that is too small. From experiment, x 32 is a better multiplier. But I don't know how to calculate it theoretically. Sponsored by: Axcient Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alek Pinchuk <[email protected]> Signed-off-by: Alan Somers <[email protected]> Closes #11469
* libzutil: optimize zpool_read_label with AIOAlan Somers2021-01-212-11/+45
| | | | | | | | | | | | | | | Read all labels in parallel instead of sequentially. Originally committed as https://cgit.freebsd.org/src/commit/?id=b49e9abcf44cafaf5cfad7029c9a6adbb28346e8 Obtained from: FreeBSD Sponsored by: Spectra Logic, Axcient Reviewed-by: Jorgen Lundman <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alek Pinchuk <[email protected]> Signed-off-by: Alan Somers <[email protected]> Closes #11467
* libzutil: don't read extraneous data in zpool_read_labelAlan Somers2021-01-211-5/+6
| | | | | | | | | | | | | | | | | | zpool_read_label doesn't need the full labels including uberblocks. It only needs the vdev_phys_t. This reduces by half the amount of data read to check for a label, speeding up "zpool import", "zpool labelclear", etc. Originally committed as https://cgit.freebsd.org/src/commit/?id=63f8025d6acab1b334373ddd33f940a69b3b54cc Obtained from: FreeBSD Sponsored by: Spectra Logic Corp, Axcient Reviewed-by: Jorgen Lundman <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alek Pinchuk <[email protected]> Signed-off-by: Alan Somers <[email protected]> Closes #11467
* Extending FreeBSD UIO StructBrian Atkinson2021-01-201-22/+22
| | | | | | | | | | | | | | In FreeBSD the struct uio was just a typedef to uio_t. In order to extend this struct, outside of the definition for the struct uio, the struct uio has been embedded inside of a uio_t struct. Also renamed all the uio_* interfaces to be zfs_uio_* to make it clear this is a ZFS interface. Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Jorgen Lundman <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Brian Atkinson <[email protected]> Closes #11438
* libzfs_sendrecv: Use fnv* to verify nvlist/nvpair*Ryan Moeller2021-01-141-110/+95
| | | | | | | | Use verified variants of nvlist/nvpair functions where applicable. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Matthew Ahrens <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #11460
* nvlist leaked in zpool_find_config()Matthew Ahrens2020-12-281-3/+4
| | | | | | | | | | | | | | | | | In `zpool_find_config()`, the `pools` nvlist is leaked. Part of it (a sub-nvlist) is returned in `*configp`, but the callers also leak that. Additionally, in `zdb.c:main()`, the `searchdirs` is leaked. The leaks were detected by ASAN (`configure --enable-asan`). This commit resolves the leaks. Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matthew Ahrens <[email protected]> Closes #11396
* Linux 5.10 compat: use iov_iter in uio structureBrian Behlendorf2020-12-183-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of the 5.10 kernel the generic splice compatibility code has been removed. All filesystems are now responsible for registering a ->splice_read and ->splice_write callback to support this operation. The good news is the VFS provided generic_file_splice_read() and iter_file_splice_write() callbacks can be used provided the ->iter_read and ->iter_write callback support pipes. However, this is currently not the case and only iovecs and bvecs (not pipes) are ever attached to the uio structure. This commit changes that by allowing full iov_iter structures to be attached to uios. Ever since the 4.9 kernel the iov_iter structure has supported iovecs, kvecs, bvevs, and pipes so it's desirable to pass the entire thing when possible. In conjunction with this the uio helper functions (i.e uiomove(), uiocopy(), etc) have been updated to understand the new UIO_ITER type. Note that using the kernel provided uio_iter interfaces allowed the existing Linux specific uio handling code to be simplified. When there's no longer a need to support kernel's older than 4.9, then it will be possible to remove the iovec and bvec members from the uio structure and always use a uio_iter. Until then we need to maintain all of the existing types for older kernels. Some additional refactoring and cleanup was included in this change: - Added checks to configure to detect available iov_iter interfaces. Some are available all the way back to the 3.10 kernel and are used when available. In particular, uio_prefaultpages() now always uses iov_iter_fault_in_readable() which is available for all supported kernels. - The unused UIO_USERISPACE type has been removed. It is no longer needed now that the uio_seg enum is platform specific. - Moved zfs_uio.c from the zcommon.ko module to the Linux specific platform code for the zfs.ko module. This gets it out of libzfs where it was never needed and keeps this Linux specific code out of the common sources. - Removed unnecessary O_APPEND handling from zfs_iter_write(), this is redundant and O_APPEND is already handled in zfs_write(); Reviewed-by: Colin Ian King <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11351
* FreeBSD libzfs: gcc requires __thread after staticRyan Libby2020-12-141-1/+1
| | | | | | | | | | | | Building libzfs with gcc on FreeBSD failed because gcc is picky about the order of keywords in declarations with __thread, whereas clang is more relaxed. https://gcc.gnu.org/onlinedocs/gcc/Thread-Local.html Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Ryan Libby <[email protected]> Closes #11331
* zpool: Dryrun fails to list some devicesAttila Fülöp2020-12-041-1/+23
| | | | | | | | | | | | `zpool create -n` fails to list cache and spare vdevs. `zpool add -n` fails to list spare devices. `zpool split -n` fails to list `special` and `dedup` labels. `zpool add -n` and `zpool split -n` shouldn't list hole devices. Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Attila Fülöp <[email protected]> Closes #11122 Closes #11167
* libzfsbootenv: do not depend on libnvpairAntonio Russo2020-11-221-1/+1
| | | | | | | | | We do not build libnvpair.pc. Moreover, it is automatically pulled in by libzfs.pc, so no additional specific dependency is required. Reviewed by: Toomas Soome <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Antonio Russo <[email protected]> Closes #11227
* Include the ABI with dist tarballBrian Behlendorf2020-11-215-1/+16
| | | | | | | The ABI should be included when generating the `make dist` tarball since it's required by the `make checkabi` target. Signed-off-by: Brian Behlendorf <[email protected]> Closes #11225
* Add ABI snapshotBrian Behlendorf2020-11-175-0/+12324
| | | | | | | | | | | | Add a snapshot of the current ABI using libabigail-1.7-2. The included ABI passes `make checkabi` for CentOS 7, Fedora 33, Debian 10, and Ubuntu 20.04. This covers a fairly wide range of glibc, gcc, and libabigail versions plus other changes which are platform specific. Reviewed-by: Antonio Russo <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11144