aboutsummaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Add property overriding (-o|-x) to 'zfs receive'LOLi2017-05-092-26/+263
| | | | | | | | | | | | | | | | | | | | This allows users to specify "-o property=value" to override and "-x property" to exclude properties when receiving a zfs send stream. Both native and user properties can be specified. This is useful when using zfs send/receive for periodic backup/replication because it lets users change properties such as canmount, mountpoint, or compression without modifying the source. References: https://www.illumos.org/issues/2745 https://www.illumos.org/issues/3753 Reviewed by: Matthew Ahrens <[email protected]> Reviewed-by: Alek Pinchuk <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #1350 Closes #5349
* Make createtxg and guid properties publicChristian Schwarz2017-05-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Document the existence of `createtxg` and `guid` native properties in man pages and zfs command output. One of the great features of ZFS is incremental replication of snapshots, possibly between pools on different machines. Shell scripts are commonly used to auomate this procedure. They have to find the most recent common snapshot between both sides and then perform incremental send & recv. Currently, scripts rely on the sorting order of `zfs list`, which defaults to `createtxg`, and the assumption that snapshot names on either side do not change. By making `createtxg` and `guid` part of the public ZFS interface, scripts are enabled to use a) `createtxg` to determine the logical & temporal order of snapshots (the creation property is not an equivalent substitute since multiple snapshots may be created within one second) b) `guid` to uniquely identify a snapshot, independent of its current display name This has the potential of making scripts safer and correct. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: DHE <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Christian Schwarz <[email protected]> Closes #6102
* Fix NULL pointer dereference in 'zfs create'LOLi2017-05-091-1/+3
| | | | | | | | | | | A race condition between 'zpool export' and 'zfs create' can crash the latter: this is because we never check libzfs`zpool_open() return value in libzfs`zfs_create(). Reviewed-by: George Melikov <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #6096
* Linux 4.12 compat: PF_FSTRANS was removedChunwei Chen2017-05-091-1/+1
| | | | | | | | zfsonlinux/spl@8f87971 added __spl_pf_fstrans_check for the xfs related check, so we use them accordingly. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Chunwei Chen <[email protected]> Closes #6113
* More ashift improvementsLOLi2017-05-031-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit allow higher ashift values (up to 16) in 'zpool create' The ashift value was previously limited to 13 (8K block) in b41c990 because the limited number of uberblocks we could fit in the statically sized (128K) vdev label ring buffer could prevent the ability the safely roll back a pool to recover it. Since b02fe35 the largest uberblock size we support is 8K: this allow us to store a minimum number of 16 uberblocks in the vdev label, even with higher ashift values. Additionally change 'ashift' pool property behaviour: if set it will be used as the default hint value in subsequent vdev operations ('zpool add', 'attach' and 'replace'). A custom ashift value can still be specified from the command line, if desired. Finally, fix a bug in add-o_ashift.ksh caused by a missing variable. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #2024 Closes #4205 Closes #4740 Closes #5763
* Add zfs_nicebytes() to print human-readable sizesLOLi2017-05-025-20/+51
| | | | | | | | | | | | | | | | * Add zfs_nicebytes() to print human-readable sizes Some 'zfs', 'zpool' and 'zdb' output strings can be confusing to the user when no units are specified. This add a new zfs_nicenum_format "ZFS_NICENUM_BYTES" used to print bytes in their human-readable form. Additionally, update some test cases to use machine-parsable 'zfs get'. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #2414 Closes #3185 Closes #3594 Closes #6032
* OpenZFS 7252 - compressed zfs send / receiveDan Kimmel2017-04-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OpenZFS 7252 - compressed zfs send / receive OpenZFS 7628 - create long versions of ZFS send / receive options Authored by: Dan Kimmel <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: John Kennedy <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Reviewed by: Pavel Zakharov <[email protected]> Reviewed by: Sebastien Roy <[email protected]> Reviewed by: David Quigley <[email protected]> Reviewed by: Thomas Caputi <[email protected]> Approved by: Dan McDonald <[email protected]> Reviewed by: David Quigley <[email protected]> Reviewed-by: loli10K <[email protected]> Ported-by: bunder2015 <[email protected]> Ported-by: Don Brady <[email protected]> Ported-by: Brian Behlendorf <[email protected]> Porting Notes: - Most of 7252 was already picked up during ABD work. This commit represents the gap from the final commit to openzfs. - Fixed split_large_blocks check in do_dump() - An alternate version of the write_compressible() function was implemented for Linux which does not depend on fio. The behavior of fio differs significantly based on the exact version. - mkholes was replaced with truncate for Linux. OpenZFS-issue: https://www.illumos.org/issues/7252 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/5602294 Closes #6067
* Fixed zdb -e regression for active cacheless poolsDon Brady2017-04-241-2/+7
| | | | | | | | | | | | | | zdb -e for active cache-less pools fails: $ sudo zpool create -o cachefile=none basic mirror sdk sdl $ sudo zdb -e -b basic zdb: can't open 'basic': No such file or directory This is a recent regression introduce by commit c30d8de. Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Don Brady <[email protected]> Closes #6059
* Prebaked scripts for zpool status/iostat -cTony Hutter2017-04-211-4/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch updates the "zpool status/iostat -c" commands to only run "pre-baked" scripts from the /etc/zfs/zpool.d directory (or wherever you install to). The scripts can only be run from -c as an unprivileged user (unless the ZPOOL_SCRIPTS_AS_ROOT environment var is set by root). This was done to encourage scripts to be written is such a way that normal users can use them, and to be cautious. If your script needs to run a privileged command, consider adding the appropriate line in /etc/sudoers. See zpool(8) for an example of how to do this. The patch also allows the scripts to output custom column names. If the script outputs a line like: name=value then "name" is used for the column name, and "value" is its value. Multiple columns can be specified by outputting multiple lines. Column names and values can have spaces. If the value is empty, a dash (-) is printed instead. After all the "name=value" lines are read (if any), zpool will take the next the next line of output (if any) and print it without a column header. After that, no more lines will be processed. This can be useful for printing errors. Lastly, this patch also disables the -c option with the latency and request size histograms, since it produced awkward output and made the code harder to maintain. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #5852
* Fix leak in send_iterate_fsTim Crawford2017-04-191-0/+2
| | | | | | | | | Fix a leak when generating a replication stream of a cloned dataset. Reviewed-by: Matt Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: Tim Crawford <[email protected]> Closes #6034
* Fix header inclusions for standards conformanceRichard Yao2017-04-125-1/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | musl's sys/errno.h is literally: /#warning redirecting incorrect #include <sys/errno.h> to <errno.h> /#include <errno.h> It does the same for sys/{poll,signal}.h. This is rather noisy when building ZoL against musl. musl is also correct in pointing out that the correct headers are outside of sys/ according to the single unix specification: http://pubs.opengroup.org/onlinepubs/7908799/xsh/errno.h.html http://pubs.opengroup.org/onlinepubs/7908799/xsh/poll.h.html http://pubs.opengroup.org/onlinepubs/7908799/xsh/signal.h.html Lets implement our own sys/* versions of these headers to redirect to the proper userland ones when building in userspace. That will silence the warning. There are also some instances where we include incorrectly from sys/ or from outside of sys/ in userspace only code. In these instances, lets just fix the includes directly. Reviewed-by: George Melikov <[email protected]> Reviewed-by: loli10K <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #5993
* Fix `zpool iostat -T d 1` on muslRichard Yao2017-04-121-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | When building on Gentoo against musl, GCC complains: timestamp.c: In function ‘print_timestamp’: timestamp.c:32:19: warning: passing argument 1 of ‘nl_langinfo’ makes integer from pointer without a cast #define _DATE_FMT "%+" ^ timestamp.c:47:21: note: in expansion of macro ‘_DATE_FMT’ fmt = nl_langinfo(_DATE_FMT); ^ The error was wrapped to meet comment style requirements. This code is used by `zpool iostat -T d 1` to print a date and upon testing it, I see no date printed. Lets use D_T_FMT so that something gets printed and if D_T_FMT is not avaliable, then we can fall back to "%+". Reviewed-by: George Melikov <[email protected]> Reviewed-by: loli10K <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #5993
* OpenZFS 6865 - want zfs-tests cases for zpool labelclear commandYuri Pankov2017-04-111-9/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Authored by: Yuri Pankov <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: John Kennedy <[email protected]> Approved by: Robert Mustacchi <[email protected]> Reviewed-by: loli10K <[email protected]> Ported-by: Brian Behlendorf <[email protected]> Porting Notes: - Updated 'zpool labelclear' and 'zdb -l' such that they attempt to find a vdev given solely its short name. This behavior is consistent with the upstream OpenZFS code and the test cases depend on it. The actual implementation differs slightly due to device naming conventions on Linux. - auto_online_001_pos, auto_replace_001_pos and add-o_ashift test cases updated to expect failure when no label exists. - read_efi_label() and zpool_label_disk_check() are read-only operations and should use O_RDONLY at open time to enforce this. - zpool_label_disk() and zpool_relabel_disk() write the partition information using O_DIRECT an fsync() and page cache invalidation to ensure a consistent view of the device. - dump_label() in zdb should invalidate the page cache in order to get the authoritative label from disk. OpenZFS-issue: https://www.illumos.org/issues/6865 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/c95076c Closes #5981
* OpenZFS 5380 - receive of a send -p stream doesn't need to try renaming ↵Andriy Gapon2017-04-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | snapshots Authored by: Andriy Gapon <[email protected]> Approved by: Dan McDonald <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Reviewed by: Matt Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Ported-by: Giuseppe Di Natale <[email protected]> recv_incremental_replication() takes care of things like removing datasets that have been removed on the sending side, detecting renamed datasets, ensuring that all datasets in the affected hierarchy have the same properties as their counterparts on the sending side. All of the above are not necessary if we are receiving a stream for a single dataset that has been generated with zfs send -p, that is, a stream that includes properties. zfs_receive_one() already takes care of applying the properties to the received datasets. OpenZFS-issue: https://www.illumos.org/issues/5380 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/b8ab927 Closes #5990
* OpenZFS 8046 - Let calloc() do the multiplication in libzfs_fru_refreshPedro Giffuni2017-04-091-1/+1
| | | | | | | | | | | | | | Authored by: Pedro Giffuni <[email protected]> Approved by: Robert Mustacchi <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Ported-by: Giuseppe Di Natale <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/8046 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/3a3c0d5 Closes #5989
* glibc 2.5 compat: use correct header for makedev() et al.Olaf Faaland2017-03-312-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In glibc 2.5, makedev(), major(), and minor() are defined in sys/sysmacros.h. They are also defined in types.h for backward compatability, but using these definitions triggers a compile warning. This breaks the ZFS build, as it builds with -Werror. autoconf email threads indicate these macros may be defined in sys/mkdev.h in some cases. This commit adds configure checks to detect where makedev() is defined: sys/sysmacros.h sys/mkdev.h It assumes major() and minor() are defined in the same place. The libspl types.h then includes sys/sysmacros.h (preferred) or sys/mkdev.h (2nd choice) if one of those defines makedev(). This is done before including the system types.h. An alternative would be to remove uses of major, minor, and makedev, instead comparing the st_dev returned from stat64. These configure checks would then be unnecessary. This change revealed that __NORETURN was being defined unnecessarily in libspl/include/sys/sysmacros.h. That definition is removed. The files in which __NORETURN are used all include types.h, and so all will get the definition provided by feature_tests.h Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Olaf Faaland <[email protected]> Closes #5945
* OpenZFS 7990 - libzfs: snapspec_cb() does not need to call zfs_strdup()Giuseppe Di Natale2017-03-281-7/+4
| | | | | | | | | | | | | Authored by: Marcel Telka <[email protected]> Reviewed by: Yuri Pankov <[email protected]> Reviewed by: Toomas Soome <[email protected]> Approved by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Ported-by: Giuseppe Di Natale <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7990 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/d8584ba Closes #5939
* Check ashift validity in 'zpool add'LOLi2017-03-281-3/+6
| | | | | | | | | | | | | df83110 added the ability to specify a custom "ashift" value from the command line in 'zpool add' and 'zpool attach'. This commit adds additional checks to the provided ashift to prevent invalid values from being used, which could result in disastrous consequences for the whole pool. Additionally provide ASHIFT_MAX and ASHIFT_MIN definitions in spa.h. Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #5878
* Fix 'zdb -o' segmentation faultLOLi2017-03-231-1/+1
| | | | | | | | | Fix a regression accidentally introduced by OpenZFS 7280 in ed828c0: since whether to accept NULL as a valid first parameter in strchr() is implementation specific we add an additional check to avoid crashing. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #5917
* Fix undefined reference to `libzfs_fru_compare'Brian Behlendorf2017-03-231-0/+9
| | | | | | | | | | | | | | | Add trivial libzfs_fru_compare() function which can be used when HAVE_LIBTOPO is not defined. The only caller is find_vdev() and this function should never be reached because search_fru must be NULL unless HAVE_LIBTOPO is defined. Rename _HAS_FMD_TOPO to existing HAVE_LIBTOPO which was originally added for this purpose. This macro will never be defined. Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #5402 Closes #5909
* Fix `zpool status -v` error messageBrian Behlendorf2017-03-221-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | When a pool is suspended it's impossible to read the list of damaged files from disk. This would result in a generic misleading "insufficient permissions" error message. Update zpool_get_errlog() to use the standard zpool error logging functions to generate a useful error message. In this case: errors: List of errors unavailable: pool I/O is currently suspended This patch does not address the related issue of potentially not being able to resume a suspend pool when the underlying device names have changed. Additionally, remove the error handling from zfs_alloc() in zpool_get_errlog() for readability since this function can never fail. Reviewed-by: George Melikov <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #4031 Closes #5731 Closes #5907
* libspl: Fix incorrect use of platform defines on sparc64John Paul Adrian Glaubitz2017-03-221-2/+2
| | | | | | | | | | | | | | | | libspl tries to detect sparc64 by checking whether __sparc64__ is defined. Unfortunately, this assumption is not correct as sparc64 does not define __sparc64__ but it defines __sparc__ and __arch64__ instead. This leads to sparc64 being detected as 32-Bit sparc and the build fails because both _ILP32 and _LP64 are defined in this case. To fix the problem, remove the checks for __sparc64__ and just check __arch64__ if a sparc host was previously detected with __sparc__. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: John Paul Adrian Glaubitz <[email protected]> Closes #5913
* Fix nfs snapdir automountChunwei Chen2017-03-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The current implementation for allowing nfs to access snapdir is very buggy. It uses a special fh for snapdirs, such that the next time nfsd does fh_to_dentry, it actually returns the root inode inside the snapshot. So nfsd never knows it cross a mountpoint. The problem is that nfsd will not hold a reference on the vfsmount of the snapshot. This cause auto unmounter to unmount the snapshot even though nfs is still holding dentries in it. To fix this, we return the inode for the snapdirs themselves. However, we also trigger automount upon fh_to_dentry, and return ESTALE so nfsd will revalidate and see the mountpoint and do crossmnt. Because nfsd will now be aware that these are different filesystems users must add crossmnt to their export options to access snapshot directories. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Chunwei Chen <[email protected]> Closes #3794 Closes #4716 Closes #5810 Closes #5833
* Fix powerpc buildBrian Behlendorf2017-03-061-4/+0
| | | | | | | | | | | | | | | | | | | Unlike other architectures which sanitize the LDFLAGS from the environment in arch/<arch>/Makefile. The powerpc Makefile allows LDFLAGS to be passed through resulting in the following build failure. /usr/bin/ld: unrecognized option '-Wl,-z,relro' LDFLAGS is set in /usr/lib/rpm/redhat/macros by default. Clear the environment variable when building kmods for powerpc. Additionally, now that ppc64le exists it's not longer safe to assume a powerpc system is big endian. Rely on the endianness provided by the compiler. Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #5856
* Fix checksumflags assignment in cksummerTim Crawford2017-02-241-1/+1
| | | | | | | | | | drr_checksumflags was incorrectly set to drr_checksumtype. Reviewed-by: Matt Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: Tim Crawford <[email protected]> Closes #5830
* Clear enclosure sysfs path from VDEV label when sysfs path isn't presentTony Hutter2017-02-101-1/+3
| | | | | | | | | | | | | | | | This clears vdev_enc_sysfs_path from the label if the VDEV's /sys/class/block/<dev>/device/enclosure_device path isn't present. This is important in the case where a disk that is labeled with vdev_enc_sysfs_path is pulled out and put into another enclosure. In that case, it's possible that the old sysfs path would be used to turn on the fault LED for the disk's old slot postion, assuming the new slot didn't have a LED sysfs entry. Reviewed-by: Don Brady <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #5524 Closes #5773
* Fix coverity defects: CID 155964, 155965George Melikov2017-02-081-0/+3
| | | | | | | | CID 155964: Missing break in switch CID 155965: Missing break in switch Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: George Melikov <[email protected]> Closes #5759
* OpenZFS 6931 - lib/libzfs: cleanup gcc warningsGeorge Melikov2017-02-077-14/+53
| | | | | | | | | | | Authored by: Igor Kozhukhov <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Approved by: Robert Mustacchi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/6931 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/88f61de Closes #5741
* OpenZFS 7247 - zfs receive of deduplicated stream failsGeorge Melikov2017-02-041-1/+5
| | | | | | | | | | | | | | | | | | | | Authored by: Chris Williamson <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Dan Kimmel <[email protected]> Approved by: Robert Mustacchi <[email protected]> Reviewed-by: loli10K <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7247 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/2ad25b4 Closes #5689 Porting notes: - tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_013_pos.ksh renamed as zfs_receive_015_pos.ksh, zfs_receive_013_pos.ksh is now used for OpenZFS test. - libzfs_sendrecv.c: SMALLEST_POSSIBLE_MAX_DDT_MB is always used for all 32-bit builds.
* OpenZFS 4521 - zfstest is trying to execute evil "zfs unmount -a"Giuseppe Di Natale2017-02-032-11/+35
| | | | | | | | | | | | | | | | | | Authored by: Yuri Pankov <[email protected]> Reviewed by: Andriy Gapon <[email protected]> Reviewed by: Dan McDonald <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: John Kennedy <[email protected]> Approved by: Robert Mustacchi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Ported-by: Giuseppe Di Natale <[email protected]> Porting Notes: - Correctly set __ZFS_POOL_RESTRICT in inherit_001_pos OpenZFS-issue: https://www.illumos.org/issues/4521 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/8808ac5 Closes #5674
* Fix atomic_sub_64() i386 assembly implementationBrian Behlendorf2017-02-011-1/+1
| | | | | | | | | | | | | The atomic_sub_64() should use sbbl instead of adcl. In user space these atomics are used for statistics tracking and aren't critical which explain how this was overlooked. The kernel space implementation of these atomics are layered on the architecture specific implementations provided by the kernel. Reviewed by: Stefan Ring <[email protected]> Reviewed-by: Gvozden Neskovic <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #5671 Closes #5717
* OpenZFS 7745 - print error if lzc_* is called before libzfs_core_initGeorge Melikov2017-01-312-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is that consumers of `libZFS_Core` that forget to call `libzfs_core_init()` before calling any other function of the library are having a hard time realizing their mistake. The library's internal file descriptor is declared as global static, which is ok, but it is not initialized explicitly; therefore, it defaults to 0, which is a valid file descriptor. If `libzfs_core_init()`, which explicitly initializes the correct fd, is skipped, the ioctl functions return errors that do not have anything to do with `libZFS_Core`, where the problem is actually located. Even though assertions for that existed within `libZFS_Core` for debug builds, they were never enabled because the `-DDEBUG` flag was missing from the compiler flags. This patch applies the following changes: 1. It adds `-DDEBUG` for debug builds of `libZFS_Core` and `libzfs`, to enable their assertions on debug builds. 2. It corrects an assertion within `libzfs`, where a function had been spelled incorrectly (`zpool_prop_unsupported()`) and nobody knew because the `-DDEBUG` flag was missing, and the preprocessor was taking that part of the code away. 3. The library's internal fd is initialized to `-1` and `VERIFY` assertions have been placed to check that the fd is not equal to `-1` before issuing any ioctl. It is important here to note, that the `VERIFY` assertions exist in both debug and non-debug builds. 4. In `libzfs_core_fini` we make sure to never increment the refcount of our fd below 0, and also reset the fd to `-1` when no one refers to it. The reason for this, is for the rare case that the consumer closes all references but then calls one of the library's functions without using `libzfs_core_init()` first, and in the mean time, a previous call to `open()` decided to reuse our previous fd. This scenario would have passed our assertion in non-debug builds. 5. Once the `ASSERTION` macros were enabled again, two tests from the test suite were failing in `libzfs_sendrecv.c` at a `ZIO_CHECKSUM_IS_ZERO` check within `dump_record()`. We now zero the kernel filled checksums in all `dmu_replay_record`s that we read in `cksummer()`, except the ones that are of type `DRR_BEGIN`. I considered making all assertions available for both debug and non-debug builds, but I figured that it would not be appropriate if, for example, an outside consumer of `libZFS_Core` suddenly triggers an assertion failure because they happened to call `libzfs_core_fini()`, even if previously the reference counter was `0`. Therefore, all the reference counter related assertions are only enabled for debug builds, and fd related assertions are enabled for debug and non-debug builds. Porting notes: - `ASSERT3S(g_refcount, >, 0);` added to `recv_impl` in lib/libzfs_core/libzfs_core.c . Authored by: Serapheim Dimitropoulos <[email protected]> Reviewed by: Pavel Zakharov <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7745 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/7e3139a Closes #5698
* OpenZFS 7280 - Allow changing global libzpool variables in zdb and ztest ↵George Melikov2017-01-312-1/+58
| | | | | | | | | | | | | | through command line Authored by: Pavel Zakharov <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Dan Kimmel <[email protected]> Approved by: Robert Mustacchi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7280 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/0e60744 Closes #5676
* OpenZFS 7541 - zpool import/tryimport ioctl returns ENOMEMGeorge Melikov2017-01-301-4/+5
| | | | | | | | | | | | | | | | | | | | Authored by: Pavel Zakharov <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Dan Kimmel <[email protected]> The refresh_config() calls into the kernel with ZFS_IOC_POOL_TRYIMPORT. This ioctl returns the config of the pool in a buffer pre-allocated in userland. The original estimate for the size is too conservative since it doesn't account for the large size of vdev stats that are added to the config before returning. This fix simply increases the size of the buffer passed. This results in a speed up of the zpool import process, and less spam in zfs_dbgmsg. Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7541 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/a3c7690 Closes #5704
* OpenZFS 7340 - receive manual origin should override automatic originGeorge Melikov2017-01-271-6/+6
| | | | | | | | | | | | Authored by: Paul Dagnelie <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Approved by: Robert Mustacchi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7340 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/ed4e7a6 Closes #5681
* Add realloc() success check in zpool_history_unpack()George Melikov2017-01-271-1/+8
| | | | | | | | Correctly handle the unlikely case where the memory buffer cannot be resized. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: George Melikov <[email protected]> Closes #5575
* OpenZFS 5561 - support root pools on EFI/GPT partitioned disksBrian Behlendorf2017-01-271-88/+2
| | | | | | | | | | | Reviewed by: Jean McCormack <[email protected]> Reviewed by: Josef 'Jeff' Sipek <[email protected]> Approved by: Dan McDonald <[email protected]> Reviewed-by: George Melikov <[email protected]> Ported-by: Brian Behlendorf <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/5561 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/1a902ef Closes #5672
* OpenZFS 7386 - zfs get does not work properly with bookmarksGeorge Melikov2017-01-263-16/+109
| | | | | | | | | | | | Authored by: Marcel Telka <[email protected]> Reviewed by: Simon Klinkert <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Approved by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7386 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/edb901a Closes #5666
* OpenZFS 5142 - libzfs support raidz root pool (loader project)George Melikov2017-01-261-0/+1
| | | | | | | | | | | | | | | Authored by: Toomas Soome <[email protected]> Reviewed by: - George Wilson <[email protected]> Reviewed by: - Yuri Pankov <[email protected]> Reviewed by: - Andrew Stormont <[email protected]> Reviewed by: - Albert Lee <[email protected]> Approved by: - Robert Mustacchi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/5142 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/d5f26ad Closes #5663
* OpenZFS 6412 - zfs receive: -u can be ignored sometimesGeorge Melikov2017-01-261-1/+2
| | | | | | | | | | | | Authored by: Andriy Gapon <[email protected]> Reviewed by: - Matthew Ahrens <[email protected]> Reviewed by: - Paul Dagnelie <[email protected]> Approved by: - Richard Lowe <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/6412 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/9185393 Closes #5659
* OpenZFS 7336 - vfork and O_CLOEXEC causes zfs_mount EBUSYGeorge Melikov2017-01-261-6/+62
| | | | | | | | | | | | | | | | | | | Porting notes: - statvfs64 is replaced by statfs64. - ZFS_SUPER_MAGIC definition moved in include/sys/fs/zfs.h to share it between user and kernel space. Authored by: Prakash Surya <[email protected]> Reviewed by: Matt Ahrens <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Reviewed by: Robert Mustacchi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7336 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/dd862f6d Closes #5651
* OpenZFS 7571 - non-present readonly numeric ZFS props do not have default valueGeorge Melikov2017-01-241-1/+2
| | | | | | | | | | | | Authored by: Matthew Ahrens <[email protected]> Reviewed by: Dan Kimmel <[email protected]> Reviewed by: George Wilson <[email protected]> Approved by: Robert Mustacchi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7571 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/ad2760a Closes #5638
* OpenZFS 6871 - libzpool implementation of thread_create should enforce ↵George Melikov2017-01-241-1/+2
| | | | | | | | | | | | | | | | | | | | length is 0 Porting notes: - Several direct callers of zk_thread_create() are passing TS_RUN for the length. The `len` and `state` were inverted,this commit fixes them. Authored by: Eli Rosenthal <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Approved by: Robert Mustacchi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov [email protected] OpenZFS-issue: https://www.illumos.org/issues/6871 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/8fc9228 Closes #5621
* OpenZFS 7604 - if volblocksize property is the default, it displays as "-" ↵George Melikov2017-01-231-1/+4
| | | | | | | | | | | | | | | rather than 8K Authored by: Matthew Ahrens <[email protected]> Reviewed by: Pavel Zakharov <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Reviewed by: John Kennedy <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7604 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/586fd65 Closes #5629
* OpenZFS 6428 - set canmount=off on unmounted filesystem tries to unmount ↵George Melikov2017-01-231-2/+3
| | | | | | | | | | | | | | children Authored by: Andriy Gapon <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Approved by: Gordon Ross <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/6428 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/c079fa4 Closes #5628
* OpenZFS 7233 - dir_is_empty should open directory with CLOEXECGeorge Melikov2017-01-231-2/+10
| | | | | | | | | | | | Authored by: Alex Reece <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Approved by: Richard Lowe <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov [email protected] OpenZFS-issue: https://www.illumos.org/issues/7233 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/d420209 Closes #5623
* OpenZFS 6052 - decouple lzc_create() from the implementation detailsGeorge Melikov2017-01-232-5/+5
| | | | | | | | | | | Authored by: Andriy Gapon <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Approved by: Richard Lowe <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov [email protected] OpenZFS-issue: https://www.illumos.org/issues/6052 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/26455f9 Closes #5622
* codebase style improvements for OpenZFS 6459 portGeorge Melikov2017-01-225-9/+17
|
* OpenZFS 7729 - libzfs_core`lzc_rollback() leaks result nvlGeorge Melikov2017-01-211-0/+2
| | | | | | | | | | | Authored by: Yuri Pankov <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Prakash Surya <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov [email protected] OpenZFS-issue: https://www.illumos.org/issues/7729 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/882877e Closes #5620
* OpenZFS 6328 - Fix cstyle errors in zfs codebaseGeorge Melikov2017-01-122-3/+4
| | | | | | | | | | | | | | Authored by: Paul Dagnelie <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Alex Reece <[email protected]> Reviewed by: Richard Elling <[email protected]> Reviewed by: Jorgen Lundman <[email protected]> Approved by: Robert Mustacchi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/6328 OpenZFS-commit: https://github.com/illumos/illumos-gate/commit/9a686fb Closes #5579