Merge branch 'ozfs/zfs-2.2-release'

Sync with upstream zfs-2.2-release
This commit is contained in:
Ameer Hamza 2023-09-04 14:01:56 +05:00
commit fd6234de03
23 changed files with 166 additions and 119 deletions

View File

@ -16,6 +16,7 @@ dist_zedexec_SCRIPTS = \
%D%/scrub_finish-notify.sh \ %D%/scrub_finish-notify.sh \
%D%/statechange-led.sh \ %D%/statechange-led.sh \
%D%/statechange-notify.sh \ %D%/statechange-notify.sh \
%D%/statechange-slot_off.sh \
%D%/trim_finish-notify.sh \ %D%/trim_finish-notify.sh \
%D%/vdev_attach-led.sh \ %D%/vdev_attach-led.sh \
%D%/vdev_clear-led.sh %D%/vdev_clear-led.sh
@ -35,6 +36,7 @@ zedconfdefaults = \
scrub_finish-notify.sh \ scrub_finish-notify.sh \
statechange-led.sh \ statechange-led.sh \
statechange-notify.sh \ statechange-notify.sh \
statechange-slot_off.sh \
vdev_attach-led.sh \ vdev_attach-led.sh \
vdev_clear-led.sh vdev_clear-led.sh

View File

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
# shellcheck disable=SC3014,SC2154,SC2086,SC2034
# #
# Turn off disk's enclosure slot if it becomes FAULTED. # Turn off disk's enclosure slot if it becomes FAULTED.
# #
@ -43,15 +44,17 @@ if [ ! -f "$ZEVENT_VDEV_ENC_SYSFS_PATH/power_status" ] ; then
exit 4 exit 4
fi fi
echo "off" | tee "$ZEVENT_VDEV_ENC_SYSFS_PATH/power_status" # Turn off the slot and wait for sysfs to report that the slot is off.
# It can take ~400ms on some enclosures and multiple retries may be needed.
# Wait for sysfs for report that the slot is off. It can take ~400ms on some
# enclosures.
for i in $(seq 1 20) ; do for i in $(seq 1 20) ; do
if [ "$(cat $ZEVENT_VDEV_ENC_SYSFS_PATH/power_status)" == "off" ] ; then echo "off" | tee "$ZEVENT_VDEV_ENC_SYSFS_PATH/power_status"
break
fi for j in $(seq 1 5) ; do
sleep 0.1 if [ "$(cat $ZEVENT_VDEV_ENC_SYSFS_PATH/power_status)" == "off" ] ; then
break 2
fi
sleep 0.1
done
done done
if [ "$(cat $ZEVENT_VDEV_ENC_SYSFS_PATH/power_status)" != "off" ] ; then if [ "$(cat $ZEVENT_VDEV_ENC_SYSFS_PATH/power_status)" != "off" ] ; then

View File

@ -3143,6 +3143,7 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
nvlist_t *props, int flags) nvlist_t *props, int flags)
{ {
int ret = 0; int ret = 0;
int ms_status = 0;
zpool_handle_t *zhp; zpool_handle_t *zhp;
const char *name; const char *name;
uint64_t version; uint64_t version;
@ -3232,10 +3233,15 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
ret = 1; ret = 1;
if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL && if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL &&
!(flags & ZFS_IMPORT_ONLY) && !(flags & ZFS_IMPORT_ONLY)) {
zpool_enable_datasets(zhp, mntopts, 0) != 0) { ms_status = zpool_enable_datasets(zhp, mntopts, 0);
zpool_close(zhp); if (ms_status == EZFS_SHAREFAILED) {
return (1); (void) fprintf(stderr, gettext("Import was "
"successful, but unable to share some datasets"));
} else if (ms_status == EZFS_MOUNTFAILED) {
(void) fprintf(stderr, gettext("Import was "
"successful, but unable to mount some datasets"));
}
} }
zpool_close(zhp); zpool_close(zhp);
@ -6755,6 +6761,7 @@ zpool_do_split(int argc, char **argv)
char *mntopts = NULL; char *mntopts = NULL;
splitflags_t flags; splitflags_t flags;
int c, ret = 0; int c, ret = 0;
int ms_status = 0;
boolean_t loadkeys = B_FALSE; boolean_t loadkeys = B_FALSE;
zpool_handle_t *zhp; zpool_handle_t *zhp;
nvlist_t *config, *props = NULL; nvlist_t *config, *props = NULL;
@ -6891,13 +6898,18 @@ zpool_do_split(int argc, char **argv)
ret = 1; ret = 1;
} }
if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL && if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL) {
zpool_enable_datasets(zhp, mntopts, 0) != 0) { ms_status = zpool_enable_datasets(zhp, mntopts, 0);
ret = 1; if (ms_status == EZFS_SHAREFAILED) {
(void) fprintf(stderr, gettext("Split was successful, but " (void) fprintf(stderr, gettext("Split was successful, "
"the datasets could not all be mounted\n")); "datasets are mounted but sharing of some datasets "
(void) fprintf(stderr, gettext("Try doing '%s' with a " "has failed\n"));
"different altroot\n"), "zpool import"); } else if (ms_status == EZFS_MOUNTFAILED) {
(void) fprintf(stderr, gettext("Split was successful"
", but some datasets could not be mounted\n"));
(void) fprintf(stderr, gettext("Try doing '%s' with a "
"different altroot\n"), "zpool import");
}
} }
zpool_close(zhp); zpool_close(zhp);
nvlist_free(config); nvlist_free(config);

