aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/cmd/fsck_zfs
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2021-06-08 14:48:37 +0000
committerMartin Matuska <mm@FreeBSD.org>2021-06-08 14:52:44 +0000
commit1603881667360c015f6685131f2f25474fa67a72 (patch)
tree1e2793b4b19eabab1534c3dd2074e3ca022c5e76 /sys/contrib/openzfs/cmd/fsck_zfs
parented9215c8e05f06c00683bb0624e82644796d4385 (diff)
parent75b4cbf62590c23fac3667537961a2a75fdc2cc3 (diff)
downloadsrc-1603881667360c015f6685131f2f25474fa67a72.tar.gz
src-1603881667360c015f6685131f2f25474fa67a72.zip
zfs: merge openzfs/zfs@75b4cbf62 (master) into main
Notable upstream pull request merges: #11710 Allow zfs to send replication streams with missing snapshots #11751 Avoid taking global lock to destroy zfsdev state #11786 Ratelimit deadman zevents as with delay zevents #11803 ZFS traverse_visitbp optimization to limit prefetch #11813 Allow pool names that look like Solaris disk names #11822 Atomically check and set dropped zevent count #11822 Don't scale zfs_zevent_len_max by CPU count #11833 Refactor zfsdev state init/destroy to share common code #11837 zfs get -p only outputs 3 columns if "clones" property is empty #11843 libzutil: zfs_isnumber(): return false if input empty #11849 Use dsl_scan_setup_check() to setup a scrub #11861 Improvements to the 'compatibility' property #11862 cmd/zfs receive: allow dry-run (-n) to check property args #11864 receive: don't fail inheriting (-x) properties on wrong dataset type #11877 Combine zio caches if possible #11881 FreeBSD: use vnlru_free_vfsops if available #11883 FreeBSD: add support for lockless symlink lookup #11884 FreeBSD: add missing seqc write begin/end around zfs_acl_chown_setattr #11896 Fix crash in zio_done error reporting #11905 zfs-send(8): Restore sorting of flags #11926 FreeBSD: damage control racing .. lookups in face of mkdir/rmdir #11930 vdev_mirror: don't scrub/resilver devices that can't be read #11938 Fix AVX512BW Fletcher code on AVX512-but-not-BW machines #11955 zfs get: don't lookup mount options when using "-s local" #11956 libzfs: add keylocation=https://, backed by fetch(3) or libcurl #11959 vdev_id: variable not getting expanded under map_slot() #11966 Scale worker threads and taskqs with number of CPUs #11994 Clean up use of zfs_log_create in zfs_dir #11997 FreeBSD: Don't force xattr mount option #11997 FreeBSD: Implement xattr=sa #11997 FreeBSD: Use SET_ERROR to trace xattr name errors #11998 Simplify/fix dnode_move() for dn_zfetch #12003 FreeBSD: Initialize/destroy zp->z_lock #12010 Fix dRAID self-healing short columns #12033 Revert "Fix raw sends on encrypted datasets when copying back snapshots" #12040 Reinstate the old zpool read label logic as a fallback #12046 Improve scrub maxinflight_bytes math #12049 FreeBSD: avoid memory allocation in arc_prune_async #12052 FreeBSD: incorporate changes to the VFS_QUOTACTL(9) KPI #12061 Fix dRAID sequential resilver silent damage handling #12072 Let zfs diff be more permissive #12077 FreeBSD: Retry OCF ENOMEM errors. #12088 Propagate vdev state due to invalid label corruption #12091 libzfs: On FreeBSD, use MNT_NOWAIT with getfsstat #12097 FreeBSD: Update dataset_kstats for zvols in dev mode #12104 FreeBSD boot code reminder after zpool upgrade #12114 Introduce write-mostly sums Obtained from: OpenZFS OpenZFS commit: 75b4cbf62590c23fac3667537961a2a75fdc2cc3
Diffstat (limited to 'sys/contrib/openzfs/cmd/fsck_zfs')
-rw-r--r--sys/contrib/openzfs/cmd/fsck_zfs/.gitignore1
-rw-r--r--sys/contrib/openzfs/cmd/fsck_zfs/Makefile.am5
-rwxr-xr-xsys/contrib/openzfs/cmd/fsck_zfs/fsck.zfs9
-rwxr-xr-xsys/contrib/openzfs/cmd/fsck_zfs/fsck.zfs.in44
4 files changed, 50 insertions, 9 deletions
diff --git a/sys/contrib/openzfs/cmd/fsck_zfs/.gitignore b/sys/contrib/openzfs/cmd/fsck_zfs/.gitignore
new file mode 100644
index 000000000000..0edf0309e94a
--- /dev/null
+++ b/sys/contrib/openzfs/cmd/fsck_zfs/.gitignore
@@ -0,0 +1 @@
+/fsck.zfs
diff --git a/sys/contrib/openzfs/cmd/fsck_zfs/Makefile.am b/sys/contrib/openzfs/cmd/fsck_zfs/Makefile.am
index 2380f56fa4d4..f8139f117ff2 100644
--- a/sys/contrib/openzfs/cmd/fsck_zfs/Makefile.am
+++ b/sys/contrib/openzfs/cmd/fsck_zfs/Makefile.am
@@ -1 +1,6 @@
+include $(top_srcdir)/config/Substfiles.am
+include $(top_srcdir)/config/Shellcheck.am
+
dist_sbin_SCRIPTS = fsck.zfs
+
+SUBSTFILES += $(dist_sbin_SCRIPTS)
diff --git a/sys/contrib/openzfs/cmd/fsck_zfs/fsck.zfs b/sys/contrib/openzfs/cmd/fsck_zfs/fsck.zfs
deleted file mode 100755
index 129a7f39c388..000000000000
--- a/sys/contrib/openzfs/cmd/fsck_zfs/fsck.zfs
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-#
-# fsck.zfs: A fsck helper to accommodate distributions that expect
-# to be able to execute a fsck on all filesystem types. Currently
-# this script does nothing but it could be extended to act as a
-# compatibility wrapper for 'zpool scrub'.
-#
-
-exit 0
diff --git a/sys/contrib/openzfs/cmd/fsck_zfs/fsck.zfs.in b/sys/contrib/openzfs/cmd/fsck_zfs/fsck.zfs.in
new file mode 100755
index 000000000000..37096902cb94
--- /dev/null
+++ b/sys/contrib/openzfs/cmd/fsck_zfs/fsck.zfs.in
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# fsck.zfs: A fsck helper to accommodate distributions that expect
+# to be able to execute a fsck on all filesystem types.
+#
+# This script simply bubbles up some already-known-about errors,
+# see fsck.zfs(8)
+#
+
+if [ "$#" = "0" ]; then
+ echo "Usage: $0 [options] dataset…" >&2
+ exit 16
+fi
+
+ret=0
+for dataset in "$@"; do
+ case "$dataset" in
+ -*)
+ continue
+ ;;
+ *)
+ ;;
+ esac
+
+ pool="${dataset%%/*}"
+
+ case "$(@sbindir@/zpool list -Ho health "$pool")" in
+ DEGRADED)
+ ret=$(( ret | 4 ))
+ ;;
+ FAULTED)
+ awk '!/^([[:space:]]*#.*)?$/ && $1 == "'"$dataset"'" && $3 == "zfs" {exit 1}' /etc/fstab || \
+ ret=$(( ret | 8 ))
+ ;;
+ "")
+ # Pool not found, error printed by zpool(8)
+ ret=$(( ret | 8 ))
+ ;;
+ *)
+ ;;
+ esac
+done
+
+exit "$ret"