summaryrefslogtreecommitdiffstats
path: root/cmd
Commit message (Collapse)AuthorAgeFilesLines
* Replace "email" ZEDLETs with "notify" ZEDLETsChris Dunlap2015-04-2715-258/+311
| | | | | | | | | | | | | | | | | | | | | | | | | Several ZEDLETs already exist for sending email in reponse to a particular zevent. While email is ubiquitous, alternative methods may be better suited for some configurations. Instead of duplicating the "email" ZEDLETs for every future notification method, it is preferable to abstract the notification method into a function. This has the added benefit of reducing the amount of code duplicated between ZEDLETs, and allowing related bugs to be fixed in a single location. This commit replaces the existing "email" ZEDLETs with corresponding "notify" ZEDLETs. In addition, the ZEDLET code for sending an email message has been moved into the zed_notify_email() function. And this zed_notify_email() has been added to a generic zed_notify() function for sending notifications via all available methods that have been configured. This commit also changes a couple of related zed.rc variables. ZED_EMAIL_INTERVAL_SECS is changed to ZED_NOTIFY_INTERVAL_SECS, and ZED_EMAIL_VERBOSE is changed to ZED_NOTIFY_VERBOSE. Note that ZED_EMAIL remains unchanged as its use is solely for the email notification method. Signed-off-by: Chris Dunlap <[email protected]>
* Cleanup ZEDLETsChris Dunlap2015-04-2711-337/+630
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit factors out several common ZEDLET code blocks into zed-functions.sh. This shortens the length of the scripts, thereby (hopefully) making them easier to understand and maintain. In addition, this commit revamps the coding style used by the scripts to be more consistent and (again, hopefully) maintainable. It now mostly follows the Google Shell Style Guide. I've tried to assimilate the following resources: Google Shell Style Guide https://google-styleguide.googlecode.com/svn/trunk/shell.xml Dash as /bin/sh https://wiki.ubuntu.com/DashAsBinSh Filenames and Pathnames in Shell: How to do it Correctly http://www.dwheeler.com/essays/filenames-in-shell.html Common shell script mistakes http://www.pixelbeat.org/programming/shell_script_mistakes.html Finally, this commit updates the exit codes used by the ZEDLETs to be more consistent with one another. All scripts run cleanly through ShellCheck <http://www.shellcheck.net/>. All scripts have been tested on bash and dash. Signed-off-by: Chris Dunlap <[email protected]>
* Memory leak in make_root_vdev()Isaac Huang2015-04-271-1/+3
| | | | | | | | | The newroot nvlist should be freed before returning. Signed-off-by: Isaac Huang <[email protected]> Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3264
* 5410 Document -S option to zfs inheritPaul B. Henson2015-04-241-1/+5
| | | | | | | | | | | | | | | 5410 Document -S option to zfs inherit 5412 Mention -S option when zfs inherit fails on quota Reviewed by: Matthew Ahrens <[email protected]> Approved by: Richard Lowe <[email protected]> References: https://www.illumos.org/issues/5410 https://github.com/illumos/illumos-gate/commit/5ff8cfa9 Ported-by: DHE <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3279
* Fix io-spare.sh to work with disk vdevsChris Dunlap2015-04-171-1/+1
| | | | | | | | | | | | | | | | | | The "zpool status" output shows the full pathname for file-type vdevs, but only the basename component for disk-type vdevs. In commit bee6665, the "basename" command was dropped from altering the vdev name used when searching the "zpool status" output. Consequently, hot-disk sparing for disk vdevs broke since "zpool status" output was now being searched for the full pathname to the disk vdev. Parsing the "zpool status" output in this manner is rather brittle. It would be preferable to search for the vdev based on its guid. But until that happens, this commit adds back the "basename" command to fix the vdev name breakage. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3310
* Illumos 5695 - dmu_sync'ed holes do not retain birth timePrakash Surya2015-03-271-1/+3
| | | | | | | | | | | | | | | | | 5695 dmu_sync'ed holes do not retain birth time Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Christopher Siden <[email protected]> Reviewed by: Bayard Bell <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/issues/5695 https://github.com/illumos/illumos-gate/commit/70163ac Ported-by: Chris Dunlop <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3229
* zpool import should honor overlay propertyNed Bass2015-03-271-14/+0
| | | | | | | | | | | | Make the 'zpool import' command honor the overlay property to allow filesystems to be mounted on a non-empty directory. As it stands now this property is only checked by the 'zfs mount' command. Move the check into 'zfs_mount()` in libzpool so the property is honored for all callers. Signed-off-by: Ned Bass <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3227
* Check all vdev labels in 'zpool import'Brian Behlendorf2015-03-252-2/+2
| | | | | | | | | | | | | | | | | | When using 'zpool import' to scan for available pools prefer vdev names which reference vdevs with more valid labels. There should be two labels at the start of the device and two labels at the end of the device. If labels are missing then the device has been damaged or is in some other way incomplete. Preferring names with fully intact labels helps weed out bad paths and improves the likelihood of being able to import the pool. This behavior only applies when scanning /dev/ for valid pools. If a cache file exists the pools described by the cache file will be used. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Chris Dunlap <[email protected]> Closes #3145 Closes #2844 Closes #3107
* Install arc_summary.pyTurbo Fredriksson2015-03-031-0/+1
| | | | | | | | | Add the arc_summary Makefile to the build system so the script is properly included in the distribution tarball and installed. Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3147
* Avoid dladdr() in ztestTim Chase2015-02-271-44/+39
| | | | | | | | | Under Linux, at least, dladdr() doesn't reliably work for functions which aren't in a DSO. Add the function name to ztest_info[]. Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3130
* Enhancements to zpool dry run mode.Tim Chase2015-02-111-0/+28
| | | | | | | | | | In dry run mode, zpool should display more of the proposed pool configuration for "zpool add". This commit adds support for displaying cache devices. Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #1106
* Fix build error when make debChunwei Chen2015-02-061-0/+1
| | | | | | | | | | | | | After 53698a4, the following error occurs when make deb. CCLD zed ../../lib/libzfs/.libs/libzfs.so: undefined reference to `get_system_hostid' Add libzpool.la to zed/Makefile.am to fix this Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3080
* Read spl_hostid module parameter before gethostid()Chunwei Chen2015-02-041-1/+1
| | | | | | | | | | If spl_hostid is set via module parameter, it's likely different from gethostid(). Therefore, the userspace tool should read it first before falling back to gethostid(). Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3034
* Cleanup _zed_event_add_nvpair()Chris Dunlap2015-01-301-232/+263
| | | | | | | | | | | | | | | | | | When _zed_event_add_var() was updated to be the common routine for adding zedlet environment variables, an additional snprintf() was added to the processing of each nvpair. This commit changes _zed_event_add_nvpair() to directly call _zed_event_add_var() for nvpair non-array types, thereby removing a superfluous call to snprintf(). For consistency, the helper functions for converting nvpair array types are similarly adjusted to add variables. The _zed_event_value_is_hex() and _zed_event_add_var() functions have been moved up in the file since forward declarations are not used, but no changes have been made to these functions. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3042
* Protect against adding duplicate strings in ZEDChris Dunlap2015-01-304-151/+243
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The zed_strings container stores strings in an AVL, but does not check for duplicate strings being added. Within the AVL, strings are indexed by the string value itself. avl_add() requires the node being added must not already exist in the tree, and will assert() if this is not the case. This should not cause problems in practice. ZED uses this container in two places. In zed_conf.c, it is used to store the names of enabled zedlets as zed scans the zedlet directory listing; duplicate entries cannot occur here since duplicate names cannot occur within a directory. In zed_event.c, it is used to store the environment variables (as "NAME=VALUE" strings) that will be passed to zedlets; duplicate strings here should never happen unless there is a bug resulting in a duplicate nvpair or environment variable. This commit protects against adding a duplicate to a zed_strings container by first checking for the string being added, and removing the previous entry should one exist. This implements a "last one wins" policy. This commit also changes the prototype for zed_strings_add() to allow the string key (by which it is indexed in the AVL) to differ from the string value. By adding zedlet environment variables using the variable name as the key, multiple adds for the same variable name will result in only the last value being stored. Finally, this commit routes all additions of zedlet environment variables through the updated _zed_event_add_var(). This ensures all zedlet environment variable names are properly converted. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3042
* Replace sysctl summary with tunables summary.Kyle Blatter2015-01-281-66/+57
| | | | | | | | | | | The original script displayed tunable parameters using sysctl calls. This patch modifies this by displaying tunable parameters found in /sys/modules/zfs/parameters/. modinfo calls are used to capture descriptions. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Kyle Blatter <[email protected]> Signed-off-by: Ned Bass <[email protected]>
* Force all lines to be 80 columnsKyle Blatter2015-01-281-33/+66
| | | | | | | | | Ensure this script conforms to the projects style guidelines by limiting line length to 80 columns. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Kyle Blatter <[email protected]> Signed-off-by: Ned Bass <[email protected]>
* Add a help option with usage informationKyle Blatter2015-01-281-4/+25
| | | | | | | | | | Add a basic help option and usage description which is consistent with arcstat.py and dbufstat.py. This also adds support for long opts. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Kyle Blatter <[email protected]> Signed-off-by: Ned Bass <[email protected]>
* Refactor arc_summary to simplify -p processingKyle Blatter2015-01-281-23/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The -p option is used to specify a specific page of output to be displayed. If omitted, all output pages would be displayed. arc_summary, as it stood, had really kludgy processing code for processing the -p option. It relied on a try-except block which was treated as an if statement and in normal operation would fail any time a user didn't specify the -p option on the command line. When the exception was thrown, the script would then display all output pages. This happened whether the -p option was omitted or malformed. Thus, in the principle use case, an exception would be raised in order to run the script as desired. The same except code would be called regardless of the exception, however, and malformed -p arguments would also cause the script to execute. Additionally, this required the function which handles the case where all output pages were to be displayed, _call_all, to be potentially called from several locations within main. This commit refactors the option processing code to simplify it and make it easier to catch runtime errors in the script. This is done by specializing the try-except block to only have an exception when the -p argument is malformed. When the -p option is correctly selected by the user, it calls a function in the unSub array directly, which will only display one page of output. Finally in the context of this refactoring the page breaks have been removed. Pages seem to have been added into the output in the FreeNAS version of the script. This patch removes pages from the output to more closely resemble the freebsd version of the script. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Kyle Blatter <[email protected]> Signed-off-by: Ned Bass <[email protected]>
* Modified arc_summary.py to run on linuxcburroughs2015-01-281-287/+24
| | | | | | | | | | | | | 1) Comment out stat sections whose kstats are not currently available 2) Port most of arc_summary to use spl kstats 3) Enable l2arc stats 5) Include compressed l2size 4) Minor style fixes / cleanup Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: cburroughs <[email protected]> Signed-off-by: Kyle Blatter <[email protected]> Signed-off-by: Ned Bass <[email protected]>
* Add arc_summary.py from FreeNAScburroughs2015-01-282-0/+1378
| | | | | | | | | | | | | | | | | | | | | | | | | | The arc_summary script is a useful utility for administrators on other ZFS platforms. It provides a quick and easy way to get a high level view of the current ARC state. Historically this was a perl script but it was rewritten in python for FreeNAS. We've decided to adopt the python version instead of the perl version for a few reasons. 1) ZoL has no existing perl dependencies, but it does have a python dependency for scripts such as arcstat.py and dbufstat.py. Using python for arc_summary.py helps us minimize dependencies. 2) Most major Linux distributions already depend heavily on python for their core infrastructure. This means it's very likely to be available even very early in the boot process. Original source: https://github.com/freenas/freenas/blob/master/gui/tools/arc_summary.py Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: cburroughs <[email protected]> Signed-off-by: Kyle Blatter <[email protected]> Signed-off-by: Ned Bass <[email protected]>
* vdev_id: use mawk-compatible regular expressionNed Bass2014-12-191-1/+1
| | | | | | | | | | | | | Slot mapping in vdev_id doesn't work on systems using mawk as the 'awk' alternative. A regular expression in map_slot() contains an unquoted empty string following the alternation (|) operator, which results in an "missing operand" error with mawk. The solution is to rearrange the expression so the alternation has two operands. Signed-off-by: Ned Bass <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes zfsonlinux/pkg-zfs#136 Closes zfsonlinux/zfs#2965
* Fix cstyle issue from c66989bBrian Behlendorf2014-12-191-2/+2
| | | | | | | Commit c66989b accidentally introduced a cstyle issue which went unnoticed. This tiny patch corrects that oversight. Signed-off-by: Brian Behlendorf <[email protected]>
* zpool upgrade return errors to stderr instead of stdoutJacek FefliƄski2014-12-181-2/+2
| | | | | | Signed-off-by: Jacek Feflinski <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2955
* Print header properly when terminal resizesIsaac Huang2014-11-141-6/+15
| | | | | | | | | Added a handler for SIGWINCH, so that one header is printed per screen even when the terminal resizes. Signed-off-by: Isaac Huang <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2847
* Fix inaccurate field descriptionsIsaac Huang2014-11-141-5/+5
| | | | | | | | | | The field descriptions from arcstat.py -v for the demand accesses are inaccurate. They all begin with "Demand Data" yet the fields actually covered both demand data and demand meta-data accesses. Signed-off-by: Isaac Huang <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2842
* Improve zvol symlink handling.Dan Swartzendruber2014-11-061-0/+8
| | | | | | | | | | | | | | | | Change the zvol helper program to replace any embedded spaces in the pool or dataset names with '+' to ensure we have valid symlinks. The '+' character was choosen because it is not a valid character for a dataset name but it is allowed by udev. This ensures that all dataset names with an embedded space will be translated to a unique /dev/zvol/ symlink. Signed-off-by: Dan Swartzendruber <[email protected]> Signed-off-by: Darik Horn <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2834
* Make directory into which mount.zfs is installed configurableRichard Yao2014-10-281-1/+1
| | | | | | | | | | | Installing outside of the prefix is not permissible under Gentoo Prefix. The package manager will cause the installation process to fail if/when it sees this. I could script a workaround inside the ebuild, but it seemed to make more sense to make this more configurable. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2641
* Illumos 5164-5165 - space map fixesMatthew Ahrens2014-10-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 5164 space_map_max_blksz causes panic, does not work 5165 zdb fails assertion when run on pool with recently-enabled space map_histogram feature Reviewed by: Christopher Siden <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Saso Kiselkov <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/issues/5164 https://www.illumos.org/issues/5165 https://github.com/illumos/illumos-gate/commit/b1be289 Porting Notes: The metaslab_fragmentation() hunk was dropped from this patch because it was already resolved by commit 8b0a084. The comment modified in metaslab.c was updated to use the correct variable name, space_map_blksz. The upstream commit incorrectly used space_map_blksize. Ported by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2697
* Illumos 4958 zdb trips assert on pools with ashift >= 0xeAlex Reece2014-10-231-6/+37
| | | | | | | | | | | | | | | | | | | | | | 4958 zdb trips assert on pools with ashift >= 0xe Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Max Grossman <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Christopher Siden <[email protected]> Approved by: Garrett D'Amore <[email protected]> References: https://www.illumos.org/issues/4958 https://github.com/illumos/illumos-gate/commit/2a104a5 Porting notes: Keep the ZIO_FLAG_FASTWRITE define. This is for a feature present in Linux but not yet in *BSD. Ported by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2697
* Fix zdb segfaultBrian Behlendorf2014-10-231-0/+2
| | | | | | | | | | | | On 32-bit systems setting 'zfs_arc_max = 256M' in zdb results in the following segmentation fault. Rather than reverting 0ec0724 which introduced this flaw this code is only used for 64-bit builds. Segmentation fault (core dumped) ztest: '/sbin/zdb -bcc -d -U /var/tmp/zpool.cache ztest' exit code 139 child exited with code 3 Signed-off-by: Brian Behlendorf <[email protected]>
* Illumos 5169-5171 - zdb fixesMatthew Ahrens2014-10-231-3/+21
| | | | | | | | | | | | | | | | | | | | | 5169 zdb should limit its ARC size 5170 zdb -c should create more scrub i/os by default 5171 zdb should print status while loading metaslabs for leak detection Reviewed by: Christopher Siden <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Reviewed by: Bayard Bell <[email protected]> Approved by: Robert Mustacchi <[email protected]> References: https://www.illumos.org/issues/5169 https://www.illumos.org/issues/5170 https://www.illumos.org/issues/5171 https://github.com/illumos/illumos-gate/commit/06be980 Ported by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2707
* Illumos 5178 - zdb -vvvvv on old-format pool fails in dump_deadlist()Matthew Ahrens2014-10-231-0/+5
| | | | | | | | | | | | | | | | | | | 5178 zdb -vvvvv on old-format pool fails in dump_deadlist() Reviewed by: Christopher Siden <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Richard Lowe <[email protected]> Reviewed by: Saso Kiselkov <[email protected]> Reviewed by: Richard Elling <[email protected]> Reviewed by: Alek Pinchuk <[email protected]> Approved by: Garrett D'Amore <[email protected]> References: https://www.illumos.org/issues/5178 https://github.com/illumos/illumos-gate/commit/90c76c6 Ported by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2713
* Fix zpool create -t ENOENT bug.ilovezfs2014-10-231-2/+4
| | | | | | | | | | | In userland we need to switch over to the temporary name once the pool has been created, otherwise the root dataset won't mount and the error "cannot open 'the_real_name': dataset does not exist" is printed. Signed-off-by: ilovezfs <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2760
* Let `zpool import` ignore a missing hostid record.Darik Horn2014-10-171-31/+24
| | | | | | | | | | | | | Change the zpool program to skip its hostid mismatch check in the same way that libzfs already does. Invoked imports fail if the ZPOOL_CONFIG_HOSTID nvpair is missing in the /etc/zfs/zpool.cache file, which can happen as of the /etc/hostid deprecation in commit zfsonlinux/spl@acf0ade362cb8b26d67770114ee6fa17816e6b65. Signed-off-by: Darik Horn <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2794
* ztest: print backtrace on SIGSEGV and SIGABRTNed Bass2014-10-131-0/+44
| | | | | | | | Add signal handlers to print a backtrace if we crash or assert. Signed-off-by: Ned Bass <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2788
* Illumos 5176 - lock contention on godfather zioMatthew Ahrens2014-10-071-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | 5176 lock contention on godfather zio Reviewed by: Adam Leventhal <[email protected]> Reviewed by: Alex Reece <[email protected]> Reviewed by: Christopher Siden <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Richard Elling <[email protected]> Reviewed by: Bayard Bell <[email protected]> Approved by: Garrett D'Amore <[email protected]> References: https://www.illumos.org/issues/5176 https://github.com/illumos/illumos-gate/commit/6f834bc Porting notes: Under Linux max_ncpus is defined as num_possible_cpus(). This is largest number of cpu ids which might be available during the life time of the system boot. This value can be larger than the number of present cpus if CONFIG_HOTPLUG_CPU is defined. Ported by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2711
* Cleanup struct zed_conf vars in zed_conf_destroyChris Dunlap2014-10-061-10/+16
| | | | | | | | | Reset struct zed_conf file descriptors to -1 after close(), and pointers to NULL after free(). Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2756
* Obtain advisory lock on ZED PID fileChris Dunlap2014-10-063-33/+78
| | | | | | | | | | | | | | | | | ZED uses an advisory lock on its state file to protect against multiple instances running concurrently. However, work is planned to move this state information into the kernel, and ZED will still need to protect against starting multiple instances. This commit adds an advisory lock on the PID file to protect against starting multiple instances. A lock failure can be overridden with the "-f" (force) command-line option. The advisory lock on the state file is being retained for as long as the state information is stored in the state file. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2756
* Implement -t option to zpool create for temporary pool namesRichard Yao2014-09-301-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | Creating virtual machines that have their rootfs on ZFS on hosts that have their rootfs on ZFS causes SPA namespace collisions when the standard name rpool is used. The solution is either to give each guest pool a name unique to the host, which is not always desireable, or boot a VM environment containing an ISO image to install it, which is cumbersome. 26b42f3f9d03f85cc7966dc2fe4dfe9216601b0e introduced `zpool import -t ...` to simplify situations where a host must access a guest's pool when there is a SPA namespace conflict. We build upon that to introduce `zpool import -t tname ...`. That allows us to create a pool whose in-core name is tname, but whose on-disk name is the normal name specified. This simplifies the creation of machine images that use a rootfs on ZFS. That benefits not only real world deployments, but also ZFSOnLinux development by decreasing the time needed to perform rootfs on ZFS experiments. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2417
* zpool import -t should not update cachefileRichard Yao2014-09-301-0/+3
| | | | | | | | | | | | | zpool import's -t parameter is intended for use with -R when operating on pools that belong to other systems. Like -R, pools imported in this way should not update the cachefile unless explicitly requested. The initial implementation allowed the cachefile to be updated when -R was not used. This went uncaught during testing because -R had implicitly disabled use of the cachefile. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2417
* Add add_prop_list_default helperRichard Yao2014-09-301-10/+17
| | | | | | | | | | | Adding to a property list only if there is no existing value is used twice. Once by zpool create -R and again by zpool import -R. Now that zpool create -t and zpool import -t also need it, lets refactor it into a helper function to make the code more readable. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2417
* Refer to ZED's scripts as ZEDLETsChris Dunlap2014-09-2513-51/+51
| | | | | | | | | | | | | | The executables invoked by the ZED in response to a given zevent have been generically referred to as "scripts". By convention, these scripts have aimed to be /bin/sh compatible for reasons of portability and comprehensibility. However, the ZED only requires they be executable and (ideally) capable of reading environment variables. As such, these scripts are now referred to as ZEDLETs (ZFS Event Daemon Linkage for Executable Tasks). Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2735
* Replace zed's use of malloc with callocChris Dunlap2014-09-253-8/+4
| | | | | | | | | | | | | | When zed allocates memory via malloc(), it typically follows that with a memset(). However, calloc() implementations can often perform optimizations when zeroing memory: https://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc This commit replaces zed's use of malloc() with calloc(). Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2736
* Fix zed io-spare.sh dash incompatibilityChris Dunlap2014-09-231-3/+4
| | | | | | | | | | | | | | | The zed's io-spare.sh script defines a vdev_status() function to query the 'zpool status' output for obtaining the status of a specified vdev. This function contains a small awk script that uses a parameter expansion (${parameter/pattern/string}) supported in bash but not in dash. Under dash, this fails with a "Bad substitution" error. This commit replaces the awk script with a (hopefully more portable) sed script that has been tested under both bash and dash. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2536
* Illumos 5147 - zpool list -v should show individual disk capacityGeorge Wilson2014-09-231-32/+51
| | | | | | | | | | | | | | | | | | | | The 'zpool list -v' command displays lots of info but excludes the capacity of each disk. This should be added. 5147 zpool list -v should show individual disk capacity Reviewed by: Adam Leventhal <[email protected]> Reviewed by: Christopher Siden <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Richard Elling <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/issues/5147 https://github.com/illumos/illumos-gate/commit/7a09f97 Ported by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2688
* Remove reverse indentation from zed comments.Chris Dunlap2014-09-227-61/+83
| | | | | | | | | Remove all occurrences of reverse indentation from zed comments for consistency within the project code base. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2695
* Improve handling of filesystem versionsDan Swartzendruber2014-09-032-15/+74
| | | | | | | | | | | | | Change mount code to diagnose filesystem versions that are not supported by the current implementation. Change upgrade code to do likewise and refuse to upgrade a pool if any filesystems on it are a version which is not supported by the current implementation. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Dan Swartzendruber <[email protected]> Closes: #2616
* Change delimiter for ZED email scriptslouwrentius2014-09-022-9/+9
| | | | | | | | | | | | | | | | When the ZED_EMAIL_INTERVAL_SECS="3600" option is set in zed.rc configuration file then notification emails should be rate limited. Rate limiting is accomplished by maintaining a colon delimited state file which includes the device name. Unfortunately there are valid device names which include a colon and therefore prevent the rate limiting for working properly. For this reason the delimiter has been changed to a semi-colon. Signed-off-by: louwrentius <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Chris Dunlap <[email protected]> Closes #2645
* Cleanup zed loggingChris Dunlap2014-09-024-62/+58
| | | | | | | | | | | | | | This is a set of minor cleanup changes related to zed logging: - Remove the program identity prefix from messages written to stderr since systemd already prepends this output with the program name. - Replace the copy of the program identity string with a ptr reference. - Replace "pid" with "PID" for consistency in comments & strings. - Rename the zed_log.c struct _ctx component "level" to "priority". - Add the LOG_PID option for messages written to syslog. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2252