aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
Commit message (Collapse)AuthorAgeFilesLines
* Add ShellCheck's `--enable=all` inside `cmd/`Damian Szuberski2022-01-0625-27/+61
| | | | | | | | | The only exception is `cmd/vdev_id/vdev_id` which might be a subject of refactoring (see #12084) Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ahelenia Ziemiańska <[email protected]> Signed-off-by: szubersk <[email protected]> Closes #12912
* Revert "zfs list: Allow more fields in ZFS_ITER_SIMPLE mode"Paul Dagnelie2022-01-064-83/+38
| | | | | | | | | This reverts commit f6a0dac84af2fba9c306a3a307ea7aafcbe32d2b. Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Mark Maybee <[email protected]> Signed-off-by: Paul Dagnelie <[email protected]> Closes #12938
* Long opts for zdbManoj Joseph2022-01-061-58/+123
| | | | | | | | | This change introduces long options for zdb. It updates the usage message as well to include the long options. Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Manoj Joseph <[email protected]> Closes #12818
* zed: send notification email by defaultshodanshok2021-12-211-2/+2
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Gionatan Danti <[email protected]> Closes #12806
* zfs: iter: fix unused, remove argsusedнаб2021-12-211-3/+2
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* ztest: fix unused, remove argsusedнаб2021-12-211-35/+39
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zdb: il: fix unused, remove argsusedнаб2021-12-211-12/+10
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zdb: main: fix unused, remove argsusedнаб2021-12-211-31/+29
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zed: agents: fmd_api: fix unused, remove argsusedнаб2021-12-211-3/+21
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zed: agents: zfs_retire: fix unused, remove argsusedнаб2021-12-211-2/+1
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zed: agents: zfs_mod: fix unused, remove argsusedнаб2021-12-211-9/+7
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zed: agents: zfs_diagnosis: fix unused, remove argsusedнаб2021-12-211-20/+16
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zed: agents: fix unused, remove argsusedнаб2021-12-211-0/+2
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zed: exec: fix unused, remove argsusedнаб2021-12-211-1/+4
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zed: main: fix unused, remove argsusedнаб2021-12-211-0/+2
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zpool: vdev_os: fix unused, remove argsusedнаб2021-12-212-0/+3
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zpool: main: fix unused, remove argsusedнаб2021-12-211-19/+13
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zpool: iter: zpool_compare: fix unused, remove argsusedнаб2021-12-211-1/+1
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zinject: cancel_one_handler: fix unused, remove argsusedнаб2021-12-211-1/+1
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zhack: space_delta_cb: fix unused, remove argsusedнаб2021-12-211-1/+2
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* raidz_test: init_rand: fix unused, remove argsusedнаб2021-12-211-6/+2
| | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12835
* zfs list: Allow more fields in ZFS_ITER_SIMPLE modeAllan Jude2021-12-164-38/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the fields to be listed and sorted by are constrained to those populated by dsl_dataset_fast_stat(), then zfs list is much faster, as it does not need to open each objset and reads its properties. A previous optimization by Pawel Dawidek (0cee24064a79f9c01fc4521543c37acea538405f) took advantage of this to make listing snapshot names sorted only by name much faster. However, it was limited to `-o name -s name`, this work extends this optimization to work with: - name - guid - createtxg - numclones - inconsistent - redacted - origin and could be further extended to any other properties supported by dsl_dataset_fast_stat() or similar, that do not require extra locking or reading from disk. Reviewed-by: Mark Maybee <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Pawel Jakub Dawidek <[email protected]> Signed-off-by: Allan Jude <[email protected]> Closes #11080
* t/z_diff/socket, zfs: main: fix unused argument warnings, ARGSUSED tagsнаб2021-12-131-8/+5
| | | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rich Ercolani <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12829
* zfs, libzfs: diff: accept -h/ZFS_DIFF_NO_MANGLE, disabling path escapingнаб2021-12-131-1/+4
| | | | | | | Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rich Ercolani <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12829
* Add `const` to nvlist functions to properly expose their real behaviorPaul Dagnelie2021-12-066-15/+19
| | | | | | | | Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tony Nguyen <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Paul Dagnelie <[email protected]> Closes #12728
* Allow printing special vdev metaslab groupsRich Ercolani2021-11-301-3/+5
| | | | | | | | | Sometimes, we'd like to know info about the metaslab groups on special vdevs too. So let's make -MM do something useful. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Allan Jude <[email protected]> Signed-off-by: Rich Ercolani <[email protected]> Closes #12750
* Vdev Properties FeatureAllan Jude2021-11-303-120/+349
| | | | | | | | | | | | | | | | | | | | | | | | Add properties, similar to pool properties, to each vdev. This makes use of the existing per-vdev ZAP that was added as part of device evacuation/removal. A large number of read-only properties are exposed, many of the members of struct vdev_t, that provide useful statistics. Adds support for read-only "removing" vdev property. Adds the "allocating" property that defaults to "on" and can be set to "off" to prevent future allocations from that top-level vdev. Supports user-defined vdev properties. Includes support for properties.vdev in SYSFS. Co-authored-by: Allan Jude <[email protected]> Co-authored-by: Mark Maybee <[email protected]> Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Mark Maybee <[email protected]> Signed-off-by: Allan Jude <[email protected]> Closes #11711
* Remove basename(1). Clean up/shorten some coreutils pipelinesнаб2021-11-119-29/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Basenames that remain, in cmd/zed/zed.d/statechange-led.sh: dev=$(basename "$(echo "$therest" | awk '{print $(NF-1)}')") vdev=$(basename "$ZEVENT_VDEV_PATH") I don't wanna interfere with #11988 scripts/zfs-tests.sh: SINGLETESTFILE=$(basename "$SINGLETEST") tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list.kshlib: ACTUAL=$(basename $dataset) ACTUAL=$(basename $dataset) tests/zfs-tests/tests/functional/cli_user/zpool_iostat/ zpool_iostat_-c_homedir.ksh: typeset USER_SCRIPT=$(basename "$USER_SCRIPT_FULL") tests/zfs-tests/tests/functional/cli_user/zpool_iostat/ zpool_iostat_-c_searchpath.ksh: typeset CMD_1=$(basename "$SCRIPT_1") typeset CMD_2=$(basename "$SCRIPT_2") tests/zfs-tests/tests/functional/cli_user/zpool_status/ zpool_status_-c_homedir.ksh: typeset USER_SCRIPT=$(basename "$USER_SCRIPT_FULL") tests/zfs-tests/tests/functional/cli_user/zpool_status/ zpool_status_-c_searchpath.ksh typeset CMD_1=$(basename "$SCRIPT_1") typeset CMD_2=$(basename "$SCRIPT_2") tests/zfs-tests/tests/functional/migration/migration.cfg: export BNAME=`basename $TESTFILE` tests/zfs-tests/tests/perf/perf.shlib: typeset logbase="$(get_perf_output_dir)/$(basename \ tests/zfs-tests/tests/perf/perf.shlib: typeset logbase="$(get_perf_output_dir)/$(basename \ These are potentially Of Directories, where basename is actually useful Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: John Kennedy <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12652
* zhack: Add repair label optionFedor Uporov2021-11-111-1/+170
| | | | | | | | | | In case if all label checksums will be invalid on any vdev, the pool will become unimportable. The zhack with newly added cli options could be used to restore label checksums and make pool importable again. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Fedor Uporov <[email protected]> Closes #2510 Closes #12686
* zdb: Report bad label checksumFedor Uporov2021-11-101-4/+48
| | | | | | | | | | | | In case if all label checksums will be invalid on any vdev, the pool will become unimportable. From other side zdb with -l option will not provide any useful information why it happened. Add notifications about corrupted label checksums. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: John Kennedy <[email protected]> Signed-off-by: Fedor Uporov <[email protected]> Closes #2509 Closes #12685
* zed: Control NVMe fault LEDsTony Hutter2021-11-093-8/+77
| | | | | | | | | | The ZED code currently can only turn on the fault LED for a faulted disk in a JBOD enclosure. This extends support for faulted NVMe disks as well. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #12648 Closes #12695
* Skip spacemaps reading in case of pool readonly importFedor Uporov2021-11-091-0/+6
| | | | | | | | | | | | The only zdb utility require to read metaslab-related data during read-only pool import because of spacemaps validation. Add global variable which will allow zdb read spacemaps in case of readonly import mode. Reviewed-by: Serapheim Dimitropoulos <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Fedor Uporov <[email protected]> Closes #9095 Closes #12687
* Update `checkstyle` workflow env to ubuntu-20.04Damian Szuberski2021-11-021-1/+1
| | | | | | | | | - `checkstyle` workflow uses ubuntu-20.04 environment - improved `mancheck.sh` readability Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: John Kennedy <[email protected]> Signed-off-by: szubersk <[email protected]> Closes #12713
* vdev_id: Fix PHY sortingTony Hutter2021-10-291-1/+1
| | | | | | | | | | | | | | | | | One of our developers noticed a bug in vdev_id where we were incorrectly sorting PHYs using alphabetical sorting (which usually works) instead of natural sorting (-v). For example: [port-0:0]# ls -d phy* phy-0:10 phy-0:11 phy-0:8 phy-0:9 [port-0:0]# ls -vd phy* phy-0:8 phy-0:9 phy-0:10 phy-0:11 This fixes the issue. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #12699
* vdev_id: Fix enclosure_symlinks featureTony Hutter2021-10-201-2/+2
| | | | | | | | | | | | | | | | | | | | The vdev_id.conf "enclosure_symlinks" option persistently creates and maps /dev/by-enclosure symlinks to dynamic /dev/sg* devices. This patch fixes two issues: 1. The enclosure_symlinks feature was accidentally broken in: vdev_id: Support daisy-chained JBODs in multipath mode 2. Even when working, the feature numbered the enclosure sequentially rather than by HBA port number. That meant that if a port was down or didn't appear in sysfs, then the enclosure_sumlinks numbers would be numbered wrong. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Arshad Hussain <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #12660
* zpool should call zfs_nicestrtonum() with non-NULL handleToomas Soome2021-10-201-3/+4
| | | | | | | | | | When zfs_nicestrtonum() is called and there will be an error, the message is left in libzfs handle, if provided. We can use this message, to provide better feedback for user. Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Toomas Soome <[email protected]> Closes #12650
* Notify on UNAVAIL statechangeFrancesco Mazzoli2021-10-151-2/+3
| | | | | | | | | | | `UNAVAIL` is maybe not quite as concerning as `DEGRADED`, but still an event of notice, in my opinion. For example it is triggered when a drive goes missing. Reviewed-by: Don Brady <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Francesco Mazzoli <[email protected]> Closes #12629 Closes #12630
* zdb: fix overflow of time estimationTeodor Spæren2021-10-151-4/+5
| | | | | | | | | | The calculation of estimated time remaining in zdb -cc could overflow, as reported in #10666. This patch fixes this, by using uint64_t instead of ints in the calculations. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Teodor Spæren <[email protected]> Closes #10666 Closes #12610
* arcstat: Fix integer division with python3Valmiky Arquissandas2021-10-081-33/+33
| | | | | | | | | | | | | | The arcstat script requests compatibility with python2 and python3, but PEP 238 modified the / operator and results in erroneous output when run under python3. This commit replaces instances of / with //, yielding the expected result in both versions of Python. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Valmiky Arquissandas <[email protected]> Closes #12603
* Rescan enclosure sysfs path on importTony Hutter2021-10-044-50/+8
| | | | | | | | | | | | | | When you create a pool, zfs writes vd->vdev_enc_sysfs_path with the enclosure sysfs path to the fault LEDs, like: vdev_enc_sysfs_path = /sys/class/enclosure/0:0:1:0/SLOT8 However, this enclosure path doesn't get updated on successive imports even if enclosure path to the disk changes. This patch fixes the issue. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #11950 Closes #12095
* Use fallthrough macroBrian Behlendorf2021-09-144-3/+4
| | | | | | | | | | | | | | | As of the Linux 5.9 kernel a fallthrough macro has been added which should be used to anotate all intentional fallthrough paths. Once all of the kernel code paths have been updated to use fallthrough the -Wimplicit-fallthrough option will because the default. To avoid warnings in the OpenZFS code base when this happens apply the fallthrough macro. Additional reading: https://lwn.net/Articles/794944/ Reviewed-by: Tony Nguyen <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #12441
* Upstream: Add snapshot and zvol eventsJorgen Lundman2021-09-094-1/+5
| | | | | | | | | | | | | | For kernel to send snapshot mount/unmount events to zed. For kernel to send symlink creates/removes on zvol plumbing. (/dev/run/dsk/zvol/$pool/$zvol -> /dev/diskX) If zed misses the ENODEV, all errors after are EINVAL. Treat any error as kernel module failure. Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Jorgen Lundman <[email protected]> Closes #12416
* Upstream: zdb inode mappingJorgen Lundman2021-09-081-0/+11
| | | | | | | | | | | Unfortunately macOS reserves inode ID numbers 0-15, and we can not used them. In macOS port we simply map them really high IDs. Normally this is hidden inside the _os implementation, but this is the one place in the common source files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Jorgen Lundman <[email protected]> Closes #12530
* Detect iSCSI in the zpool cmd vdev media scriptDon Brady2021-09-021-1/+8
| | | | | | | | Reviewed-by: Serapheim Dimitropoulos <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Tony Nguyen <[email protected]> Signed-off-by: Don Brady <[email protected]> Closes #12206
* Fix cross-endian interoperability of zstdRich Ercolani2021-08-301-2/+4
| | | | | | | | | | | | | | | It turns out that layouts of union bitfields are a pain, and the current code results in an inconsistent layout between BE and LE systems, leading to zstd-active datasets on one erroring out on the other. Switch everyone over to the LE layout, and add compatibility code to read both. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Matthew Ahrens <[email protected]> Signed-off-by: Rich Ercolani <[email protected]> Closes #12008 Closes #12022
* Make 'zpool labelclear -f' work on offlined disksTony Hutter2021-08-271-1/+35
| | | | | | | | | This patch allows you to clear the label on offlined disks in an active pool with `-f`. Previously, labelclear wouldn't let you do that. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tony Nguyen <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #12511
* Extend zpool-iostat to account for ZIO_PRIORITY_REBUILD (#12319)Trevor Bautista2021-08-262-9/+28
| | | | | | | | | | | | | Previously, zpool-iostat did not display any data regarding rebuild I/Os in either the latency/size histograms (-w/-l/-r) or the queue data (-q). This fix essentially utilizes the existing infrastructure for tracking rebuild queue data and displays this data in the proper places within zpool-iostat's output. Signed-off-by: Trevor Bautista <[email protected]> Signed-off-by: Trevor Bautista <[email protected]> Co-authored-by: Trevor Bautista <[email protected]> Reviewed-by: Richard Elling <[email protected]> Reviewed-by: Tony Hutter <[email protected]>
* vdev_id: Return an error if config file is not found (#12508)Anton Gubarkov2021-08-251-2/+3
| | | | | Signed-off-by: Anton Gubarkov <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]>
* Move check_file to os/$platform sectionJorgen Lundman2021-07-264-1/+14
| | | | | | | | | | | | Keep check_file_generic() in shared code base, and allow special case code in check_file() in os section. In future, macOS will have additional checks in check_file(). Linux and FreeBSD wrappers just calls check_file_generic(). Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Jorgen Lundman <[email protected]> Closes #12385
* Read past end of argv array in zpool_do_import()Matthew Ahrens2021-07-261-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `zpool_do_import()` passes `argv[0]`, (optionally) `argv[1]`, and `pool_specified` to `import_pools()`. If `pool_specified==FALSE`, the `argv[]` arguments are not used. However, these values may be off the end of the `argv[]` array, so loading them could dereference unmapped memory. This error is reported by the asan build: ``` ================================================================= ==6003==ERROR: AddressSanitizer: heap-buffer-overflow READ of size 8 at 0x6030000004a8 thread T0 #0 0x562a078b50eb in zpool_do_import zpool_main.c:3796 #1 0x562a078858c5 in main zpool_main.c:10709 #2 0x7f5115231bf6 in __libc_start_main #3 0x562a07885eb9 in _start 0x6030000004a8 is located 0 bytes to the right of 24-byte region allocated by thread T0 here: #0 0x7f5116ac6b40 in __interceptor_malloc #1 0x562a07885770 in main zpool_main.c:10699 #2 0x7f5115231bf6 in __libc_start_main ``` This commit passes NULL for these arguments if they are off the end of the `argv[]` array. Reviewed-by: George Wilson <[email protected]> Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Allan Jude <[email protected]> Signed-off-by: Matthew Ahrens <[email protected]> Closes #12339