View File

@ -60,7 +60,6 @@ usr/share/man/man8/zfs-get.8
usr/share/man/man8/zfs-groupspace.8 usr/share/man/man8/zfs-groupspace.8
usr/share/man/man8/zfs-hold.8 usr/share/man/man8/zfs-hold.8
usr/share/man/man8/zfs-inherit.8 usr/share/man/man8/zfs-inherit.8
usr/share/man/man8/zfs-jail.8
usr/share/man/man8/zfs-list.8 usr/share/man/man8/zfs-list.8
usr/share/man/man8/zfs-load-key.8 usr/share/man/man8/zfs-load-key.8
usr/share/man/man8/zfs-mount-generator.8 usr/share/man/man8/zfs-mount-generator.8
@ -80,7 +79,6 @@ usr/share/man/man8/zfs-set.8
usr/share/man/man8/zfs-share.8 usr/share/man/man8/zfs-share.8
usr/share/man/man8/zfs-snapshot.8 usr/share/man/man8/zfs-snapshot.8
usr/share/man/man8/zfs-unallow.8 usr/share/man/man8/zfs-unallow.8
usr/share/man/man8/zfs-unjail.8
usr/share/man/man8/zfs-unload-key.8 usr/share/man/man8/zfs-unload-key.8
usr/share/man/man8/zfs-unmount.8 usr/share/man/man8/zfs-unmount.8
usr/share/man/man8/zfs-unzone.8 usr/share/man/man8/zfs-unzone.8

View File

@ -156,6 +156,7 @@ typedef enum zfs_error {
EZFS_NOT_USER_NAMESPACE, /* a file is not a user namespace */ EZFS_NOT_USER_NAMESPACE, /* a file is not a user namespace */
EZFS_CKSUM, /* insufficient replicas */ EZFS_CKSUM, /* insufficient replicas */
EZFS_RESUME_EXISTS, /* Resume on existing dataset without force */ EZFS_RESUME_EXISTS, /* Resume on existing dataset without force */
EZFS_SHAREFAILED, /* filesystem share failed */
EZFS_UNKNOWN EZFS_UNKNOWN
} zfs_error_t; } zfs_error_t;

View File

