Notable upstream pull request merges:
#13680 Add options to zfs redundant_metadata property
#13758 Allow mounting snapshots in .zfs/snapshot as a regular user
#13838 quota: disable quota check for ZVOL
#13839 quota: extend quota for dataset
#13973 Fix memory leaks in dmu_send()/dmu_send_obj()
#13977 Avoid unnecessary metaslab_check_free calling
#13978 PAM: Fix unchecked return value from zfs_key_config_load()
#13979 Handle possible null pointers from malloc/strdup/strndup()
#13997 zstream: allow decompress to fix metadata for uncompressed
records
#13998 zvol_wait logic may terminate prematurely
#14001 FreeBSD: Fix a pair of bugs in zfs_fhtovp()
#14003 Stop ganging due to past vdev write errors
#14039 Optimize microzaps
#14050 Fix draid2+2s metadata error on simultaneous 2 drive failures
#14062 zed: Avoid core dump if wholedisk property does not exist
#14077 Propagate extent_bytes change to autotrim thread
#14079 FreeBSD: vn_flush_cached_data: observe vnode locking contract
#14093 Fix ARC target collapse when zfs_arc_meta_limit_percent=100
#14106 Add ability to recompress send streams with new compression
algorithm
#14119 Deny receiving into encrypted datasets if the keys are not
loaded
#14120 Fix arc_p aggressive increase
#14129 zed: Prevent special vdev to be replaced by hot spare
#14133 Expose zfs_vdev_open_timeout_ms as a tunable
#14135 FreeBSD: Fix out of bounds read in zfs_ioctl_ozfs_to_legacy()
#14152 Adds the `-p` option to `zfs holds`
#14161 Handle and detect #13709's unlock regression
Obtained from: OpenZFS
OpenZFS commit: 2163cde450
123 lines
2.8 KiB
Bash
Executable File
123 lines
2.8 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
count_zvols() {
|
|
if [ -z "$zvols" ]; then
|
|
echo 0
|
|
else
|
|
echo "$zvols" | wc -l
|
|
fi
|
|
}
|
|
|
|
filter_out_zvols_with_links() {
|
|
echo "$zvols" | tr ' ' '+' | while read -r zvol; do
|
|
if ! [ -L "/dev/zvol/$zvol" ]; then
|
|
echo "$zvol"
|
|
fi
|
|
done | tr '+' ' '
|
|
}
|
|
|
|
filter_out_deleted_zvols() {
|
|
OIFS="$IFS"
|
|
IFS="
|
|
"
|
|
# shellcheck disable=SC2086
|
|
zfs list -H -o name $zvols 2>/dev/null
|
|
IFS="$OIFS"
|
|
}
|
|
|
|
list_zvols() {
|
|
read -r default_volmode < /sys/module/zfs/parameters/zvol_volmode
|
|
zfs list -t volume -H -o \
|
|
name,volmode,receive_resume_token,redact_snaps,keystatus |
|
|
while IFS=" " read -r name volmode token redacted keystatus; do # IFS=\t here!
|
|
|
|
# /dev links are not created for zvols with volmode = "none",
|
|
# redacted zvols, or encrypted zvols for which the key has not
|
|
# been loaded.
|
|
[ "$volmode" = "none" ] && continue
|
|
[ "$volmode" = "default" ] && [ "$default_volmode" = "3" ] &&
|
|
continue
|
|
[ "$redacted" = "-" ] || continue
|
|
[ "$keystatus" = "unavailable" ] && continue
|
|
|
|
# We also ignore partially received zvols if it is
|
|
# not an incremental receive, as those won't even have a block
|
|
# device minor node created yet.
|
|
if [ "$token" != "-" ]; then
|
|
|
|
# Incremental receives create an invisible clone that
|
|
# is not automatically displayed by zfs list.
|
|
if ! zfs list "$name/%recv" >/dev/null 2>&1; then
|
|
continue
|
|
fi
|
|
fi
|
|
echo "$name"
|
|
done
|
|
}
|
|
|
|
zvols=$(list_zvols)
|
|
zvols_count=$(count_zvols)
|
|
if [ "$zvols_count" -eq 0 ]; then
|
|
echo "No zvols found, nothing to do."
|
|
exit 0
|
|
fi
|
|
|
|
echo "Testing $zvols_count zvol links"
|
|
|
|
outer_loop=0
|
|
while [ "$outer_loop" -lt 20 ]; do
|
|
outer_loop=$((outer_loop + 1))
|
|
|
|
old_zvols_count=$(count_zvols)
|
|
|
|
inner_loop=0
|
|
while [ "$inner_loop" -lt 30 ]; do
|
|
inner_loop=$((inner_loop + 1))
|
|
|
|
zvols="$(filter_out_zvols_with_links)"
|
|
|
|
zvols_count=$(count_zvols)
|
|
if [ "$zvols_count" -eq 0 ]; then
|
|
echo "All zvol links are now present."
|
|
exit 0
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
echo "Still waiting on $zvols_count zvol links ..."
|
|
#
|
|
# Although zvols should normally not be deleted at boot time,
|
|
# if that is the case then their links will be missing and
|
|
# we would stall.
|
|
#
|
|
if [ "$old_zvols_count" -eq "$zvols_count" ]; then
|
|
echo "No progress since last loop."
|
|
echo "Checking if any zvols were deleted."
|
|
|
|
zvols=$(filter_out_deleted_zvols)
|
|
zvols_count=$(count_zvols)
|
|
|
|
if [ "$old_zvols_count" -ne "$zvols_count" ]; then
|
|
echo "$((old_zvols_count - zvols_count)) zvol(s) deleted."
|
|
fi
|
|
|
|
if [ "$zvols_count" -ne 0 ]; then
|
|
echo "Remaining zvols:"
|
|
echo "$zvols"
|
|
else
|
|
echo "All zvol links are now present."
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
#
|
|
# zvol_count made some progress - let's stay in this loop.
|
|
#
|
|
if [ "$old_zvols_count" -gt "$zvols_count" ]; then
|
|
outer_loop=$((outer_loop - 1))
|
|
fi
|
|
done
|
|
|
|
echo "Timed out waiting on zvol links"
|
|
exit 1
|