freebsd-dev/sys/contrib/openzfs/cmd/fsck.zfs.in
Martin Matuska 716fd348e0 zfs: merge openzfs/zfs@c0cf6ed67
Notable upstream pull request merges:
  #10662 zvol_wait: Ignore locked zvols
  #12789 Improve log spacemap load time
  #12812 Improved zpool status output, list all affected datasets
  #13277 FreeBSD: Use NDFREE_PNBUF if available
  #13302 Make zfs_max_recordsize default to 16M
  #13311 Fix error handling in FreeBSD's get/putpages VOPs
  #13345 FreeBSD: Fix translation from ABD to physical pages
  #13373 zfs: holds: dequadratify
  #13375 Corrected edge case in uncompressed ARC->L2ARC handling
  #13388 Improve mg_aliquot math
  #13405 Reduce dbuf_find() lock contention
  #13406 FreeBSD: use zero_region instead of allocating a dedicated page

Obtained from:	OpenZFS
OpenZFS commit:	c0cf6ed679
2022-05-19 00:55:59 +02:00

45 lines
756 B
Bash
Executable File

#!/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 [ $# -eq 0 ]; then
echo "Usage: $0 [options] dataset…" >&2
exit 16
fi
ret=0
for dataset; 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"