@ -126,6 +126,15 @@ extern void kfpu_end(void);
#error "Toolchain needs to support the XSAVE assembler instruction" #error "Toolchain needs to support the XSAVE assembler instruction"
#endif #endif
#ifndef XFEATURE_MASK_XTILE
/*
* For kernels where this doesn't exist yet, we still don't want to break
* by save/restoring this broken nonsense.
* See issue #14989 or Intel errata SPR4 for why
*/
#define XFEATURE_MASK_XTILE 0x60000
#endif
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/slab.h> #include <linux/slab.h>
@ -294,18 +303,18 @@ kfpu_begin(void)
uint8_t *state = zfs_kfpu_fpregs[smp_processor_id()]; uint8_t *state = zfs_kfpu_fpregs[smp_processor_id()];
#if defined(HAVE_XSAVES) #if defined(HAVE_XSAVES)
if (static_cpu_has(X86_FEATURE_XSAVES)) { if (static_cpu_has(X86_FEATURE_XSAVES)) {
kfpu_do_xsave("xsaves", state, ~0); kfpu_do_xsave("xsaves", state, ~XFEATURE_MASK_XTILE);
return; return;
} }
#endif #endif
#if defined(HAVE_XSAVEOPT) #if defined(HAVE_XSAVEOPT)
if (static_cpu_has(X86_FEATURE_XSAVEOPT)) { if (static_cpu_has(X86_FEATURE_XSAVEOPT)) {
kfpu_do_xsave("xsaveopt", state, ~0); kfpu_do_xsave("xsaveopt", state, ~XFEATURE_MASK_XTILE);
return; return;
} }
#endif #endif
if (static_cpu_has(X86_FEATURE_XSAVE)) { if (static_cpu_has(X86_FEATURE_XSAVE)) {
kfpu_do_xsave("xsave", state, ~0); kfpu_do_xsave("xsave", state, ~XFEATURE_MASK_XTILE);
} else if (static_cpu_has(X86_FEATURE_FXSR)) { } else if (static_cpu_has(X86_FEATURE_FXSR)) {
kfpu_save_fxsr(state); kfpu_save_fxsr(state);
} else { } else {
@ -355,12 +364,12 @@ kfpu_end(void)
uint8_t *state = zfs_kfpu_fpregs[smp_processor_id()]; uint8_t *state = zfs_kfpu_fpregs[smp_processor_id()];
#if defined(HAVE_XSAVES) #if defined(HAVE_XSAVES)
if (static_cpu_has(X86_FEATURE_XSAVES)) { if (static_cpu_has(X86_FEATURE_XSAVES)) {
kfpu_do_xrstor("xrstors", state, ~0); kfpu_do_xrstor("xrstors", state, ~XFEATURE_MASK_XTILE);
goto out; goto out;
} }
#endif #endif
if (static_cpu_has(X86_FEATURE_XSAVE)) { if (static_cpu_has(X86_FEATURE_XSAVE)) {
kfpu_do_xrstor("xrstor", state, ~0); kfpu_do_xrstor("xrstor", state, ~XFEATURE_MASK_XTILE);
} else if (static_cpu_has(X86_FEATURE_FXSR)) { } else if (static_cpu_has(X86_FEATURE_FXSR)) {
kfpu_restore_fxsr(state); kfpu_restore_fxsr(state);
} else { } else {

View File

@ -1300,7 +1300,7 @@ zpool_enable_datasets(zpool_handle_t *zhp, const char *mntopts, int flags)
zfs_foreach_mountpoint(zhp->zpool_hdl, cb.cb_handles, cb.cb_used, zfs_foreach_mountpoint(zhp->zpool_hdl, cb.cb_handles, cb.cb_used,
zfs_mount_one, &ms, B_TRUE); zfs_mount_one, &ms, B_TRUE);
if (ms.ms_mntstatus != 0) if (ms.ms_mntstatus != 0)
ret = ms.ms_mntstatus; ret = EZFS_MOUNTFAILED;
/* /*
* Share all filesystems that need to be shared. This needs to be * Share all filesystems that need to be shared. This needs to be
@ -1311,7 +1311,7 @@ zpool_enable_datasets(zpool_handle_t *zhp, const char *mntopts, int flags)
zfs_foreach_mountpoint(zhp->zpool_hdl, cb.cb_handles, cb.cb_used, zfs_foreach_mountpoint(zhp->zpool_hdl, cb.cb_handles, cb.cb_used,
zfs_share_one, &ms, B_FALSE); zfs_share_one, &ms, B_FALSE);
if (ms.ms_mntstatus != 0) if (ms.ms_mntstatus != 0)
ret = ms.ms_mntstatus; ret = EZFS_SHAREFAILED;
else else
zfs_commit_shares(NULL); zfs_commit_shares(NULL);

View File

@ -38,7 +38,6 @@ dist_man_MANS = \
%D%/man8/zfs-groupspace.8 \ %D%/man8/zfs-groupspace.8 \
%D%/man8/zfs-hold.8 \ %D%/man8/zfs-hold.8 \
%D%/man8/zfs-inherit.8 \ %D%/man8/zfs-inherit.8 \
%D%/man8/zfs-jail.8 \
%D%/man8/zfs-list.8 \ %D%/man8/zfs-list.8 \
%D%/man8/zfs-load-key.8 \ %D%/man8/zfs-load-key.8 \
%D%/man8/zfs-mount.8 \ %D%/man8/zfs-mount.8 \
@ -57,14 +56,11 @@ dist_man_MANS = \
%D%/man8/zfs-share.8 \ %D%/man8/zfs-share.8 \
%D%/man8/zfs-snapshot.8 \ %D%/man8/zfs-snapshot.8 \
%D%/man8/zfs-unallow.8 \ %D%/man8/zfs-unallow.8 \
%D%/man8/zfs-unjail.8 \
%D%/man8/zfs-unload-key.8 \ %D%/man8/zfs-unload-key.8 \
%D%/man8/zfs-unmount.8 \ %D%/man8/zfs-unmount.8 \
%D%/man8/zfs-unzone.8 \
%D%/man8/zfs-upgrade.8 \ %D%/man8/zfs-upgrade.8 \
%D%/man8/zfs-userspace.8 \ %D%/man8/zfs-userspace.8 \
%D%/man8/zfs-wait.8 \ %D%/man8/zfs-wait.8 \
%D%/man8/zfs-zone.8 \
%D%/man8/zfs_ids_to_path.8 \ %D%/man8/zfs_ids_to_path.8 \
%D%/man8/zgenhostid.8 \ %D%/man8/zgenhostid.8 \
%D%/man8/zinject.8 \ %D%/man8/zinject.8 \
@ -104,6 +100,18 @@ dist_man_MANS = \
%D%/man8/zstreamdump.8 \ %D%/man8/zstreamdump.8 \
%D%/man8/zpool_influxdb.8 %D%/man8/zpool_influxdb.8
if BUILD_FREEBSD
dist_man_MANS += \
%D%/man8/zfs-jail.8 \
%D%/man8/zfs-unjail.8
endif
if BUILD_LINUX
dist_man_MANS += \
%D%/man8/zfs-unzone.8 \
%D%/man8/zfs-zone.8
endif
nodist_man_MANS = \ nodist_man_MANS = \
%D%/man8/zed.8 \ %D%/man8/zed.8 \
%D%/man8/zfs-mount-generator.8 %D%/man8/zfs-mount-generator.8

View File

@ -38,7 +38,7 @@
.\" Copyright (c) 2019, Kjeld Schouten-Lebbing .\" Copyright (c) 2019, Kjeld Schouten-Lebbing
.\" Copyright (c) 2022 Hewlett Packard Enterprise Development LP. .\" Copyright (c) 2022 Hewlett Packard Enterprise Development LP.
.\" .\"
.Dd April 18, 2023 .Dd August 8, 2023
.Dt ZFSPROPS 7 .Dt ZFSPROPS 7
.Os .Os
. .
@ -1911,13 +1911,15 @@ See
for more information. for more information.
Jails are a Jails are a
.Fx .Fx
feature and are not relevant on other platforms. feature and this property is not available on other platforms.
The default value is .It Sy zoned Ns = Ns Sy off Ns | Ns Sy on
.Sy off .
.It Sy zoned Ns = Ns Sy on Ns | Ns Sy off
Controls whether the dataset is managed from a non-global zone or namespace. Controls whether the dataset is managed from a non-global zone or namespace.
The default value is See
.Sy off . .Xr zfs-zone 8
for more information.
Zoning is a
Linux
feature and this property is not available on other platforms.
.El .El
.Pp .Pp
The following three properties cannot be changed after the file system is The following three properties cannot be changed after the file system is

View File

@ -110,9 +110,10 @@ Removes ZFS label information from the specified
.It Xo .It Xo
.Xr zpool-attach 8 Ns / Ns Xr zpool-detach 8 .Xr zpool-attach 8 Ns / Ns Xr zpool-detach 8
.Xc .Xc
Increases or decreases redundancy by Converts a non-redundant disk into a mirror, or increases
.Cm attach Ns ing or the redundancy level of an existing mirror
.Cm detach Ns ing a device on an existing vdev (virtual device). .Cm ( attach Ns ), or performs the inverse operation (
.Cm detach Ns ).
.It Xo .It Xo
.Xr zpool-add 8 Ns / Ns Xr zpool-remove 8 .Xr zpool-add 8 Ns / Ns Xr zpool-remove 8
.Xc .Xc
@ -233,16 +234,16 @@ Invalid command line options were specified.
.El .El
. .
.Sh EXAMPLES .Sh EXAMPLES
.\" Examples 1, 2, 3, 4, 11, 12 are shared with zpool-create.8. .\" Examples 1, 2, 3, 4, 12, 13 are shared with zpool-create.8.
.\" Examples 5, 13 are shared with zpool-add.8. .\" Examples 6, 14 are shared with zpool-add.8.
.\" Examples 6, 15 are shared with zpool-list.8. .\" Examples 7, 16 are shared with zpool-list.8.
.\" Examples 7 are shared with zpool-destroy.8. .\" Examples 8 are shared with zpool-destroy.8.
.\" Examples 8 are shared with zpool-export.8. .\" Examples 9 are shared with zpool-export.8.
.\" Examples 9 are shared with zpool-import.8. .\" Examples 10 are shared with zpool-import.8.
.\" Examples 10 are shared with zpool-upgrade.8. .\" Examples 11 are shared with zpool-upgrade.8.
.\" Examples 14 are shared with zpool-remove.8. .\" Examples 15 are shared with zpool-remove.8.
.\" Examples 16 are shared with zpool-status.8. .\" Examples 17 are shared with zpool-status.8.
.\" Examples 13, 16 are also shared with zpool-iostat.8. .\" Examples 14, 17 are also shared with zpool-iostat.8.
.\" Make sure to update them omnidirectionally .\" Make sure to update them omnidirectionally
.Ss Example 1 : No Creating a RAID-Z Storage Pool .Ss Example 1 : No Creating a RAID-Z Storage Pool
The following command creates a pool with a single raidz root vdev that The following command creates a pool with a single raidz root vdev that
@ -264,14 +265,21 @@ While not recommended, a pool based on files can be useful for experimental
purposes. purposes.
.Dl # Nm zpool Cm create Ar tank Pa /path/to/file/a /path/to/file/b .Dl # Nm zpool Cm create Ar tank Pa /path/to/file/a /path/to/file/b
. .
.Ss Example 5 : No Adding a Mirror to a ZFS Storage Pool .Ss Example 5 : No Making a non-mirrored ZFS Storage Pool mirrored
The following command converts an existing single device
.Ar sda
into a mirror by attaching a second device to it,
.Ar sdb .
.Dl # Nm zpool Cm attach Ar tank Pa sda sdb
.
.Ss Example 6 : No Adding a Mirror to a ZFS Storage Pool
The following command adds two mirrored disks to the pool The following command adds two mirrored disks to the pool
.Ar tank , .Ar tank ,
assuming the pool is already made up of two-way mirrors. assuming the pool is already made up of two-way mirrors.
The additional space is immediately available to any datasets within the pool. The additional space is immediately available to any datasets within the pool.
.Dl # Nm zpool Cm add Ar tank Sy mirror Pa sda sdb .Dl # Nm zpool Cm add Ar tank Sy mirror Pa sda sdb
. .
.Ss Example 6 : No Listing Available ZFS Storage Pools .Ss Example 7 : No Listing Available ZFS Storage Pools
The following command lists all available pools on the system. The following command lists all available pools on the system.
In this case, the pool In this case, the pool
.Ar zion .Ar zion
@ -285,19 +293,19 @@ tank 61.5G 20.0G 41.5G - 48% 32% 1.00x ONLINE -
zion - - - - - - - FAULTED - zion - - - - - - - FAULTED -
.Ed .Ed
. .
.Ss Example 7 : No Destroying a ZFS Storage Pool .Ss Example 8 : No Destroying a ZFS Storage Pool
The following command destroys the pool The following command destroys the pool
.Ar tank .Ar tank
and any datasets contained within: and any datasets contained within:
.Dl # Nm zpool Cm destroy Fl f Ar tank .Dl # Nm zpool Cm destroy Fl f Ar tank
. .
.Ss Example 8 : No Exporting a ZFS Storage Pool .Ss Example 9 : No Exporting a ZFS Storage Pool
The following command exports the devices in pool The following command exports the devices in pool
.Ar tank .Ar tank
so that they can be relocated or later imported: so that they can be relocated or later imported:
.Dl # Nm zpool Cm export Ar tank .Dl # Nm zpool Cm export Ar tank
. .
.Ss Example 9 : No Importing a ZFS Storage Pool .Ss Example 10 : No Importing a ZFS Storage Pool
The following command displays available pools, and then imports the pool The following command displays available pools, and then imports the pool
.Ar tank .Ar tank
for use on the system. for use on the system.
@ -318,7 +326,7 @@ config:
.No # Nm zpool Cm import Ar tank .No # Nm zpool Cm import Ar tank
.Ed .Ed
. .
.Ss Example 10 : No Upgrading All ZFS Storage Pools to the Current Version .Ss Example 11 : No Upgrading All ZFS Storage Pools to the Current Version
The following command upgrades all ZFS Storage pools to the current version of The following command upgrades all ZFS Storage pools to the current version of
the software: the software:
.Bd -literal -compact -offset Ds .Bd -literal -compact -offset Ds
@ -326,7 +334,7 @@ the software:
This system is currently running ZFS version 2. This system is currently running ZFS version 2.
.Ed .Ed
. .
.Ss Example 11 : No Managing Hot Spares .Ss Example 12 : No Managing Hot Spares
The following command creates a new pool with an available hot spare: The following command creates a new pool with an available hot spare:
.Dl # Nm zpool Cm create Ar tank Sy mirror Pa sda sdb Sy spare Pa sdc .Dl # Nm zpool Cm create Ar tank Sy mirror Pa sda sdb Sy spare Pa sdc
.Pp .Pp
@ -341,12 +349,12 @@ The hot spare can be permanently removed from the pool using the following
command: command:
.Dl # Nm zpool Cm remove Ar tank Pa sdc .Dl # Nm zpool Cm remove Ar tank Pa sdc
. .
.Ss Example 12 : No Creating a ZFS Pool with Mirrored Separate Intent Logs .Ss Example 13 : No Creating a ZFS Pool with Mirrored Separate Intent Logs
The following command creates a ZFS storage pool consisting of two, two-way The following command creates a ZFS storage pool consisting of two, two-way
mirrors and mirrored log devices: mirrors and mirrored log devices:
.Dl # Nm zpool Cm create Ar pool Sy mirror Pa sda sdb Sy mirror Pa sdc sdd Sy log mirror Pa sde sdf .Dl # Nm zpool Cm create Ar pool Sy mirror Pa sda sdb Sy mirror Pa sdc sdd Sy log mirror Pa sde sdf
. .
.Ss Example 13 : No Adding Cache Devices to a ZFS Pool .Ss Example 14 : No Adding Cache Devices to a ZFS Pool
The following command adds two disks for use as cache devices to a ZFS storage The following command adds two disks for use as cache devices to a ZFS storage
pool: pool:
.Dl # Nm zpool Cm add Ar pool Sy cache Pa sdc sdd .Dl # Nm zpool Cm add Ar pool Sy cache Pa sdc sdd
@ -359,7 +367,7 @@ Capacity and reads can be monitored using the
subcommand as follows: subcommand as follows:
.Dl # Nm zpool Cm iostat Fl v Ar pool 5 .Dl # Nm zpool Cm iostat Fl v Ar pool 5
. .
.Ss Example 14 : No Removing a Mirrored top-level (Log or Data) Device .Ss Example 15 : No Removing a Mirrored top-level (Log or Data) Device
The following commands remove the mirrored log device The following commands remove the mirrored log device
.Sy mirror-2 .Sy mirror-2
and mirrored top-level data device and mirrored top-level data device
@ -394,7 +402,7 @@ The command to remove the mirrored data
.Ar mirror-1 No is : .Ar mirror-1 No is :
.Dl # Nm zpool Cm remove Ar tank mirror-1 .Dl # Nm zpool Cm remove Ar tank mirror-1
. .
.Ss Example 15 : No Displaying expanded space on a device .Ss Example 16 : No Displaying expanded space on a device
The following command displays the detailed information for the pool The following command displays the detailed information for the pool
.Ar data . .Ar data .
This pool is comprised of a single raidz vdev where one of its devices This pool is comprised of a single raidz vdev where one of its devices
@ -411,7 +419,7 @@ data 23.9G 14.6G 9.30G - 48% 61% 1.00x ONLINE -
sdc - - - - - sdc - - - - -
.Ed .Ed
. .
.Ss Example 16 : No Adding output columns .Ss Example 17 : No Adding output columns
Additional columns can be added to the Additional columns can be added to the
.Nm zpool Cm status No and Nm zpool Cm iostat No output with Fl c . .Nm zpool Cm status No and Nm zpool Cm iostat No output with Fl c .
.Bd -literal -compact -offset Ds .Bd -literal -compact -offset Ds

View File

@ -2701,7 +2701,7 @@ dmu_buf_will_clone(dmu_buf_t *db_fake, dmu_tx_t *tx)
*/ */
mutex_enter(&db->db_mtx); mutex_enter(&db->db_mtx);
VERIFY(!dbuf_undirty(db, tx)); VERIFY(!dbuf_undirty(db, tx));
ASSERT0(dbuf_find_dirty_eq(db, tx->tx_txg)); ASSERT3P(dbuf_find_dirty_eq(db, tx->tx_txg), ==, NULL);
if (db->db_buf != NULL) { if (db->db_buf != NULL) {
arc_buf_destroy(db->db_buf, db); arc_buf_destroy(db->db_buf, db);
db->db_buf = NULL; db->db_buf = NULL;

View File

@ -814,17 +814,17 @@ static void
zil_free_lwb(zilog_t *zilog, lwb_t *lwb) zil_free_lwb(zilog_t *zilog, lwb_t *lwb)
{ {
ASSERT(MUTEX_HELD(&zilog->zl_lock)); ASSERT(MUTEX_HELD(&zilog->zl_lock));
ASSERT(!MUTEX_HELD(&lwb->lwb_vdev_lock)); ASSERT(lwb->lwb_state == LWB_STATE_NEW ||
VERIFY(list_is_empty(&lwb->lwb_waiters)); lwb->lwb_state == LWB_STATE_FLUSH_DONE);
VERIFY(list_is_empty(&lwb->lwb_itxs));
ASSERT(avl_is_empty(&lwb->lwb_vdev_tree));
ASSERT3P(lwb->lwb_child_zio, ==, NULL); ASSERT3P(lwb->lwb_child_zio, ==, NULL);
ASSERT3P(lwb->lwb_write_zio, ==, NULL); ASSERT3P(lwb->lwb_write_zio, ==, NULL);
ASSERT3P(lwb->lwb_root_zio, ==, NULL); ASSERT3P(lwb->lwb_root_zio, ==, NULL);
ASSERT3U(lwb->lwb_alloc_txg, <=, spa_syncing_txg(zilog->zl_spa)); ASSERT3U(lwb->lwb_alloc_txg, <=, spa_syncing_txg(zilog->zl_spa));
ASSERT3U(lwb->lwb_max_txg, <=, spa_syncing_txg(zilog->zl_spa)); ASSERT3U(lwb->lwb_max_txg, <=, spa_syncing_txg(zilog->zl_spa));
ASSERT(lwb->lwb_state == LWB_STATE_NEW || VERIFY(list_is_empty(&lwb->lwb_itxs));
lwb->lwb_state == LWB_STATE_FLUSH_DONE); VERIFY(list_is_empty(&lwb->lwb_waiters));
ASSERT(avl_is_empty(&lwb->lwb_vdev_tree));
ASSERT(!MUTEX_HELD(&lwb->lwb_vdev_lock));
/* /*
* Clear the zilog's field to indicate this lwb is no longer * Clear the zilog's field to indicate this lwb is no longer
@ -1329,6 +1329,9 @@ zil_lwb_add_block(lwb_t *lwb, const blkptr_t *bp)
int ndvas = BP_GET_NDVAS(bp); int ndvas = BP_GET_NDVAS(bp);
int i; int i;
ASSERT3S(lwb->lwb_state, !=, LWB_STATE_WRITE_DONE);
ASSERT3S(lwb->lwb_state, !=, LWB_STATE_FLUSH_DONE);
if (zil_nocacheflush) if (zil_nocacheflush)
return; return;
@ -1408,15 +1411,9 @@ zil_lwb_flush_vdevs_done(zio_t *zio)
zilog_t *zilog = lwb->lwb_zilog; zilog_t *zilog = lwb->lwb_zilog;
zil_commit_waiter_t *zcw; zil_commit_waiter_t *zcw;
itx_t *itx; itx_t *itx;
uint64_t txg;
list_t itxs, waiters;
spa_config_exit(zilog->zl_spa, SCL_STATE, lwb); spa_config_exit(zilog->zl_spa, SCL_STATE, lwb);
list_create(&itxs, sizeof (itx_t), offsetof(itx_t, itx_node));
list_create(&waiters, sizeof (zil_commit_waiter_t),
offsetof(zil_commit_waiter_t, zcw_node));
hrtime_t t = gethrtime() - lwb->lwb_issued_timestamp; hrtime_t t = gethrtime() - lwb->lwb_issued_timestamp;
mutex_enter(&zilog->zl_lock); mutex_enter(&zilog->zl_lock);
@ -1425,6 +1422,9 @@ zil_lwb_flush_vdevs_done(zio_t *zio)
lwb->lwb_root_zio = NULL; lwb->lwb_root_zio = NULL;
ASSERT3S(lwb->lwb_state, ==, LWB_STATE_WRITE_DONE);
lwb->lwb_state = LWB_STATE_FLUSH_DONE;
if (zilog->zl_last_lwb_opened == lwb) { if (zilog->zl_last_lwb_opened == lwb) {
/* /*
* Remember the highest committed log sequence number * Remember the highest committed log sequence number
@ -1435,22 +1435,13 @@ zil_lwb_flush_vdevs_done(zio_t *zio)
zilog->zl_commit_lr_seq = zilog->zl_lr_seq; zilog->zl_commit_lr_seq = zilog->zl_lr_seq;
} }
list_move_tail(&itxs, &lwb->lwb_itxs); while ((itx = list_remove_head(&lwb->lwb_itxs)) != NULL)
list_move_tail(&waiters, &lwb->lwb_waiters);
txg = lwb->lwb_issued_txg;
ASSERT3S(lwb->lwb_state, ==, LWB_STATE_WRITE_DONE);
lwb->lwb_state = LWB_STATE_FLUSH_DONE;
mutex_exit(&zilog->zl_lock);
while ((itx = list_remove_head(&itxs)) != NULL)
zil_itx_destroy(itx); zil_itx_destroy(itx);
list_destroy(&itxs);
while ((zcw = list_remove_head(&waiters)) != NULL) { while ((zcw = list_remove_head(&lwb->lwb_waiters)) != NULL) {
mutex_enter(&zcw->zcw_lock); mutex_enter(&zcw->zcw_lock);
ASSERT3P(zcw->zcw_lwb, ==, lwb);
zcw->zcw_lwb = NULL; zcw->zcw_lwb = NULL;
/* /*
* We expect any ZIO errors from child ZIOs to have been * We expect any ZIO errors from child ZIOs to have been
@ -1475,7 +1466,11 @@ zil_lwb_flush_vdevs_done(zio_t *zio)
mutex_exit(&zcw->zcw_lock); mutex_exit(&zcw->zcw_lock);
} }
list_destroy(&waiters);
uint64_t txg = lwb->lwb_issued_txg;
/* Once we drop the lock, lwb may be freed by zil_sync(). */
mutex_exit(&zilog->zl_lock);
mutex_enter(&zilog->zl_lwb_io_lock); mutex_enter(&zilog->zl_lwb_io_lock);
ASSERT3U(zilog->zl_lwb_inflight[txg & TXG_MASK], >, 0); ASSERT3U(zilog->zl_lwb_inflight[txg & TXG_MASK], >, 0);
@ -1929,10 +1924,10 @@ next_lwb:
BP_GET_LSIZE(&lwb->lwb_blk)); BP_GET_LSIZE(&lwb->lwb_blk));
} }
lwb->lwb_issued_timestamp = gethrtime(); lwb->lwb_issued_timestamp = gethrtime();
zio_nowait(lwb->lwb_root_zio);
zio_nowait(lwb->lwb_write_zio);
if (lwb->lwb_child_zio) if (lwb->lwb_child_zio)
zio_nowait(lwb->lwb_child_zio); zio_nowait(lwb->lwb_child_zio);
zio_nowait(lwb->lwb_write_zio);
zio_nowait(lwb->lwb_root_zio);
/* /*
* If nlwb was ready when we gave it the block pointer, * If nlwb was ready when we gave it the block pointer,

View File

@ -1775,8 +1775,9 @@ zio_write_compress(zio_t *zio)
compress = ZIO_COMPRESS_OFF; compress = ZIO_COMPRESS_OFF;
/* Make sure someone doesn't change their mind on overwrites */ /* Make sure someone doesn't change their mind on overwrites */
ASSERT(BP_IS_EMBEDDED(bp) || MIN(zp->zp_copies + BP_IS_GANG(bp), ASSERT(BP_IS_EMBEDDED(bp) || BP_IS_GANG(bp) ||
spa_max_replication(spa)) == BP_GET_NDVAS(bp)); MIN(zp->zp_copies, spa_max_replication(spa))
== BP_GET_NDVAS(bp));
} }
/* If it's a compressed write that is not raw, compress the buffer. */ /* If it's a compressed write that is not raw, compress the buffer. */

View File

@ -34,13 +34,21 @@ function have_same_content
log_must [ "$hash1" = "$hash2" ] log_must [ "$hash1" = "$hash2" ]
} }
function unique_blocks #
# get_same_blocks dataset1 path/to/file1 dataset2 path/to/file2
#
# Returns a space-separated list of the indexes (starting at 0) of the L0
# blocks that are shared between both files (by first DVA and checksum).
# Assumes that the two files have the same content, use have_same_content to
# confirm that.
#
function get_same_blocks
{ {
typeset zdbout=${TMPDIR:-$TEST_BASE_DIR}/zdbout.$$ typeset zdbout=${TMPDIR:-$TEST_BASE_DIR}/zdbout.$$
zdb -vvvvv $1 -O $2 | \ zdb -vvvvv $1 -O $2 | \
awk '/ L0 / { print ++l " " $3 " " $7 }' > $zdbout.a awk '/ L0 / { print l++ " " $3 " " $7 }' > $zdbout.a
zdb -vvvvv $3 -O $4 | \ zdb -vvvvv $3 -O $4 | \
awk '/ L0 / { print ++l " " $3 " " $7 }' > $zdbout.b awk '/ L0 / { print l++ " " $3 " " $7 }' > $zdbout.b
echo $(sort $zdbout.a $zdbout.b | uniq -d | cut -f1 -d' ') echo $(sort $zdbout.a $zdbout.b | uniq -d | cut -f1 -d' ')
} }

