zfs: merge openzfs/zfs@269b5dadc (master) into main
Notable upstream pull request merges: #12285 Introduce a tunable to exclude special class buffers from L2ARC #12689 Check l2cache vdevs pending list inside the vdev_inuse() #12735 Enable edonr in FreeBSD #12743 FreeBSD: fix world build after de198f2 #12745 Restore dirty dnode detection logic Obtained from: OpenZFS OpenZFS commit: 269b5dadcfd1d5732cf763dddcd46009a332eae4
This commit is contained in:
commit
dae1713419
@ -596,7 +596,9 @@ enclosure_handler () {
|
||||
# DEVPATH=/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0/host0/subsystem/devices/0:0:0:0/scsi_generic/sg0
|
||||
|
||||
# Get the enclosure ID ("0:0:0:0")
|
||||
ENC=$(basename $(readlink -m "/sys/$DEVPATH/../.."))
|
||||
ENC="${DEVPATH%/*}"
|
||||
ENC="${ENC%/*}"
|
||||
ENC="${ENC##*/}"
|
||||
if [ ! -d "/sys/class/enclosure/$ENC" ] ; then
|
||||
# Not an enclosure, bail out
|
||||
return
|
||||
@ -616,10 +618,11 @@ enclosure_handler () {
|
||||
|
||||
# The PCI directory is two directories up from the port directory
|
||||
# /sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0
|
||||
PCI_ID_LONG=$(basename $(readlink -m "/sys/$PORT_DIR/../.."))
|
||||
PCI_ID_LONG="$(readlink -m "/sys/$PORT_DIR/../..")"
|
||||
PCI_ID_LONG="${PCI_ID_LONG##*/}"
|
||||
|
||||
# Strip down the PCI address from 0000:05:00.0 to 05:00.0
|
||||
PCI_ID=$(echo "$PCI_ID_LONG" | sed -r 's/^[0-9]+://g')
|
||||
PCI_ID="${PCI_ID_LONG#[0-9]*:}"
|
||||
|
||||
# Name our device according to vdev_id.conf (like "L0" or "U1").
|
||||
NAME=$(awk "/channel/{if (\$1 == \"channel\" && \$2 == \"$PCI_ID\" && \
|
||||
@ -674,7 +677,7 @@ alias_handler () {
|
||||
link=$(echo "$link" | sed 's/p[0-9][0-9]*$//')
|
||||
fi
|
||||
# Check both the fully qualified and the base name of link.
|
||||
for l in $link $(basename "$link") ; do
|
||||
for l in $link ${link##*/} ; do
|
||||
if [ ! -z "$l" ]; then
|
||||
alias=$(awk -v var="$l" '($1 == "alias") && \
|
||||
($3 == var) \
|
||||
|
@ -4221,11 +4221,13 @@ print_label_numbers(char *prefix, cksum_record_t *rec)
|
||||
|
||||
typedef struct zdb_label {
|
||||
vdev_label_t label;
|
||||
uint64_t label_offset;
|
||||
nvlist_t *config_nv;
|
||||
cksum_record_t *config;
|
||||
cksum_record_t *uberblocks[MAX_UBERBLOCK_COUNT];
|
||||
boolean_t header_printed;
|
||||
boolean_t read_failed;
|
||||
boolean_t cksum_valid;
|
||||
} zdb_label_t;
|
||||
|
||||
static void
|
||||
@ -4239,7 +4241,8 @@ print_label_header(zdb_label_t *label, int l)
|
||||
return;
|
||||
|
||||
(void) printf("------------------------------------\n");
|
||||
(void) printf("LABEL %d\n", l);
|
||||
(void) printf("LABEL %d %s\n", l,
|
||||
label->cksum_valid ? "" : "(Bad label cksum)");
|
||||
(void) printf("------------------------------------\n");
|
||||
|
||||
label->header_printed = B_TRUE;
|
||||
@ -4751,6 +4754,42 @@ zdb_copy_object(objset_t *os, uint64_t srcobj, char *destfile)
|
||||
return (err);
|
||||
}
|
||||
|
||||
static boolean_t
|
||||
label_cksum_valid(vdev_label_t *label, uint64_t offset)
|
||||
{
|
||||
zio_checksum_info_t *ci = &zio_checksum_table[ZIO_CHECKSUM_LABEL];
|
||||
zio_cksum_t expected_cksum;
|
||||
zio_cksum_t actual_cksum;
|
||||
zio_cksum_t verifier;
|
||||
zio_eck_t *eck;
|
||||
int byteswap;
|
||||
|
||||
void *data = (char *)label + offsetof(vdev_label_t, vl_vdev_phys);
|
||||
eck = (zio_eck_t *)((char *)(data) + VDEV_PHYS_SIZE) - 1;
|
||||
|
||||
offset += offsetof(vdev_label_t, vl_vdev_phys);
|
||||
ZIO_SET_CHECKSUM(&verifier, offset, 0, 0, 0);
|
||||
|
||||
byteswap = (eck->zec_magic == BSWAP_64(ZEC_MAGIC));
|
||||
if (byteswap)
|
||||
byteswap_uint64_array(&verifier, sizeof (zio_cksum_t));
|
||||
|
||||
expected_cksum = eck->zec_cksum;
|
||||
eck->zec_cksum = verifier;
|
||||
|
||||
abd_t *abd = abd_get_from_buf(data, VDEV_PHYS_SIZE);
|
||||
ci->ci_func[byteswap](abd, VDEV_PHYS_SIZE, NULL, &actual_cksum);
|
||||
abd_free(abd);
|
||||
|
||||
if (byteswap)
|
||||
byteswap_uint64_array(&expected_cksum, sizeof (zio_cksum_t));
|
||||
|
||||
if (ZIO_CHECKSUM_EQUAL(actual_cksum, expected_cksum))
|
||||
return (B_TRUE);
|
||||
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
static int
|
||||
dump_label(const char *dev)
|
||||
{
|
||||
@ -4817,8 +4856,9 @@ dump_label(const char *dev)
|
||||
|
||||
/*
|
||||
* 1. Read the label from disk
|
||||
* 2. Unpack the configuration and insert in config tree.
|
||||
* 3. Traverse all uberblocks and insert in uberblock tree.
|
||||
* 2. Verify label cksum
|
||||
* 3. Unpack the configuration and insert in config tree.
|
||||
* 4. Traverse all uberblocks and insert in uberblock tree.
|
||||
*/
|
||||
for (int l = 0; l < VDEV_LABELS; l++) {
|
||||
zdb_label_t *label = &labels[l];
|
||||
@ -4829,8 +4869,10 @@ dump_label(const char *dev)
|
||||
zio_cksum_t cksum;
|
||||
vdev_t vd;
|
||||
|
||||
label->label_offset = vdev_label_offset(psize, l, 0);
|
||||
|
||||
if (pread64(fd, &label->label, sizeof (label->label),
|
||||
vdev_label_offset(psize, l, 0)) != sizeof (label->label)) {
|
||||
label->label_offset) != sizeof (label->label)) {
|
||||
if (!dump_opt['q'])
|
||||
(void) printf("failed to read label %d\n", l);
|
||||
label->read_failed = B_TRUE;
|
||||
@ -4839,6 +4881,8 @@ dump_label(const char *dev)
|
||||
}
|
||||
|
||||
label->read_failed = B_FALSE;
|
||||
label->cksum_valid = label_cksum_valid(&label->label,
|
||||
label->label_offset);
|
||||
|
||||
if (nvlist_unpack(buf, buflen, &config, 0) == 0) {
|
||||
nvlist_t *vdev_tree = NULL;
|
||||
|
@ -21,7 +21,7 @@ if [ "${ZED_SYSLOG_DISPLAY_GUIDS}" = "1" ]; then
|
||||
[ -n "${ZEVENT_VDEV_GUID}" ] && msg="${msg} vdev_guid=${ZEVENT_VDEV_GUID}"
|
||||
else
|
||||
[ -n "${ZEVENT_POOL}" ] && msg="${msg} pool='${ZEVENT_POOL}'"
|
||||
[ -n "${ZEVENT_VDEV_PATH}" ] && msg="${msg} vdev=$(basename "${ZEVENT_VDEV_PATH}")"
|
||||
[ -n "${ZEVENT_VDEV_PATH}" ] && msg="${msg} vdev=${ZEVENT_VDEV_PATH##*/}"
|
||||
fi
|
||||
|
||||
# log pool state if state is anything other than 'ACTIVE'
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
# Rate-limit the notification based in part on the filename.
|
||||
#
|
||||
rate_limit_tag="${ZEVENT_POOL};${ZEVENT_SUBCLASS};$(basename -- "$0")"
|
||||
rate_limit_tag="${ZEVENT_POOL};${ZEVENT_SUBCLASS};${0##*/}"
|
||||
rate_limit_interval="${ZED_NOTIFY_INTERVAL_SECS}"
|
||||
zed_rate_limit "${rate_limit_tag}" "${rate_limit_interval}" || exit 3
|
||||
|
||||
|
@ -77,7 +77,7 @@ zed_log_msg()
|
||||
zed_log_err()
|
||||
{
|
||||
logger -p "${ZED_SYSLOG_PRIORITY}" -t "${ZED_SYSLOG_TAG}" -- "error:" \
|
||||
"$(basename -- "$0"):""${ZEVENT_EID:+" eid=${ZEVENT_EID}:"}" "$@"
|
||||
"${0##*/}:""${ZEVENT_EID:+" eid=${ZEVENT_EID}:"}" "$@"
|
||||
}
|
||||
|
||||
|
||||
@ -258,7 +258,7 @@ zed_notify_email()
|
||||
[ -n "${subject}" ] || return 1
|
||||
if [ ! -r "${pathname}" ]; then
|
||||
zed_log_err \
|
||||
"$(basename "${ZED_EMAIL_PROG}") cannot read \"${pathname}\""
|
||||
"${ZED_EMAIL_PROG##*/} cannot read \"${pathname}\""
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -270,7 +270,7 @@ zed_notify_email()
|
||||
eval ${ZED_EMAIL_PROG} ${ZED_EMAIL_OPTS} < "${pathname}" >/dev/null 2>&1
|
||||
rv=$?
|
||||
if [ "${rv}" -ne 0 ]; then
|
||||
zed_log_err "$(basename "${ZED_EMAIL_PROG}") exit=${rv}"
|
||||
zed_log_err "${ZED_EMAIL_PROG##*/} exit=${rv}"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/zfs_context.h>
|
||||
#include <sys/spa.h>
|
||||
#include <sys/spa_impl.h>
|
||||
@ -41,6 +42,7 @@
|
||||
#include <sys/zfs_znode.h>
|
||||
#include <sys/dsl_synctask.h>
|
||||
#include <sys/vdev.h>
|
||||
#include <sys/vdev_impl.h>
|
||||
#include <sys/fs/zfs.h>
|
||||
#include <sys/dmu_objset.h>
|
||||
#include <sys/dsl_pool.h>
|
||||
@ -76,7 +78,12 @@ usage(void)
|
||||
" -d decrease instead of increase the refcount\n"
|
||||
" -m add the feature to the label if increasing refcount\n"
|
||||
"\n"
|
||||
" <feature> : should be a feature guid\n");
|
||||
" <feature> : should be a feature guid\n"
|
||||
"\n"
|
||||
" label repair <device>\n"
|
||||
" repair corrupted label checksums\n"
|
||||
"\n"
|
||||
" <device> : path to vdev\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -471,6 +478,166 @@ zhack_do_feature(int argc, char **argv)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
zhack_repair_label_cksum(int argc, char **argv)
|
||||
{
|
||||
zio_checksum_info_t *ci = &zio_checksum_table[ZIO_CHECKSUM_LABEL];
|
||||
const char *cfg_keys[] = { ZPOOL_CONFIG_VERSION,
|
||||
ZPOOL_CONFIG_POOL_STATE, ZPOOL_CONFIG_GUID };
|
||||
boolean_t labels_repaired[VDEV_LABELS];
|
||||
boolean_t repaired = B_FALSE;
|
||||
vdev_label_t labels[VDEV_LABELS];
|
||||
struct stat st;
|
||||
int fd;
|
||||
|
||||
bzero(labels_repaired, sizeof (labels_repaired));
|
||||
bzero(labels, sizeof (labels));
|
||||
|
||||
abd_init();
|
||||
|
||||
argc -= 1;
|
||||
argv += 1;
|
||||
|
||||
if (argc < 1) {
|
||||
(void) fprintf(stderr, "error: missing device\n");
|
||||
usage();
|
||||
}
|
||||
|
||||
if ((fd = open(argv[0], O_RDWR)) == -1)
|
||||
fatal(NULL, FTAG, "cannot open '%s': %s", argv[0],
|
||||
strerror(errno));
|
||||
|
||||
if (stat(argv[0], &st) != 0)
|
||||
fatal(NULL, FTAG, "cannot stat '%s': %s", argv[0],
|
||||
strerror(errno));
|
||||
|
||||
for (int l = 0; l < VDEV_LABELS; l++) {
|
||||
uint64_t label_offset, offset;
|
||||
zio_cksum_t expected_cksum;
|
||||
zio_cksum_t actual_cksum;
|
||||
zio_cksum_t verifier;
|
||||
zio_eck_t *eck;
|
||||
nvlist_t *cfg;
|
||||
int byteswap;
|
||||
uint64_t val;
|
||||
ssize_t err;
|
||||
|
||||
vdev_label_t *vl = &labels[l];
|
||||
|
||||
label_offset = vdev_label_offset(st.st_size, l, 0);
|
||||
err = pread64(fd, vl, sizeof (vdev_label_t), label_offset);
|
||||
if (err == -1) {
|
||||
(void) fprintf(stderr, "error: cannot read "
|
||||
"label %d: %s\n", l, strerror(errno));
|
||||
continue;
|
||||
} else if (err != sizeof (vdev_label_t)) {
|
||||
(void) fprintf(stderr, "error: bad label %d read size "
|
||||
"\n", l);
|
||||
continue;
|
||||
}
|
||||
|
||||
err = nvlist_unpack(vl->vl_vdev_phys.vp_nvlist,
|
||||
VDEV_PHYS_SIZE - sizeof (zio_eck_t), &cfg, 0);
|
||||
if (err) {
|
||||
(void) fprintf(stderr, "error: cannot unpack nvlist "
|
||||
"label %d\n", l);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(cfg_keys); i++) {
|
||||
err = nvlist_lookup_uint64(cfg, cfg_keys[i], &val);
|
||||
if (err) {
|
||||
(void) fprintf(stderr, "error: label %d: "
|
||||
"cannot find nvlist key %s\n",
|
||||
l, cfg_keys[i]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
void *data = (char *)vl + offsetof(vdev_label_t, vl_vdev_phys);
|
||||
eck = (zio_eck_t *)((char *)(data) + VDEV_PHYS_SIZE) - 1;
|
||||
|
||||
offset = label_offset + offsetof(vdev_label_t, vl_vdev_phys);
|
||||
ZIO_SET_CHECKSUM(&verifier, offset, 0, 0, 0);
|
||||
|
||||
byteswap = (eck->zec_magic == BSWAP_64(ZEC_MAGIC));
|
||||
if (byteswap)
|
||||
byteswap_uint64_array(&verifier, sizeof (zio_cksum_t));
|
||||
|
||||
expected_cksum = eck->zec_cksum;
|
||||
eck->zec_cksum = verifier;
|
||||
|
||||
abd_t *abd = abd_get_from_buf(data, VDEV_PHYS_SIZE);
|
||||
ci->ci_func[byteswap](abd, VDEV_PHYS_SIZE, NULL, &actual_cksum);
|
||||
abd_free(abd);
|
||||
|
||||
if (byteswap)
|
||||
byteswap_uint64_array(&expected_cksum,
|
||||
sizeof (zio_cksum_t));
|
||||
|
||||
if (ZIO_CHECKSUM_EQUAL(actual_cksum, expected_cksum))
|
||||
continue;
|
||||
|
||||
eck->zec_cksum = actual_cksum;
|
||||
|
||||
err = pwrite64(fd, data, VDEV_PHYS_SIZE, offset);
|
||||
if (err == -1) {
|
||||
(void) fprintf(stderr, "error: cannot write "
|
||||
"label %d: %s\n", l, strerror(errno));
|
||||
continue;
|
||||
} else if (err != VDEV_PHYS_SIZE) {
|
||||
(void) fprintf(stderr, "error: bad write size "
|
||||
"label %d\n", l);
|
||||
continue;
|
||||
}
|
||||
|
||||
fsync(fd);
|
||||
|
||||
labels_repaired[l] = B_TRUE;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
abd_fini();
|
||||
|
||||
for (int l = 0; l < VDEV_LABELS; l++) {
|
||||
(void) printf("label %d: %s\n", l,
|
||||
labels_repaired[l] ? "repaired" : "skipped");
|
||||
repaired |= labels_repaired[l];
|
||||
}
|
||||
|
||||
if (repaired)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int
|
||||
zhack_do_label(int argc, char **argv)
|
||||
{
|
||||
char *subcommand;
|
||||
int err;
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
if (argc == 0) {
|
||||
(void) fprintf(stderr,
|
||||
"error: no label operation specified\n");
|
||||
usage();
|
||||
}
|
||||
|
||||
subcommand = argv[0];
|
||||
if (strcmp(subcommand, "repair") == 0) {
|
||||
err = zhack_repair_label_cksum(argc, argv);
|
||||
} else {
|
||||
(void) fprintf(stderr, "error: unknown subcommand: %s\n",
|
||||
subcommand);
|
||||
usage();
|
||||
}
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
#define MAX_NUM_PATHS 1024
|
||||
|
||||
int
|
||||
@ -516,6 +683,8 @@ main(int argc, char **argv)
|
||||
|
||||
if (strcmp(subcommand, "feature") == 0) {
|
||||
rv = zhack_do_feature(argc, argv);
|
||||
} else if (strcmp(subcommand, "label") == 0) {
|
||||
return (zhack_do_label(argc, argv));
|
||||
} else {
|
||||
(void) fprintf(stderr, "error: unknown subcommand: %s\n",
|
||||
subcommand);
|
||||
|
@ -16,14 +16,12 @@ if [ -L "$dev" ] ; then
|
||||
dev=$(readlink "$dev")
|
||||
fi
|
||||
|
||||
dev=$(basename "$dev")
|
||||
dev="${dev##*/}"
|
||||
val=""
|
||||
if [ -d "/sys/class/block/$dev/slaves" ] ; then
|
||||
# ls -C: output in columns, no newlines
|
||||
val=$(ls -C "/sys/class/block/$dev/slaves")
|
||||
|
||||
# ls -C will print two spaces between files; change to one space.
|
||||
val=$(echo "$val" | sed -r 's/[[:blank:]]+/ /g')
|
||||
# ls -C: output in columns, no newlines, two spaces (change to one)
|
||||
# shellcheck disable=SC2012
|
||||
val=$(ls -C "/sys/class/block/$dev/slaves" | tr -s '[:space:]' ' ')
|
||||
fi
|
||||
|
||||
echo "dm-deps=$val"
|
||||
|
@ -9,7 +9,7 @@ iostat: Show iostat values since boot (summary page).
|
||||
iostat-1s: Do a single 1-second iostat sample and show values.
|
||||
iostat-10s: Do a single 10-second iostat sample and show values."
|
||||
|
||||
script=$(basename "$0")
|
||||
script="${0##*/}"
|
||||
if [ "$1" = "-h" ] ; then
|
||||
echo "$helpstr" | grep "$script:" | tr -s '\t' | cut -f 2-
|
||||
exit
|
||||
@ -42,7 +42,7 @@ else
|
||||
${brief:+"-y"} \
|
||||
${interval:+"$interval"} \
|
||||
${interval:+"1"} \
|
||||
"$VDEV_UPATH" | awk NF | tail -n 2)
|
||||
"$VDEV_UPATH" | grep -v '^$' | tail -n 2)
|
||||
fi
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ fi
|
||||
cols=$(echo "$out" | head -n 1)
|
||||
|
||||
# Get the values and tab separate them to make them cut-able.
|
||||
vals=$(echo "$out" | tail -n 1 | sed -r 's/[[:blank:]]+/\t/g')
|
||||
vals=$(echo "$out" | tail -n 1 | tr -s '[:space:]' '\t')
|
||||
|
||||
i=0
|
||||
for col in $cols ; do
|
||||
|
@ -48,7 +48,7 @@ size: Show the disk capacity.
|
||||
vendor: Show the disk vendor.
|
||||
lsblk: Show the disk size, vendor, and model number."
|
||||
|
||||
script=$(basename "$0")
|
||||
script="${0##*/}"
|
||||
|
||||
if [ "$1" = "-h" ] ; then
|
||||
echo "$helpstr" | grep "$script:" | tr -s '\t' | cut -f 2-
|
||||
|
@ -9,15 +9,12 @@ if [ "$1" = "-h" ] ; then
|
||||
fi
|
||||
|
||||
if [ -b "$VDEV_UPATH" ]; then
|
||||
device=$(basename "$VDEV_UPATH")
|
||||
val=$(cat "/sys/block/$device/queue/rotational" 2>/dev/null)
|
||||
if [ "$val" = "0" ]; then
|
||||
MEDIA="ssd"
|
||||
fi
|
||||
|
||||
if [ "$val" = "1" ]; then
|
||||
MEDIA="hdd"
|
||||
fi
|
||||
device="${VDEV_UPATH##*/}"
|
||||
read -r val 2>/dev/null < "/sys/block/$device/queue/rotational"
|
||||
case "$val" in
|
||||
0) MEDIA="ssd" ;;
|
||||
1) MEDIA="hdd" ;;
|
||||
esac
|
||||
|
||||
vpd_pg83="/sys/block/$device/device/vpd_pg83"
|
||||
if [ -f "$vpd_pg83" ]; then
|
||||
|
@ -11,7 +11,7 @@ fault_led: Show value of the disk enclosure slot fault LED.
|
||||
locate_led: Show value of the disk enclosure slot locate LED.
|
||||
ses: Show disk's enc, enc device, slot, and fault/locate LED values."
|
||||
|
||||
script=$(basename "$0")
|
||||
script="${0##*/}"
|
||||
if [ "$1" = "-h" ] ; then
|
||||
echo "$helpstr" | grep "$script:" | tr -s '\t' | cut -f 2-
|
||||
exit
|
||||
|
@ -28,7 +28,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYTHON], [
|
||||
dnl #
|
||||
AM_PATH_PYTHON([], [], [:])
|
||||
AS_IF([test -z "$PYTHON_VERSION"], [
|
||||
PYTHON_VERSION=$(basename $PYTHON | tr -cd 0-9.)
|
||||
PYTHON_VERSION=$(echo ${PYTHON##*/} | tr -cd 0-9.)
|
||||
])
|
||||
PYTHON_MINOR=${PYTHON_VERSION#*\.}
|
||||
|
||||
|
@ -6,7 +6,7 @@ dnl # https://www.gnu.org/software/autoconf-archive/ax_python_module.html
|
||||
dnl # Required by ZFS_AC_CONFIG_ALWAYS_PYZFS.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_PYTHON_MODULE], [
|
||||
PYTHON_NAME=$(basename $PYTHON)
|
||||
PYTHON_NAME=${PYTHON##*/}
|
||||
AC_MSG_CHECKING([for $PYTHON_NAME module: $1])
|
||||
AS_IF([$PYTHON -c "import $1" 2>/dev/null], [
|
||||
AC_MSG_RESULT(yes)
|
||||
|
@ -73,14 +73,14 @@ AC_DEFUN([ZFS_AC_META], [
|
||||
if test ! -f ".nogitrelease" && git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
_match="${ZFS_META_NAME}-${ZFS_META_VERSION}"
|
||||
_alias=$(git describe --match=${_match} 2>/dev/null)
|
||||
_release=$(echo ${_alias}|sed "s/${ZFS_META_NAME}//"|cut -f3- -d'-'|sed 's/-/_/g')
|
||||
_release=$(echo ${_alias}|sed "s/${ZFS_META_NAME}//"|cut -f3- -d'-'|tr - _)
|
||||
if test -n "${_release}"; then
|
||||
ZFS_META_RELEASE=${_release}
|
||||
_zfs_ac_meta_type="git describe"
|
||||
else
|
||||
_match="${ZFS_META_NAME}-${ZFS_META_VERSION}-${ZFS_META_RELEASE}"
|
||||
_alias=$(git describe --match=${_match} 2>/dev/null)
|
||||
_release=$(echo ${_alias}|sed 's/${ZFS_META_NAME}//'|cut -f3- -d'-'|sed 's/-/_/g')
|
||||
_release=$(echo ${_alias}|sed 's/${ZFS_META_NAME}//'|cut -f3- -d'-'|tr - _)
|
||||
if test -n "${_release}"; then
|
||||
ZFS_META_RELEASE=${_release}
|
||||
_zfs_ac_meta_type="git describe"
|
||||
|
@ -288,6 +288,7 @@ AC_CONFIG_FILES([
|
||||
tests/zfs-tests/tests/functional/cli_root/zfs_unshare/Makefile
|
||||
tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/Makefile
|
||||
tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile
|
||||
tests/zfs-tests/tests/functional/cli_root/zhack/Makefile
|
||||
tests/zfs-tests/tests/functional/cli_root/zpool/Makefile
|
||||
tests/zfs-tests/tests/functional/cli_root/zpool_add/Makefile
|
||||
tests/zfs-tests/tests/functional/cli_root/zpool_attach/Makefile
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
ZVER=$(cut -f 1 -d '-' /sys/module/zfs/version)
|
||||
read -r ZVER < /sys/module/zfs/version
|
||||
ZVER="${ZVER%%-*}"
|
||||
KVER=$(uname -r)
|
||||
|
||||
exec bpftrace \
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
get_devtype() {
|
||||
local typ
|
||||
typ=$(udevadm info --query=property --name="$1" | grep "^ID_FS_TYPE=" | sed 's|^ID_FS_TYPE=||')
|
||||
if [ "$typ" = "" ] ; then
|
||||
typ=$(udevadm info --query=property --name="$1" | sed -n 's|^ID_FS_TYPE=||p')
|
||||
if [ -z "$typ" ] ; then
|
||||
typ=$(blkid -c /dev/null "$1" -o value -s TYPE)
|
||||
fi
|
||||
echo "$typ"
|
||||
@ -36,7 +36,6 @@ find_zfs_block_devices() {
|
||||
local dev
|
||||
local mp
|
||||
local fstype
|
||||
local pool
|
||||
local _
|
||||
numfields="$(awk '{print NF; exit}' /proc/self/mountinfo)"
|
||||
if [ "$numfields" = "10" ] ; then
|
||||
@ -47,10 +46,7 @@ find_zfs_block_devices() {
|
||||
# shellcheck disable=SC2086
|
||||
while read -r ${fields?} ; do
|
||||
[ "$fstype" = "zfs" ] || continue
|
||||
if [ "$mp" = "$1" ]; then
|
||||
pool=$(echo "$dev" | cut -d / -f 1)
|
||||
get_pool_devices "$pool"
|
||||
fi
|
||||
[ "$mp" = "$1" ] && get_pool_devices "${dev%%/*}"
|
||||
done < /proc/self/mountinfo
|
||||
}
|
||||
|
||||
@ -100,9 +96,9 @@ if [ -n "$hostonly" ]; then
|
||||
majmin=$(get_maj_min "$dev")
|
||||
if [ -d "/sys/dev/block/$majmin/slaves" ] ; then
|
||||
for _depdev in "/sys/dev/block/$majmin/slaves"/*; do
|
||||
[[ -f $_depdev/dev ]] || continue
|
||||
_depdev=/dev/$(basename "$_depdev")
|
||||
_depdevname=$(udevadm info --query=property --name="$_depdev" | grep "^DEVNAME=" | sed 's|^DEVNAME=||')
|
||||
[ -f "$_depdev/dev" ] || continue
|
||||
_depdev="/dev/${_depdev##*/}"
|
||||
_depdevname=$(udevadm info --query=property --name="$_depdev" | sed -n 's|^DEVNAME=||p')
|
||||
_depdevtype=$(get_devtype "$_depdevname")
|
||||
dinfo "zfsexpandknowledge: underlying block device backing ZFS dataset $mp: ${_depdevname//$'\n'/ }"
|
||||
array_contains "$_depdevname" "${host_devs[@]}" || host_devs+=("$_depdevname")
|
||||
|
@ -69,8 +69,8 @@ install() {
|
||||
dracut_install @mounthelperdir@/mount.zfs
|
||||
dracut_install @udevdir@/vdev_id
|
||||
dracut_install awk
|
||||
dracut_install basename
|
||||
dracut_install cut
|
||||
dracut_install tr
|
||||
dracut_install head
|
||||
dracut_install @udevdir@/zvol_id
|
||||
inst_hook cmdline 95 "${moddir}/parse-zfs.sh"
|
||||
|
@ -43,7 +43,7 @@ case "${root}" in
|
||||
root="${root#FILESYSTEM=}"
|
||||
root="zfs:${root#ZFS=}"
|
||||
# switch + with spaces because kernel cmdline does not allow us to quote parameters
|
||||
root=$(printf '%s\n' "$root" | sed "s/+/ /g")
|
||||
root=$(echo "$root" | tr '+' ' ')
|
||||
rootok=1
|
||||
wait_for_zfs=1
|
||||
|
||||
|
@ -89,7 +89,7 @@ else
|
||||
_zfs_generator_cb() {
|
||||
dset="${1}"
|
||||
mpnt="${2}"
|
||||
unit="sysroot$(echo "$mpnt" | sed 's;/;-;g').mount"
|
||||
unit="sysroot$(echo "$mpnt" | tr '/' '-').mount"
|
||||
|
||||
{
|
||||
echo "[Unit]"
|
||||
|
@ -79,7 +79,9 @@ find_rootfs()
|
||||
|
||||
# If it's already specified, just keep it mounted and exit
|
||||
# User (kernel command line) must be correct.
|
||||
[ -n "${ZFS_BOOTFS}" ] && return 0
|
||||
if [ -n "${ZFS_BOOTFS}" ] && [ "${ZFS_BOOTFS}" != "zfs:AUTO" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Not set, try to find it in the 'bootfs' property of the pool.
|
||||
# NOTE: zpool does not support 'get -H -ovalue bootfs'...
|
||||
@ -105,8 +107,7 @@ find_rootfs()
|
||||
find_pools()
|
||||
{
|
||||
pools=$("$@" 2> /dev/null | \
|
||||
grep -E "pool:|^[a-zA-Z0-9]" | \
|
||||
sed 's@.*: @@' | \
|
||||
sed -Ee '/pool:|^[a-zA-Z0-9]/!d' -e 's@.*: @@' | \
|
||||
tr '\n' ';')
|
||||
|
||||
echo "${pools%%;}" # Return without the last ';'.
|
||||
@ -428,7 +429,7 @@ decrypt_fs()
|
||||
else
|
||||
# Temporarily setting "printk" to "7" allows the prompt to appear even when the "quiet" kernel option has been used
|
||||
echo "load-key" > /run/zfs_console_askpwd_cmd
|
||||
storeprintk="$(awk '{print $1}' /proc/sys/kernel/printk)"
|
||||
read -r storeprintk _ < /proc/sys/kernel/printk
|
||||
echo 7 > /proc/sys/kernel/printk
|
||||
$ZFS load-key "${ENCRYPTIONROOT}"
|
||||
echo "$storeprintk" > /proc/sys/kernel/printk
|
||||
@ -757,7 +758,7 @@ mountroot()
|
||||
# rpool=rpool (default if none of the above is used)
|
||||
# root=<pool>/<dataset> (uses this for rpool - first part)
|
||||
# root=ZFS=<pool>/<dataset> (uses this for rpool - first part, without 'ZFS=')
|
||||
# root=zfs:AUTO (tries to detect both pool and rootfs
|
||||
# root=zfs:AUTO (tries to detect both pool and rootfs)
|
||||
# root=zfs:<pool>/<dataset> (uses this for rpool - first part, without 'zfs:')
|
||||
#
|
||||
# Option <dataset> could also be <snapshot>
|
||||
|
@ -57,8 +57,7 @@ find_pools()
|
||||
local pools
|
||||
|
||||
pools=$("$@" 2> /dev/null | \
|
||||
grep -E "pool:|^[a-zA-Z0-9]" | \
|
||||
sed 's@.*: @@' | \
|
||||
sed -Ee '/pool:|^[a-zA-Z0-9]/!d' -e 's@.*: @@' | \
|
||||
sort | \
|
||||
tr '\n' ';')
|
||||
|
||||
|
@ -345,7 +345,7 @@ read_mtab()
|
||||
|
||||
# Unset all MTAB_* variables
|
||||
# shellcheck disable=SC2046
|
||||
unset $(env | grep ^MTAB_ | sed 's,=.*,,')
|
||||
unset $(env | sed -e '/^MTAB_/!d' -e 's,=.*,,')
|
||||
|
||||
while read -r fs mntpnt fstype opts rest; do
|
||||
if echo "$fs $mntpnt $fstype $opts" | grep -qE "$match"; then
|
||||
@ -360,9 +360,8 @@ read_mtab()
|
||||
fs=$(/bin/echo "$fs" | sed 's,\\0,\\00,')
|
||||
|
||||
# Remove 'unwanted' characters.
|
||||
mntpnt=$(printf '%b\n' "$mntpnt" | sed -e 's,/,,g' \
|
||||
-e 's,-,,g' -e 's,\.,,g' -e 's, ,,g')
|
||||
fs=$(printf '%b\n' "$fs")
|
||||
mntpnt=$(printf '%b' "$mntpnt" | tr -d '/. -')
|
||||
fs=$(printf '%b' "$fs")
|
||||
|
||||
# Set the variable.
|
||||
eval export "MTAB_$mntpnt=\"$fs\""
|
||||
@ -374,8 +373,7 @@ in_mtab()
|
||||
{
|
||||
local mntpnt="$1"
|
||||
# Remove 'unwanted' characters.
|
||||
mntpnt=$(printf '%b\n' "$mntpnt" | sed -e 's,/,,g' \
|
||||
-e 's,-,,g' -e 's,\.,,g' -e 's, ,,g')
|
||||
mntpnt=$(printf '%b' "$mntpnt" | tr -d '/. -')
|
||||
local var
|
||||
|
||||
var="$(eval echo "MTAB_$mntpnt")"
|
||||
@ -391,7 +389,7 @@ read_fstab()
|
||||
|
||||
# Unset all FSTAB_* variables
|
||||
# shellcheck disable=SC2046
|
||||
unset $(env | grep ^FSTAB_ | sed 's,=.*,,')
|
||||
unset $(env | sed -e '/^FSTAB_/!d' -e 's,=.*,,')
|
||||
|
||||
i=0
|
||||
while read -r fs mntpnt fstype opts; do
|
||||
@ -401,7 +399,7 @@ read_fstab()
|
||||
|
||||
if echo "$fs $mntpnt $fstype $opts" | grep -qE "$match"; then
|
||||
eval export "FSTAB_dev_$i=$fs"
|
||||
fs=$(printf '%b\n' "$fs" | sed 's,/,_,g')
|
||||
fs=$(printf '%b' "$fs" | tr '/' '_')
|
||||
eval export "FSTAB_$i=$mntpnt"
|
||||
|
||||
i=$((i + 1))
|
||||
|
@ -85,6 +85,7 @@ typedef void arc_prune_func_t(int64_t bytes, void *priv);
|
||||
|
||||
/* Shared module parameters */
|
||||
extern int zfs_arc_average_blocksize;
|
||||
extern int l2arc_exclude_special;
|
||||
|
||||
/* generic arc_done_func_t's which you can use */
|
||||
arc_read_done_func_t arc_bcopy_func;
|
||||
|
@ -442,16 +442,7 @@ dbuf_find_dirty_eq(dmu_buf_impl_t *db, uint64_t txg)
|
||||
(dbuf_is_metadata(_db) && \
|
||||
((_db)->db_objset->os_primary_cache == ZFS_CACHE_METADATA)))
|
||||
|
||||
#define DBUF_IS_L2CACHEABLE(_db) \
|
||||
((_db)->db_objset->os_secondary_cache == ZFS_CACHE_ALL || \
|
||||
(dbuf_is_metadata(_db) && \
|
||||
((_db)->db_objset->os_secondary_cache == ZFS_CACHE_METADATA)))
|
||||
|
||||
#define DNODE_LEVEL_IS_L2CACHEABLE(_dn, _level) \
|
||||
((_dn)->dn_objset->os_secondary_cache == ZFS_CACHE_ALL || \
|
||||
(((_level) > 0 || \
|
||||
DMU_OT_IS_METADATA((_dn)->dn_handle->dnh_dnode->dn_type)) && \
|
||||
((_dn)->dn_objset->os_secondary_cache == ZFS_CACHE_METADATA)))
|
||||
boolean_t dbuf_is_l2cacheable(dmu_buf_impl_t *db);
|
||||
|
||||
#ifdef ZFS_DEBUG
|
||||
|
||||
|
@ -200,10 +200,6 @@ struct objset {
|
||||
#define DMU_GROUPUSED_DNODE(os) ((os)->os_groupused_dnode.dnh_dnode)
|
||||
#define DMU_PROJECTUSED_DNODE(os) ((os)->os_projectused_dnode.dnh_dnode)
|
||||
|
||||
#define DMU_OS_IS_L2CACHEABLE(os) \
|
||||
((os)->os_secondary_cache == ZFS_CACHE_ALL || \
|
||||
(os)->os_secondary_cache == ZFS_CACHE_METADATA)
|
||||
|
||||
/* called from zpl */
|
||||
int dmu_objset_hold(const char *name, void *tag, objset_t **osp);
|
||||
int dmu_objset_hold_flags(const char *name, boolean_t decrypt, void *tag,
|
||||
|
@ -1075,6 +1075,7 @@ extern void spa_upgrade(spa_t *spa, uint64_t version);
|
||||
extern void spa_evict_all(void);
|
||||
extern vdev_t *spa_lookup_by_guid(spa_t *spa, uint64_t guid,
|
||||
boolean_t l2cache);
|
||||
extern boolean_t spa_has_l2cache(spa_t *, uint64_t guid);
|
||||
extern boolean_t spa_has_spare(spa_t *, uint64_t guid);
|
||||
extern uint64_t dva_get_dsize_sync(spa_t *spa, const dva_t *dva);
|
||||
extern uint64_t bp_get_dsize_sync(spa_t *spa, const blkptr_t *bp);
|
||||
|
@ -88,9 +88,7 @@ enum zio_checksum {
|
||||
ZIO_CHECKSUM_NOPARITY,
|
||||
ZIO_CHECKSUM_SHA512,
|
||||
ZIO_CHECKSUM_SKEIN,
|
||||
#if !defined(__FreeBSD__)
|
||||
ZIO_CHECKSUM_EDONR,
|
||||
#endif
|
||||
ZIO_CHECKSUM_FUNCTIONS
|
||||
};
|
||||
|
||||
|
@ -94,6 +94,13 @@ The
|
||||
flag indicates that the
|
||||
.Ar guid
|
||||
feature is now required to read the pool MOS.
|
||||
.
|
||||
.It Xo
|
||||
.Nm zhack
|
||||
.Cm label repair
|
||||
.Ar device
|
||||
.Xc
|
||||
Repair corrupted labels by rewriting the checksum using the presumed valid contents of the label.
|
||||
.El
|
||||
.
|
||||
.Sh GLOBAL OPTIONS
|
||||
|
@ -109,6 +109,11 @@ A value of
|
||||
.Sy 100
|
||||
disables this feature.
|
||||
.
|
||||
.It Sy l2arc_exclude_special Ns = Ns Sy 0 Ns | Ns 1 Pq int
|
||||
Controls whether buffers present on special vdevs are eligibile for caching
|
||||
into L2ARC.
|
||||
If set to 1, exclude dbufs on special vdevs from being cached to L2ARC.
|
||||
.
|
||||
.It Sy l2arc_mfuonly Ns = Ns Sy 0 Ns | Ns 1 Pq int
|
||||
Controls whether only MFU metadata and data are cached from ARC into L2ARC.
|
||||
This may be desired to avoid wasting space on L2ARC when reading/writing large
|
||||
|
@ -771,10 +771,6 @@ The
|
||||
and
|
||||
.Sy edonr
|
||||
checksum algorithms require enabling the appropriate features on the pool.
|
||||
.Fx
|
||||
does not support the
|
||||
.Sy edonr
|
||||
algorithm.
|
||||
.Pp
|
||||
Please see
|
||||
.Xr zpool-features 7
|
||||
|
@ -436,10 +436,6 @@ in ZFS, which means that the checksum is pre-seeded with a secret
|
||||
to be checksummed.
|
||||
Thus the produced checksums are unique to a given pool,
|
||||
preventing hash collision attacks on systems with dedup.
|
||||
.Pp
|
||||
.checksum-spiel edonr
|
||||
.Pp
|
||||
.Fx does not support the Sy edonr No feature.
|
||||
.
|
||||
.feature com.delphix embedded_data no
|
||||
This feature improves the performance and compression ratio of
|
||||
|
@ -12,6 +12,7 @@ KMOD= openzfs
|
||||
.PATH: ${SRCDIR}/avl \
|
||||
${SRCDIR}/lua \
|
||||
${SRCDIR}/nvpair \
|
||||
${SRCDIR}/icp/algs/edonr \
|
||||
${SRCDIR}/os/freebsd/spl \
|
||||
${SRCDIR}/os/freebsd/zfs \
|
||||
${SRCDIR}/unicode \
|
||||
@ -73,6 +74,9 @@ SRCS= vnode_if.h device_if.h bus_if.h
|
||||
# avl
|
||||
SRCS+= avl.c
|
||||
|
||||
# icp
|
||||
SRCS+= edonr.c
|
||||
|
||||
#lua
|
||||
SRCS+= lapi.c \
|
||||
lauxlib.c \
|
||||
@ -219,6 +223,7 @@ SRCS+= abd.c \
|
||||
dsl_scan.c \
|
||||
dsl_synctask.c \
|
||||
dsl_userhold.c \
|
||||
edonr_zfs.c \
|
||||
fm.c \
|
||||
gzip.c \
|
||||
lzjb.c \
|
||||
@ -345,6 +350,7 @@ CFLAGS.dmu_traverse.c= -Wno-cast-qual
|
||||
CFLAGS.dsl_dir.c= -Wno-cast-qual
|
||||
CFLAGS.dsl_deadlist.c= -Wno-cast-qual
|
||||
CFLAGS.dsl_prop.c= -Wno-cast-qual
|
||||
CFLAGS.edonr.c=-Wno-cast-qual
|
||||
CFLAGS.fm.c= -Wno-cast-qual
|
||||
CFLAGS.lz4.c= -Wno-cast-qual
|
||||
CFLAGS.spa.c= -Wno-cast-qual
|
||||
|
@ -761,8 +761,8 @@ zfs_lookup_lock(vnode_t *dvp, vnode_t *vp, const char *name, int lkflags)
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp,
|
||||
struct componentname *cnp, int nameiop, cred_t *cr, kthread_t *td,
|
||||
int flags, boolean_t cached)
|
||||
struct componentname *cnp, int nameiop, cred_t *cr, int flags,
|
||||
boolean_t cached)
|
||||
{
|
||||
znode_t *zdp = VTOZ(dvp);
|
||||
znode_t *zp;
|
||||
@ -1337,8 +1337,8 @@ zfs_lookup_internal(znode_t *dzp, const char *name, vnode_t **vpp,
|
||||
a.a_cnp = cnp;
|
||||
error = vfs_cache_lookup(&a);
|
||||
} else {
|
||||
error = zfs_lookup(ZTOV(dzp), name, vpp, cnp, nameiop, kcred,
|
||||
curthread, 0, B_FALSE);
|
||||
error = zfs_lookup(ZTOV(dzp), name, vpp, cnp, nameiop, kcred, 0,
|
||||
B_FALSE);
|
||||
}
|
||||
#ifdef ZFS_DEBUG
|
||||
if (error) {
|
||||
@ -4582,7 +4582,7 @@ zfs_freebsd_lookup(struct vop_lookup_args *ap, boolean_t cached)
|
||||
strlcpy(nm, cnp->cn_nameptr, MIN(cnp->cn_namelen + 1, sizeof (nm)));
|
||||
|
||||
return (zfs_lookup(ap->a_dvp, nm, ap->a_vpp, cnp, cnp->cn_nameiop,
|
||||
cnp->cn_cred, curthread, 0, cached));
|
||||
cnp->cn_cred, 0, cached));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -5339,7 +5339,7 @@ zfs_getextattr_dir(struct vop_getextattr_args *ap, const char *attrname)
|
||||
vnode_t *xvp = NULL, *vp;
|
||||
int error, flags;
|
||||
|
||||
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td,
|
||||
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred,
|
||||
LOOKUP_XATTR, B_FALSE);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
@ -5450,18 +5450,17 @@ struct vop_deleteextattr {
|
||||
static int
|
||||
zfs_deleteextattr_dir(struct vop_deleteextattr_args *ap, const char *attrname)
|
||||
{
|
||||
struct thread *td = ap->a_td;
|
||||
struct nameidata nd;
|
||||
vnode_t *xvp = NULL, *vp;
|
||||
int error;
|
||||
|
||||
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td,
|
||||
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred,
|
||||
LOOKUP_XATTR, B_FALSE);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
NDINIT_ATVP(&nd, DELETE, NOFOLLOW | LOCKPARENT | LOCKLEAF,
|
||||
UIO_SYSSPACE, attrname, xvp, td);
|
||||
UIO_SYSSPACE, attrname, xvp, ap->a_td);
|
||||
error = namei(&nd);
|
||||
vp = nd.ni_vp;
|
||||
if (error != 0) {
|
||||
@ -5583,7 +5582,7 @@ zfs_setextattr_dir(struct vop_setextattr_args *ap, const char *attrname)
|
||||
vnode_t *xvp = NULL, *vp;
|
||||
int error, flags;
|
||||
|
||||
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td,
|
||||
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred,
|
||||
LOOKUP_XATTR | CREATE_XATTR_DIR, B_FALSE);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
@ -5732,7 +5731,7 @@ zfs_listextattr_dir(struct vop_listextattr_args *ap, const char *attrprefix)
|
||||
vnode_t *xvp = NULL, *vp;
|
||||
int error, eof;
|
||||
|
||||
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td,
|
||||
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred,
|
||||
LOOKUP_XATTR, B_FALSE);
|
||||
if (error != 0) {
|
||||
/*
|
||||
|
@ -227,12 +227,8 @@ zfs_mod_supported_feature(const char *name)
|
||||
* tree, but this has not been done yet. Therefore, we return
|
||||
* that all features except edonr are supported.
|
||||
*/
|
||||
#if defined(__FreeBSD__)
|
||||
if (strcmp(name, "org.illumos:edonr") == 0)
|
||||
return (B_FALSE);
|
||||
else
|
||||
return (B_TRUE);
|
||||
#elif defined(_KERNEL) || defined(LIB_ZPOOL_BUILD)
|
||||
|
||||
#if defined(_KERNEL) || defined(LIB_ZPOOL_BUILD) || defined(__FreeBSD__)
|
||||
return (B_TRUE);
|
||||
#else
|
||||
return (zfs_mod_supported(ZFS_SYSFS_POOL_FEATURES, name));
|
||||
|
@ -83,10 +83,7 @@ zfs_prop_init(void)
|
||||
{ "noparity", ZIO_CHECKSUM_NOPARITY },
|
||||
{ "sha512", ZIO_CHECKSUM_SHA512 },
|
||||
{ "skein", ZIO_CHECKSUM_SKEIN },
|
||||
#if !defined(__FreeBSD__)
|
||||
|
||||
{ "edonr", ZIO_CHECKSUM_EDONR },
|
||||
#endif
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@ -103,11 +100,8 @@ zfs_prop_init(void)
|
||||
{ "skein", ZIO_CHECKSUM_SKEIN },
|
||||
{ "skein,verify",
|
||||
ZIO_CHECKSUM_SKEIN | ZIO_CHECKSUM_VERIFY },
|
||||
#if !defined(__FreeBSD__)
|
||||
|
||||
{ "edonr,verify",
|
||||
ZIO_CHECKSUM_EDONR | ZIO_CHECKSUM_VERIFY },
|
||||
#endif
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@ -396,21 +390,13 @@ zfs_prop_init(void)
|
||||
zprop_register_index(ZFS_PROP_CHECKSUM, "checksum",
|
||||
ZIO_CHECKSUM_DEFAULT, PROP_INHERIT, ZFS_TYPE_FILESYSTEM |
|
||||
ZFS_TYPE_VOLUME,
|
||||
#if !defined(__FreeBSD__)
|
||||
"on | off | fletcher2 | fletcher4 | sha256 | sha512 | skein"
|
||||
" | edonr",
|
||||
#else
|
||||
"on | off | fletcher2 | fletcher4 | sha256 | sha512 | skein",
|
||||
#endif
|
||||
"CHECKSUM", checksum_table);
|
||||
zprop_register_index(ZFS_PROP_DEDUP, "dedup", ZIO_CHECKSUM_OFF,
|
||||
PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
|
||||
"on | off | verify | sha256[,verify] | sha512[,verify] | "
|
||||
#if !defined(__FreeBSD__)
|
||||
"skein[,verify] | edonr,verify",
|
||||
#else
|
||||
"skein[,verify]",
|
||||
#endif
|
||||
"DEDUP", dedup_table);
|
||||
zprop_register_index(ZFS_PROP_COMPRESSION, "compression",
|
||||
ZIO_COMPRESS_DEFAULT, PROP_INHERIT,
|
||||
|
@ -869,6 +869,14 @@ static void l2arc_hdr_arcstats_update(arc_buf_hdr_t *hdr, boolean_t incr,
|
||||
#define l2arc_hdr_arcstats_decrement_state(hdr) \
|
||||
l2arc_hdr_arcstats_update((hdr), B_FALSE, B_TRUE)
|
||||
|
||||
/*
|
||||
* l2arc_exclude_special : A zfs module parameter that controls whether buffers
|
||||
* present on special vdevs are eligibile for caching in L2ARC. If
|
||||
* set to 1, exclude dbufs on special vdevs from being cached to
|
||||
* L2ARC.
|
||||
*/
|
||||
int l2arc_exclude_special = 0;
|
||||
|
||||
/*
|
||||
* l2arc_mfuonly : A ZFS module parameter that controls whether only MFU
|
||||
* metadata and data are cached from ARC into L2ARC.
|
||||
@ -11097,6 +11105,10 @@ ZFS_MODULE_PARAM(zfs_l2arc, l2arc_, rebuild_blocks_min_l2size, ULONG, ZMOD_RW,
|
||||
ZFS_MODULE_PARAM(zfs_l2arc, l2arc_, mfuonly, INT, ZMOD_RW,
|
||||
"Cache only MFU data from ARC into L2ARC");
|
||||
|
||||
ZFS_MODULE_PARAM(zfs_l2arc, l2arc_, exclude_special, INT, ZMOD_RW,
|
||||
"If set to 1 exclude dbufs on special vdevs from being cached to "
|
||||
"L2ARC.");
|
||||
|
||||
ZFS_MODULE_PARAM_CALL(zfs_arc, zfs_arc_, lotsfree_percent, param_set_arc_int,
|
||||
param_get_int, ZMOD_RW, "System free memory I/O throttle in bytes");
|
||||
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include <cityhash.h>
|
||||
#include <sys/spa_impl.h>
|
||||
#include <sys/wmsum.h>
|
||||
#include <sys/vdev_impl.h>
|
||||
|
||||
kstat_t *dbuf_ksp;
|
||||
|
||||
@ -599,6 +600,68 @@ dbuf_is_metadata(dmu_buf_impl_t *db)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We want to exclude buffers that are on a special allocation class from
|
||||
* L2ARC.
|
||||
*/
|
||||
boolean_t
|
||||
dbuf_is_l2cacheable(dmu_buf_impl_t *db)
|
||||
{
|
||||
vdev_t *vd = NULL;
|
||||
zfs_cache_type_t cache = db->db_objset->os_secondary_cache;
|
||||
blkptr_t *bp = db->db_blkptr;
|
||||
|
||||
if (bp != NULL && !BP_IS_HOLE(bp)) {
|
||||
uint64_t vdev = DVA_GET_VDEV(bp->blk_dva);
|
||||
vdev_t *rvd = db->db_objset->os_spa->spa_root_vdev;
|
||||
|
||||
if (vdev < rvd->vdev_children)
|
||||
vd = rvd->vdev_child[vdev];
|
||||
|
||||
if (cache == ZFS_CACHE_ALL ||
|
||||
(dbuf_is_metadata(db) && cache == ZFS_CACHE_METADATA)) {
|
||||
if (vd == NULL)
|
||||
return (B_TRUE);
|
||||
|
||||
if ((vd->vdev_alloc_bias != VDEV_BIAS_SPECIAL &&
|
||||
vd->vdev_alloc_bias != VDEV_BIAS_DEDUP) ||
|
||||
l2arc_exclude_special == 0)
|
||||
return (B_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
static inline boolean_t
|
||||
dnode_level_is_l2cacheable(blkptr_t *bp, dnode_t *dn, int64_t level)
|
||||
{
|
||||
vdev_t *vd = NULL;
|
||||
zfs_cache_type_t cache = dn->dn_objset->os_secondary_cache;
|
||||
|
||||
if (bp != NULL && !BP_IS_HOLE(bp)) {
|
||||
uint64_t vdev = DVA_GET_VDEV(bp->blk_dva);
|
||||
vdev_t *rvd = dn->dn_objset->os_spa->spa_root_vdev;
|
||||
|
||||
if (vdev < rvd->vdev_children)
|
||||
vd = rvd->vdev_child[vdev];
|
||||
|
||||
if (cache == ZFS_CACHE_ALL || ((level > 0 ||
|
||||
DMU_OT_IS_METADATA(dn->dn_handle->dnh_dnode->dn_type)) &&
|
||||
cache == ZFS_CACHE_METADATA)) {
|
||||
if (vd == NULL)
|
||||
return (B_TRUE);
|
||||
|
||||
if ((vd->vdev_alloc_bias != VDEV_BIAS_SPECIAL &&
|
||||
vd->vdev_alloc_bias != VDEV_BIAS_DEDUP) ||
|
||||
l2arc_exclude_special == 0)
|
||||
return (B_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function *must* return indices evenly distributed between all
|
||||
@ -1527,7 +1590,7 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags,
|
||||
DTRACE_SET_STATE(db, "read issued");
|
||||
mutex_exit(&db->db_mtx);
|
||||
|
||||
if (DBUF_IS_L2CACHEABLE(db))
|
||||
if (dbuf_is_l2cacheable(db))
|
||||
aflags |= ARC_FLAG_L2CACHE;
|
||||
|
||||
dbuf_add_ref(db, NULL);
|
||||
@ -3370,7 +3433,7 @@ dbuf_prefetch_impl(dnode_t *dn, int64_t level, uint64_t blkid,
|
||||
dpa->dpa_arg = arg;
|
||||
|
||||
/* flag if L2ARC eligible, l2arc_noprefetch then decides */
|
||||
if (DNODE_LEVEL_IS_L2CACHEABLE(dn, level))
|
||||
if (dnode_level_is_l2cacheable(&bp, dn, level))
|
||||
dpa->dpa_aflags |= ARC_FLAG_L2CACHE;
|
||||
|
||||
/*
|
||||
@ -3388,7 +3451,7 @@ dbuf_prefetch_impl(dnode_t *dn, int64_t level, uint64_t blkid,
|
||||
zbookmark_phys_t zb;
|
||||
|
||||
/* flag if L2ARC eligible, l2arc_noprefetch then decides */
|
||||
if (DNODE_LEVEL_IS_L2CACHEABLE(dn, level))
|
||||
if (dnode_level_is_l2cacheable(&bp, dn, level))
|
||||
iter_aflags |= ARC_FLAG_L2CACHE;
|
||||
|
||||
SET_BOOKMARK(&zb, ds != NULL ? ds->ds_object : DMU_META_OBJSET,
|
||||
@ -4986,7 +5049,7 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx)
|
||||
children_ready_cb = dbuf_write_children_ready;
|
||||
|
||||
dr->dr_zio = arc_write(pio, os->os_spa, txg,
|
||||
&dr->dr_bp_copy, data, DBUF_IS_L2CACHEABLE(db),
|
||||
&dr->dr_bp_copy, data, dbuf_is_l2cacheable(db),
|
||||
&zp, dbuf_write_ready,
|
||||
children_ready_cb, dbuf_write_physdone,
|
||||
dbuf_write_done, db, ZIO_PRIORITY_ASYNC_WRITE,
|
||||
|
@ -1839,7 +1839,7 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done, zgd_t *zgd)
|
||||
dsa->dsa_tx = NULL;
|
||||
|
||||
zio_nowait(arc_write(pio, os->os_spa, txg,
|
||||
zgd->zgd_bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db),
|
||||
zgd->zgd_bp, dr->dt.dl.dr_data, dbuf_is_l2cacheable(db),
|
||||
&zp, dmu_sync_ready, NULL, NULL, dmu_sync_done, dsa,
|
||||
ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, &zb));
|
||||
|
||||
|
@ -63,6 +63,8 @@
|
||||
#include <sys/dmu_recv.h>
|
||||
#include <sys/zfs_project.h>
|
||||
#include "zfs_namecheck.h"
|
||||
#include <sys/vdev_impl.h>
|
||||
#include <sys/arc.h>
|
||||
|
||||
/*
|
||||
* Needed to close a window in dnode_move() that allows the objset to be freed
|
||||
@ -411,6 +413,34 @@ dnode_multilist_index_func(multilist_t *ml, void *obj)
|
||||
multilist_get_num_sublists(ml));
|
||||
}
|
||||
|
||||
static inline boolean_t
|
||||
dmu_os_is_l2cacheable(objset_t *os)
|
||||
{
|
||||
vdev_t *vd = NULL;
|
||||
zfs_cache_type_t cache = os->os_secondary_cache;
|
||||
blkptr_t *bp = os->os_rootbp;
|
||||
|
||||
if (bp != NULL && !BP_IS_HOLE(bp)) {
|
||||
uint64_t vdev = DVA_GET_VDEV(bp->blk_dva);
|
||||
vdev_t *rvd = os->os_spa->spa_root_vdev;
|
||||
|
||||
if (vdev < rvd->vdev_children)
|
||||
vd = rvd->vdev_child[vdev];
|
||||
|
||||
if (cache == ZFS_CACHE_ALL || cache == ZFS_CACHE_METADATA) {
|
||||
if (vd == NULL)
|
||||
return (B_TRUE);
|
||||
|
||||
if ((vd->vdev_alloc_bias != VDEV_BIAS_SPECIAL &&
|
||||
vd->vdev_alloc_bias != VDEV_BIAS_DEDUP) ||
|
||||
l2arc_exclude_special == 0)
|
||||
return (B_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Instantiates the objset_t in-memory structure corresponding to the
|
||||
* objset_phys_t that's pointed to by the specified blkptr_t.
|
||||
@ -453,7 +483,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp,
|
||||
SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET,
|
||||
ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID);
|
||||
|
||||
if (DMU_OS_IS_L2CACHEABLE(os))
|
||||
if (dmu_os_is_l2cacheable(os))
|
||||
aflags |= ARC_FLAG_L2CACHE;
|
||||
|
||||
if (ds != NULL && ds->ds_dir->dd_crypto_obj != 0) {
|
||||
@ -1663,7 +1693,7 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx)
|
||||
}
|
||||
|
||||
zio = arc_write(pio, os->os_spa, tx->tx_txg,
|
||||
blkptr_copy, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os),
|
||||
blkptr_copy, os->os_phys_buf, dmu_os_is_l2cacheable(os),
|
||||
&zp, dmu_objset_write_ready, NULL, NULL, dmu_objset_write_done,
|
||||
os, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb);
|
||||
|
||||
|
@ -1657,7 +1657,7 @@ dnode_is_dirty(dnode_t *dn)
|
||||
mutex_enter(&dn->dn_mtx);
|
||||
|
||||
for (int i = 0; i < TXG_SIZE; i++) {
|
||||
if (list_head(&dn->dn_dirty_records[i]) != NULL) {
|
||||
if (multilist_link_active(&dn->dn_dirty_link[i])) {
|
||||
mutex_exit(&dn->dn_mtx);
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
@ -9451,12 +9451,11 @@ spa_upgrade(spa_t *spa, uint64_t version)
|
||||
txg_wait_synced(spa_get_dsl(spa), 0);
|
||||
}
|
||||
|
||||
boolean_t
|
||||
spa_has_spare(spa_t *spa, uint64_t guid)
|
||||
static boolean_t
|
||||
spa_has_aux_vdev(spa_t *spa, uint64_t guid, spa_aux_vdev_t *sav)
|
||||
{
|
||||
int i;
|
||||
uint64_t spareguid;
|
||||
spa_aux_vdev_t *sav = &spa->spa_spares;
|
||||
uint64_t vdev_guid;
|
||||
|
||||
for (i = 0; i < sav->sav_count; i++)
|
||||
if (sav->sav_vdevs[i]->vdev_guid == guid)
|
||||
@ -9464,13 +9463,25 @@ spa_has_spare(spa_t *spa, uint64_t guid)
|
||||
|
||||
for (i = 0; i < sav->sav_npending; i++) {
|
||||
if (nvlist_lookup_uint64(sav->sav_pending[i], ZPOOL_CONFIG_GUID,
|
||||
&spareguid) == 0 && spareguid == guid)
|
||||
&vdev_guid) == 0 && vdev_guid == guid)
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
boolean_t
|
||||
spa_has_l2cache(spa_t *spa, uint64_t guid)
|
||||
{
|
||||
return (spa_has_aux_vdev(spa, guid, &spa->spa_l2cache));
|
||||
}
|
||||
|
||||
boolean_t
|
||||
spa_has_spare(spa_t *spa, uint64_t guid)
|
||||
{
|
||||
return (spa_has_aux_vdev(spa, guid, &spa->spa_spares));
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if a pool has an active shared spare device.
|
||||
* Note: reference count of an active spare is 2, as a spare and as a replace
|
||||
|
@ -933,7 +933,7 @@ vdev_inuse(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason,
|
||||
/*
|
||||
* Check to see if this is a spare device. We do an explicit check for
|
||||
* spa_has_spare() here because it may be on our pending list of spares
|
||||
* to add. We also check if it is an l2cache device.
|
||||
* to add.
|
||||
*/
|
||||
if (spa_spare_exists(device_guid, &spare_pool, NULL) ||
|
||||
spa_has_spare(spa, device_guid)) {
|
||||
@ -942,7 +942,6 @@ vdev_inuse(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason,
|
||||
|
||||
switch (reason) {
|
||||
case VDEV_LABEL_CREATE:
|
||||
case VDEV_LABEL_L2CACHE:
|
||||
return (B_TRUE);
|
||||
|
||||
case VDEV_LABEL_REPLACE:
|
||||
@ -959,8 +958,24 @@ vdev_inuse(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason,
|
||||
/*
|
||||
* Check to see if this is an l2cache device.
|
||||
*/
|
||||
if (spa_l2cache_exists(device_guid, NULL))
|
||||
return (B_TRUE);
|
||||
if (spa_l2cache_exists(device_guid, NULL) ||
|
||||
spa_has_l2cache(spa, device_guid)) {
|
||||
if (l2cache_guid)
|
||||
*l2cache_guid = device_guid;
|
||||
|
||||
switch (reason) {
|
||||
case VDEV_LABEL_CREATE:
|
||||
return (B_TRUE);
|
||||
|
||||
case VDEV_LABEL_REPLACE:
|
||||
return (!spa_has_l2cache(spa, device_guid));
|
||||
|
||||
case VDEV_LABEL_L2CACHE:
|
||||
return (spa_has_l2cache(spa, device_guid));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We can't rely on a pool's state if it's been imported
|
||||
|
@ -191,12 +191,10 @@ zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
|
||||
abd_checksum_skein_tmpl_init, abd_checksum_skein_tmpl_free,
|
||||
ZCHECKSUM_FLAG_METADATA | ZCHECKSUM_FLAG_DEDUP |
|
||||
ZCHECKSUM_FLAG_SALTED | ZCHECKSUM_FLAG_NOPWRITE, "skein"},
|
||||
#if !defined(__FreeBSD__)
|
||||
{{abd_checksum_edonr_native, abd_checksum_edonr_byteswap},
|
||||
abd_checksum_edonr_tmpl_init, abd_checksum_edonr_tmpl_free,
|
||||
ZCHECKSUM_FLAG_METADATA | ZCHECKSUM_FLAG_SALTED |
|
||||
ZCHECKSUM_FLAG_NOPWRITE, "edonr"},
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
@ -213,10 +211,8 @@ zio_checksum_to_feature(enum zio_checksum cksum)
|
||||
return (SPA_FEATURE_SHA512);
|
||||
case ZIO_CHECKSUM_SKEIN:
|
||||
return (SPA_FEATURE_SKEIN);
|
||||
#if !defined(__FreeBSD__)
|
||||
case ZIO_CHECKSUM_EDONR:
|
||||
return (SPA_FEATURE_EDONR);
|
||||
#endif
|
||||
default:
|
||||
return (SPA_FEATURE_NONE);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ exit 1
|
||||
# Are we doing an upgrade?
|
||||
if [ "$1" = "1" -o "$1" = "upgrade" ] ; then
|
||||
# Yes we are. Are we upgrading to a new ZFS version?
|
||||
NEWEST_VER=$(dkms status zfs | sed 's/,//g' | sort -r -V | awk '/installed/{print $2; exit}')
|
||||
NEWEST_VER=$(dkms status zfs | tr -d , | sort -r -V | awk '/installed/{print $2; exit}')
|
||||
if [ "$NEWEST_VER" != "%{version}" ] ; then
|
||||
# Yes, it's a new ZFS version. We'll uninstall the old module
|
||||
# later on in this script.
|
||||
|
@ -446,7 +446,7 @@ print_rpmtemplate ()
|
||||
|
||||
myprog_help ()
|
||||
{
|
||||
echo "Usage: $(basename ${0}) [OPTIONS]"
|
||||
echo "Usage: ${0##*/} [OPTIONS]"
|
||||
echo $'\n'"Creates a template to be used during kmod building"
|
||||
echo $'\n'"Available options:"
|
||||
echo " --filterfile <file> -- filter the results with grep --file <file>"
|
||||
|
@ -90,7 +90,7 @@ cleanup_freebsd_loopback() {
|
||||
|
||||
cleanup_linux_loopback() {
|
||||
for TEST_LOOPBACK in ${LOOPBACKS}; do
|
||||
LOOP_DEV=$(basename "$TEST_LOOPBACK")
|
||||
LOOP_DEV="${TEST_LOOPBACK##*/}"
|
||||
DM_DEV=$(sudo "${DMSETUP}" ls 2>/dev/null | \
|
||||
grep "${LOOP_DEV}" | cut -f1)
|
||||
|
||||
@ -606,7 +606,7 @@ if [ -z "${DISKS}" ]; then
|
||||
TEST_LOOPBACK=$(sudo "${LOSETUP}" -f)
|
||||
sudo "${LOSETUP}" "${TEST_LOOPBACK}" "${TEST_FILE}" ||
|
||||
fail "Failed: ${TEST_FILE} -> ${TEST_LOOPBACK}"
|
||||
BASELOOPBACK=$(basename "$TEST_LOOPBACK")
|
||||
BASELOOPBACK="${TEST_LOOPBACK##*/}"
|
||||
DISKS="$DISKS $BASELOOPBACK"
|
||||
LOOPBACKS="$LOOPBACKS $TEST_LOOPBACK"
|
||||
fi
|
||||
|
@ -91,7 +91,8 @@ check_modules_linux() {
|
||||
|
||||
for KMOD in $KMOD_SPL $KMOD_ZAVL $KMOD_ZNVPAIR $KMOD_ZUNICODE $KMOD_ZCOMMON \
|
||||
$KMOD_ZLUA $KMOD_ZZSTD $KMOD_ICP $KMOD_ZFS; do
|
||||
NAME=$(basename "$KMOD" .ko)
|
||||
NAME="${KMOD##*/}"
|
||||
NAME="${NAME%.ko}"
|
||||
|
||||
if lsmod | grep -E -q "^${NAME}"; then
|
||||
LOADED_MODULES="$LOADED_MODULES\t$NAME\n"
|
||||
@ -172,7 +173,8 @@ load_modules_linux() {
|
||||
unload_module_linux() {
|
||||
KMOD=$1
|
||||
|
||||
NAME=$(basename "$KMOD" .ko)
|
||||
NAME="${KMOD##*/}"
|
||||
NAME="${NAME%.ko}"
|
||||
FILE=$(modinfo "$KMOD" | awk '/^filename:/ {print $2}')
|
||||
VERSION=$(modinfo "$KMOD" | awk '/^version:/ {print $2}')
|
||||
|
||||
@ -198,8 +200,9 @@ unload_modules_freebsd() {
|
||||
unload_modules_linux() {
|
||||
for KMOD in $KMOD_ZFS $KMOD_ICP $KMOD_ZZSTD $KMOD_ZLUA $KMOD_ZCOMMON \
|
||||
$KMOD_ZUNICODE $KMOD_ZNVPAIR $KMOD_ZAVL $KMOD_SPL; do
|
||||
NAME=$(basename "$KMOD" .ko)
|
||||
USE_COUNT=$(lsmod | grep -E "^${NAME} " | awk '{print $3}')
|
||||
NAME="${KMOD##*/}"
|
||||
NAME="${NAME%.ko}"
|
||||
USE_COUNT=$(lsmod | awk '/^'"${NAME}"'/ {print $3}')
|
||||
|
||||
if [ "$USE_COUNT" = "0" ] ; then
|
||||
unload_module_linux "$KMOD" || return 1
|
||||
|
@ -486,7 +486,7 @@ for TAG in $POOL_TAGS; do
|
||||
"$POOL_DIR_COPY" || \
|
||||
fail "Failed to copy $POOL_DIR_PRISTINE to $POOL_DIR_COPY"
|
||||
POOL_NAME=$($ZPOOL_CMD import -d "$POOL_DIR_COPY" | \
|
||||
awk '/pool:/ { print $2; exit 0 }')
|
||||
awk '/pool:/ { print $2; exit }')
|
||||
|
||||
if ! $ZPOOL_CMD import -N -d "$POOL_DIR_COPY"
|
||||
"$POOL_NAME" &>/dev/null; then
|
||||
|
@ -109,7 +109,7 @@ tests = ['tst.destroy_fs', 'tst.destroy_snap', 'tst.get_count_and_limit',
|
||||
tags = ['functional', 'channel_program', 'synctask_core']
|
||||
|
||||
[tests/functional/checksum]
|
||||
tests = ['run_sha2_test', 'run_skein_test', 'filetest_001_pos',
|
||||
tests = ['run_edonr_test', 'run_sha2_test', 'run_skein_test', 'filetest_001_pos',
|
||||
'filetest_002_pos']
|
||||
tags = ['functional', 'checksum']
|
||||
|
||||
@ -122,8 +122,9 @@ tags = ['functional', 'clean_mirror']
|
||||
tests = ['zdb_002_pos', 'zdb_003_pos', 'zdb_004_pos', 'zdb_005_pos',
|
||||
'zdb_006_pos', 'zdb_args_neg', 'zdb_args_pos',
|
||||
'zdb_block_size_histogram', 'zdb_checksum', 'zdb_decompress',
|
||||
'zdb_display_block', 'zdb_object_range_neg', 'zdb_object_range_pos',
|
||||
'zdb_objset_id', 'zdb_decompress_zstd', 'zdb_recover', 'zdb_recover_2']
|
||||
'zdb_display_block', 'zdb_label_checksum', 'zdb_object_range_neg',
|
||||
'zdb_object_range_pos', 'zdb_objset_id', 'zdb_decompress_zstd',
|
||||
'zdb_recover', 'zdb_recover_2']
|
||||
pre =
|
||||
post =
|
||||
tags = ['functional', 'cli_root', 'zdb']
|
||||
@ -316,6 +317,12 @@ tags = ['functional', 'cli_root', 'zfs_upgrade']
|
||||
tests = ['zfs_wait_deleteq']
|
||||
tags = ['functional', 'cli_root', 'zfs_wait']
|
||||
|
||||
[tests/functional/cli_root/zhack]
|
||||
tests = ['zhack_label_checksum']
|
||||
pre =
|
||||
post =
|
||||
tags = ['functional', 'cli_root', 'zhack']
|
||||
|
||||
[tests/functional/cli_root/zpool]
|
||||
tests = ['zpool_001_neg', 'zpool_002_pos', 'zpool_003_pos', 'zpool_colors']
|
||||
tags = ['functional', 'cli_root', 'zpool']
|
||||
|
@ -38,10 +38,6 @@ tags = ['functional', 'atime']
|
||||
tests = ['chattr_001_pos', 'chattr_002_neg']
|
||||
tags = ['functional', 'chattr']
|
||||
|
||||
[tests/functional/checksum:Linux]
|
||||
tests = ['run_edonr_test']
|
||||
tags = ['functional', 'checksum']
|
||||
|
||||
[tests/functional/cli_root/zfs:Linux]
|
||||
tests = ['zfs_003_neg']
|
||||
tags = ['functional', 'cli_root', 'zfs']
|
||||
|
@ -293,6 +293,7 @@ elif sys.platform.startswith('linux'):
|
||||
'alloc_class/alloc_class_011_neg': ['FAIL', known_reason],
|
||||
'alloc_class/alloc_class_012_pos': ['FAIL', known_reason],
|
||||
'alloc_class/alloc_class_013_pos': ['FAIL', '11888'],
|
||||
'cli_root/zfs_copies/zfs_copies_003_pos': ['FAIL', '12301'],
|
||||
'cli_root/zfs_rename/zfs_rename_002_pos': ['FAIL', known_reason],
|
||||
'cli_root/zpool_expand/zpool_expand_001_pos': ['FAIL', known_reason],
|
||||
'cli_root/zpool_expand/zpool_expand_005_pos': ['FAIL', known_reason],
|
||||
|
@ -652,3 +652,16 @@ function corrupt_blocks_at_level # input_file corrupt_level
|
||||
# This is necessary for pools made of loop devices.
|
||||
sync
|
||||
}
|
||||
|
||||
function corrupt_label_checksum # label_number vdev_path
|
||||
{
|
||||
typeset label_size=$((256*1024))
|
||||
typeset vdev_size=$(stat_size ${2})
|
||||
typeset -a offsets=("$((128*1024 - 32))" \
|
||||
"$(($label_size + (128*1024 - 32)))" \
|
||||
"$(($vdev_size - $label_size - (128*1024 + 32)))" \
|
||||
"$(($vdev_size - (128*1024 + 32)))")
|
||||
|
||||
dd if=/dev/urandom of=${2} seek=${offsets[$1]} bs=1 count=32 \
|
||||
conv=notrunc
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ function unmounted
|
||||
|
||||
function splitline
|
||||
{
|
||||
echo $1 | sed "s/,/ /g"
|
||||
echo $1 | tr ',' ' '
|
||||
}
|
||||
|
||||
function default_setup
|
||||
@ -1092,9 +1092,7 @@ function get_endslice #<disk> <slice>
|
||||
case "$(uname)" in
|
||||
Linux)
|
||||
endcyl=$(parted -s $DEV_DSKDIR/$disk -- unit cyl print | \
|
||||
grep "part${slice}" | \
|
||||
awk '{print $3}' | \
|
||||
sed 's,cyl,,')
|
||||
awk "/part${slice}/"' {sub(/cyl/, "", $3); print $3}')
|
||||
((endcyl = (endcyl + 1)))
|
||||
;;
|
||||
FreeBSD)
|
||||
@ -1461,7 +1459,7 @@ function is_shared_smb
|
||||
if datasetnonexists "$fs" ; then
|
||||
return 1
|
||||
else
|
||||
fs=$(echo $fs | sed 's@/@_@g')
|
||||
fs=$(echo $fs | tr / _)
|
||||
fi
|
||||
|
||||
if is_linux; then
|
||||
|
@ -21,13 +21,11 @@ dist_pkgdata_DATA = \
|
||||
pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/checksum
|
||||
|
||||
pkgexec_PROGRAMS = \
|
||||
edonr_test \
|
||||
skein_test \
|
||||
sha2_test
|
||||
|
||||
skein_test_SOURCES = skein_test.c
|
||||
sha2_test_SOURCES = sha2_test.c
|
||||
|
||||
if BUILD_LINUX
|
||||
pkgexec_PROGRAMS += edonr_test
|
||||
edonr_test_SOURCES = edonr_test.c
|
||||
endif
|
||||
|
@ -30,7 +30,4 @@
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
set -A CHECKSUM_TYPES "fletcher2" "fletcher4" "sha256" "sha512" "skein"
|
||||
if ! is_freebsd; then
|
||||
CHECKSUM_TYPES+=("edonr")
|
||||
fi
|
||||
set -A CHECKSUM_TYPES "fletcher2" "fletcher4" "sha256" "sha512" "skein" "edonr"
|
||||
|
@ -35,6 +35,7 @@ SUBDIRS = \
|
||||
zfs_unshare \
|
||||
zfs_upgrade \
|
||||
zfs_wait \
|
||||
zhack \
|
||||
zpool \
|
||||
zpool_add \
|
||||
zpool_attach \
|
||||
|
@ -14,6 +14,7 @@ dist_pkgdata_SCRIPTS = \
|
||||
zdb_object_range_neg.ksh \
|
||||
zdb_object_range_pos.ksh \
|
||||
zdb_display_block.ksh \
|
||||
zdb_label_checksum.ksh \
|
||||
zdb_objset_id.ksh \
|
||||
zdb_recover.ksh \
|
||||
zdb_recover_2.ksh
|
||||
|
@ -0,0 +1,78 @@
|
||||
#!/bin/ksh
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2021 by vStack. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/include/blkdev.shlib
|
||||
|
||||
#
|
||||
# Description:
|
||||
# zdb -l will report corrupted labels checksums
|
||||
#
|
||||
# Strategy:
|
||||
# 1. Create pool with some number of vdevs and export it
|
||||
# 2. Corrupt label 0 and label 1, check that corrupted labels are reported
|
||||
# 3. Check that pool still be imported correctly
|
||||
# 4. Corrupt all labels, check that all corrupted labels are reported
|
||||
# 5. Check that pool cannot be imported
|
||||
#
|
||||
|
||||
log_assert "Verify zdb -l will report corrupted labels checksums"
|
||||
log_onexit cleanup
|
||||
|
||||
VIRTUAL_DISK=$TEST_BASE_DIR/disk
|
||||
|
||||
function cleanup
|
||||
{
|
||||
poolexists $TESTPOOL && log_must destroy_pool $TESTPOOL
|
||||
[[ -f $VIRTUAL_DISK ]] && log_must rm $VIRTUAL_DISK
|
||||
}
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_must truncate -s $(($MINVDEVSIZE * 8)) $VIRTUAL_DISK
|
||||
|
||||
log_must zpool create $TESTPOOL $VIRTUAL_DISK
|
||||
log_must zpool export $TESTPOOL
|
||||
|
||||
corrupt_label_checksum 0 $VIRTUAL_DISK
|
||||
corrupt_label_checksum 1 $VIRTUAL_DISK
|
||||
|
||||
msg_count=$(zdb -l $VIRTUAL_DISK | grep -c '(Bad label cksum)')
|
||||
[ $msg_count -ne 1 ] && \
|
||||
log_fail "zdb -l produces an incorrect number of corrupted labels."
|
||||
|
||||
msg_count=$(zdb -lll $VIRTUAL_DISK | grep -c '(Bad label cksum)')
|
||||
[ $msg_count -ne 2 ] && \
|
||||
log_fail "zdb -l produces an incorrect number of corrupted labels."
|
||||
|
||||
log_must zpool import $TESTPOOL -d $TEST_BASE_DIR
|
||||
log_must zpool export $TESTPOOL
|
||||
|
||||
corrupt_label_checksum 0 $VIRTUAL_DISK
|
||||
corrupt_label_checksum 1 $VIRTUAL_DISK
|
||||
corrupt_label_checksum 2 $VIRTUAL_DISK
|
||||
corrupt_label_checksum 3 $VIRTUAL_DISK
|
||||
|
||||
msg_count=$(zdb -lll $VIRTUAL_DISK | grep -c '(Bad label cksum)')
|
||||
[ $msg_count -ne 4 ] && \
|
||||
log_fail "zdb -l produces an incorrect number of corrupted labels."
|
||||
|
||||
log_mustnot zpool import $TESTPOOL -d $TEST_BASE_DIR
|
||||
|
||||
cleanup
|
||||
|
||||
log_pass "zdb -l bad cksum report is correct."
|
@ -46,10 +46,7 @@
|
||||
verify_runnable "both"
|
||||
|
||||
set -A dataset "$TESTPOOL" "$TESTPOOL/$TESTFS" "$TESTPOOL/$TESTVOL"
|
||||
set -A values "on" "off" "fletcher2" "fletcher4" "sha256" "sha512" "skein" "noparity"
|
||||
if is_linux; then
|
||||
values+=("edonr")
|
||||
fi
|
||||
set -A values "on" "off" "fletcher2" "fletcher4" "sha256" "sha512" "skein" "edonr" "noparity"
|
||||
|
||||
log_assert "Setting a valid checksum on a file system, volume," \
|
||||
"it should be successful."
|
||||
|
@ -0,0 +1,3 @@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zhack
|
||||
dist_pkgdata_SCRIPTS = \
|
||||
zhack_label_checksum.ksh
|
@ -0,0 +1,64 @@
|
||||
#!/bin/ksh
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2021 by vStack. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/include/blkdev.shlib
|
||||
|
||||
#
|
||||
# Description:
|
||||
# zhack label repair <vdev> will calculate and rewrite label checksum if invalid
|
||||
#
|
||||
# Strategy:
|
||||
# 1. Create pool with some number of vdevs and export it
|
||||
# 2. Corrupt all labels checksums
|
||||
# 3. Check that pool cannot be imported
|
||||
# 4. Use zhack to repair labels checksums
|
||||
# 5. Check that pool can be imported
|
||||
#
|
||||
|
||||
log_assert "Verify zhack label repair <vdev> will repair labels checksums"
|
||||
log_onexit cleanup
|
||||
|
||||
VIRTUAL_DISK=$TEST_BASE_DIR/disk
|
||||
|
||||
function cleanup
|
||||
{
|
||||
poolexists $TESTPOOL && destroy_pool $TESTPOOL
|
||||
[[ -f $VIRTUAL_DISK ]] && log_must rm $VIRTUAL_DISK
|
||||
}
|
||||
|
||||
log_must truncate -s $(($MINVDEVSIZE * 8)) $VIRTUAL_DISK
|
||||
|
||||
log_must zpool create $TESTPOOL $VIRTUAL_DISK
|
||||
log_must zpool export $TESTPOOL
|
||||
|
||||
log_mustnot zhack label repair $VIRTUAL_DISK
|
||||
|
||||
corrupt_label_checksum 0 $VIRTUAL_DISK
|
||||
corrupt_label_checksum 1 $VIRTUAL_DISK
|
||||
corrupt_label_checksum 2 $VIRTUAL_DISK
|
||||
corrupt_label_checksum 3 $VIRTUAL_DISK
|
||||
|
||||
log_mustnot zpool import $TESTPOOL -d $TEST_BASE_DIR
|
||||
|
||||
log_must zhack label repair $VIRTUAL_DISK
|
||||
|
||||
log_must zpool import $TESTPOOL -d $TEST_BASE_DIR
|
||||
|
||||
cleanup
|
||||
|
||||
log_pass "zhack label repair works correctly."
|
@ -39,8 +39,9 @@
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create a storage pool
|
||||
# 2. Add the two same devices to pool A
|
||||
# 3. Add the device in pool A to pool A again
|
||||
# 2. Add the device in pool A to pool A again
|
||||
# 3. Add the two devices to pool A in the loop, one of them already
|
||||
# added or same device added multiple times
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
@ -58,8 +59,13 @@ log_onexit cleanup
|
||||
create_pool $TESTPOOL $DISK0
|
||||
log_must poolexists $TESTPOOL
|
||||
|
||||
log_mustnot zpool add -f $TESTPOOL $DISK1 $DISK1
|
||||
log_mustnot zpool add -f $TESTPOOL $DISK0
|
||||
|
||||
for type in "" "mirror" "raidz" "draid" "spare" "log" "dedup" "special" "cache"
|
||||
do
|
||||
log_mustnot zpool add -f $TESTPOOL $type $DISK0 $DISK1
|
||||
log_mustnot zpool add -f $TESTPOOL $type $DISK1 $DISK1
|
||||
done
|
||||
|
||||
log_pass "'zpool add' get fail as expected if vdevs are the same or vdev is " \
|
||||
"contained in the given pool."
|
||||
|
@ -72,6 +72,7 @@ typeset -a properties=(
|
||||
"feature@large_blocks"
|
||||
"feature@sha512"
|
||||
"feature@skein"
|
||||
"feature@edonr"
|
||||
"feature@device_removal"
|
||||
"feature@obsolete_counts"
|
||||
"feature@zpool_checkpoint"
|
||||
@ -97,10 +98,4 @@ if is_linux || is_freebsd; then
|
||||
"feature@livelist"
|
||||
"feature@zstd_compress"
|
||||
)
|
||||
fi
|
||||
|
||||
if ! is_freebsd; then
|
||||
properties+=(
|
||||
"feature@edonr"
|
||||
)
|
||||
fi
|
||||
fi
|
@ -116,3 +116,22 @@ function verify_reverse_sort { # command list name
|
||||
"unexpected number of filesystems found in list output!"
|
||||
fi
|
||||
}
|
||||
|
||||
function is_fs_type_zfs {
|
||||
|
||||
typeset dirname=$1
|
||||
typeset fs="$(df $dirname | tail -1 | awk '{print $NF}')"
|
||||
|
||||
if is_freebsd; then
|
||||
fs_type=$(mount | awk -v fs=$fs '{if ($3 == fs) print $4}' \
|
||||
| sed -n 's/(\(.*\),/\1/p')
|
||||
elif is_linux; then
|
||||
fs_type=$(mount | awk -v fs=$fs '{if ($3 == fs) print $5}')
|
||||
fi
|
||||
|
||||
if [[ $fs_type == "zfs" ]]; then
|
||||
true
|
||||
else
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/cli_user/zfs_list/zfs_list.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
@ -55,8 +55,12 @@ paths="$TESTPOOL/NONEXISTFS $TESTPOOL/$TESTFS/NONEXISTFS \
|
||||
cd /tmp
|
||||
|
||||
for fs in $paths ; do
|
||||
log_mustnot zfs list $fs
|
||||
log_mustnot zfs list -r $fs
|
||||
# In cases when ZFS is on root, /tmp will belong to ZFS and hence must be
|
||||
# skipped
|
||||
if ! is_fs_type_zfs $fs; then
|
||||
log_mustnot zfs list $fs
|
||||
log_mustnot zfs list -r $fs
|
||||
fi
|
||||
done
|
||||
|
||||
log_pass "'zfs list [-r]' fails while the given dataset/path does not exist " \
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
fs=$TESTPOOL/$TESTFS/$(basename $0).$$
|
||||
fs=$TESTPOOL/$TESTFS/${0##*/}.$$
|
||||
|
||||
function cleanup
|
||||
{
|
||||
|
@ -824,7 +824,7 @@
|
||||
/* #undef ZFS_IS_GPL_COMPATIBLE */
|
||||
|
||||
/* Define the project alias string. */
|
||||
#define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_g6c8f03232"
|
||||
#define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_g269b5dadc"
|
||||
|
||||
/* Define the project author. */
|
||||
#define ZFS_META_AUTHOR "OpenZFS"
|
||||
@ -854,7 +854,7 @@
|
||||
#define ZFS_META_NAME "zfs"
|
||||
|
||||
/* Define the project release. */
|
||||
#define ZFS_META_RELEASE "FreeBSD_g6c8f03232"
|
||||
#define ZFS_META_RELEASE "FreeBSD_g269b5dadc"
|
||||
|
||||
/* Define the project version. */
|
||||
#define ZFS_META_VERSION "2.1.99"
|
||||
|
@ -2,4 +2,4 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define ZFS_META_GITREV "zfs-2.1.99-518-g6c8f03232"
|
||||
#define ZFS_META_GITREV "zfs-2.1.99-530-g269b5dadc"
|
||||
|
Loading…
x
Reference in New Issue
Block a user