View File

@ -54,7 +54,7 @@ log_must sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2 log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2
typeset blocks=$(unique_blocks $TESTPOOL file1 $TESTPOOL file2) typeset blocks=$(get_same_blocks $TESTPOOL file1 $TESTPOOL file2)
log_must [ "$blocks" = "1 2 3 4" ] log_must [ "$blocks" = "0 1 2 3" ]
log_pass $claim log_pass $claim

View File

@ -58,8 +58,8 @@ log_must sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/$TESTFS1/file1 /$TESTPOOL/$TESTFS2/file2 log_must have_same_content /$TESTPOOL/$TESTFS1/file1 /$TESTPOOL/$TESTFS2/file2
typeset blocks=$(unique_blocks \ typeset blocks=$(get_same_blocks \
$TESTPOOL/$TESTFS1 file1 $TESTPOOL/$TESTFS2 file2) $TESTPOOL/$TESTFS1 file1 $TESTPOOL/$TESTFS2 file2)
log_must [ "$blocks" = "1 2 3 4" ] log_must [ "$blocks" = "0 1 2 3" ]
log_pass $claim log_pass $claim

View File

@ -58,8 +58,8 @@ log_must sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/file /$TESTPOOL/clone log_must have_same_content /$TESTPOOL/file /$TESTPOOL/clone
typeset blocks=$(unique_blocks $TESTPOOL file $TESTPOOL clone) typeset blocks=$(get_same_blocks $TESTPOOL file $TESTPOOL clone)
log_must [ "$blocks" = "1 2 3 4" ] log_must [ "$blocks" = "0 1 2 3" ]
log_note "Copying within a block with copy_file_range" log_note "Copying within a block with copy_file_range"
@ -69,8 +69,8 @@ log_must sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/file /$TESTPOOL/clone log_must have_same_content /$TESTPOOL/file /$TESTPOOL/clone
typeset blocks=$(unique_blocks $TESTPOOL file $TESTPOOL clone) typeset blocks=$(get_same_blocks $TESTPOOL file $TESTPOOL clone)
log_must [ "$blocks" = "2 3 4" ] log_must [ "$blocks" = "1 2 3" ]
log_note "Copying across a block with copy_file_range" log_note "Copying across a block with copy_file_range"
@ -80,7 +80,7 @@ log_must sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/file /$TESTPOOL/clone log_must have_same_content /$TESTPOOL/file /$TESTPOOL/clone
typeset blocks=$(unique_blocks $TESTPOOL file $TESTPOOL clone) typeset blocks=$(get_same_blocks $TESTPOOL file $TESTPOOL clone)
log_must [ "$blocks" = "2" ] log_must [ "$blocks" = "1" ]
log_pass $claim log_pass $claim

View File

@ -59,7 +59,7 @@ log_must sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/file /$TESTPOOL/clone log_must have_same_content /$TESTPOOL/file /$TESTPOOL/clone
typeset blocks=$(unique_blocks $TESTPOOL file $TESTPOOL clone) typeset blocks=$(get_same_blocks $TESTPOOL file $TESTPOOL clone)
log_must [ "$blocks" = "" ] log_must [ "$blocks" = "" ]
log_pass $claim log_pass $claim

View File

@ -54,7 +54,7 @@ log_must sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2 log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2
typeset blocks=$(unique_blocks $TESTPOOL file1 $TESTPOOL file2) typeset blocks=$(get_same_blocks $TESTPOOL file1 $TESTPOOL file2)
log_must [ "$blocks" = "" ] log_must [ "$blocks" = "" ]
log_must clonefile -f /$TESTPOOL/file1 /$TESTPOOL/file2 131072 131072 262144 log_must clonefile -f /$TESTPOOL/file1 /$TESTPOOL/file2 131072 131072 262144
@ -62,7 +62,7 @@ log_must sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2 log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2
typeset blocks=$(unique_blocks $TESTPOOL file1 $TESTPOOL file2) typeset blocks=$(get_same_blocks $TESTPOOL file1 $TESTPOOL file2)
log_must [ "$blocks" = "2 3" ] log_must [ "$blocks" = "1 2" ]
log_pass $claim log_pass $claim

View File

@ -54,7 +54,7 @@ log_must sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2 log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2
typeset blocks=$(unique_blocks $TESTPOOL file1 $TESTPOOL file2) typeset blocks=$(get_same_blocks $TESTPOOL file1 $TESTPOOL file2)
log_must [ "$blocks" = "" ] log_must [ "$blocks" = "" ]
log_pass $claim log_pass $claim

View File

@ -50,7 +50,7 @@ log_must sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2 log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2
typeset blocks=$(unique_blocks $TESTPOOL file1 $TESTPOOL file2) typeset blocks=$(get_same_blocks $TESTPOOL file1 $TESTPOOL file2)
log_must [ "$blocks" = "1 2 3 4" ] log_must [ "$blocks" = "0 1 2 3" ]
log_pass $claim log_pass $claim

View File

@ -50,7 +50,7 @@ log_must sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2 log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2
typeset blocks=$(unique_blocks $TESTPOOL file1 $TESTPOOL file2) typeset blocks=$(get_same_blocks $TESTPOOL file1 $TESTPOOL file2)
log_must [ "$blocks" = "1 2 3 4" ] log_must [ "$blocks" = "0 1 2 3" ]
log_pass $claim log_pass $claim

View File

@ -50,7 +50,7 @@ log_must sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2 log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2
typeset blocks=$(unique_blocks $TESTPOOL file1 $TESTPOOL file2) typeset blocks=$(get_same_blocks $TESTPOOL file1 $TESTPOOL file2)
log_must [ "$blocks" = "" ] log_must [ "$blocks" = "" ]
log_must clonefile -r /$TESTPOOL/file1 /$TESTPOOL/file2 131072 131072 262144 log_must clonefile -r /$TESTPOOL/file1 /$TESTPOOL/file2 131072 131072 262144
@ -58,7 +58,7 @@ log_must sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2 log_must have_same_content /$TESTPOOL/file1 /$TESTPOOL/file2
typeset blocks=$(unique_blocks $TESTPOOL file1 $TESTPOOL file2) typeset blocks=$(get_same_blocks $TESTPOOL file1 $TESTPOOL file2)
log_must [ "$blocks" = "2 3" ] log_must [ "$blocks" = "1 2" ]
log_pass $claim log_pass $claim