Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Notable upstream pull request merges:
 #16938 2aa3fbe zinject: count matches and injections for each handler
 #16947 -multiple zinject: add "probe" device injection type
 #16976 3420571 FreeBSD: Add setting of the VFCF_FILEREV flag

Obtained from:	OpenZFS
OpenZFS commit:	3420571
  • Loading branch information
mmatuska committed Jan 27, 2025
2 parents 0eacc5c + 3420571 commit c6767dc
Show file tree
Hide file tree
Showing 53 changed files with 1,061 additions and 302 deletions.
2 changes: 1 addition & 1 deletion sys/contrib/openzfs/RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Two release branches are maintained for OpenZFS, they are:
Minor changes to support these distribution kernels will be applied as
needed. New kernel versions released after the OpenZFS LTS release are
not supported. LTS releases will receive patches for at least 2 years.
The current LTS release is OpenZFS 2.1.
The current LTS release is OpenZFS 2.2.

* OpenZFS current - Tracks the newest MAJOR.MINOR release. This branch
includes support for the latest OpenZFS features and recently releases
Expand Down
125 changes: 77 additions & 48 deletions sys/contrib/openzfs/cmd/zinject/zinject.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015 by Delphix. All rights reserved.
* Copyright (c) 2017, Intel Corporation.
* Copyright (c) 2023-2024, Klara Inc.
* Copyright (c) 2023-2025, Klara, Inc.
*/

/*
Expand Down Expand Up @@ -242,6 +242,36 @@ err_to_str(int err)
return ("[unknown]");
}

static const char *const iotypestrtable[ZINJECT_IOTYPES] = {
[ZINJECT_IOTYPE_NULL] = "null",
[ZINJECT_IOTYPE_READ] = "read",
[ZINJECT_IOTYPE_WRITE] = "write",
[ZINJECT_IOTYPE_FREE] = "free",
[ZINJECT_IOTYPE_CLAIM] = "claim",
[ZINJECT_IOTYPE_FLUSH] = "flush",
[ZINJECT_IOTYPE_TRIM] = "trim",
[ZINJECT_IOTYPE_ALL] = "all",
[ZINJECT_IOTYPE_PROBE] = "probe",
};

static zinject_iotype_t
str_to_iotype(const char *arg)
{
for (uint_t iotype = 0; iotype < ZINJECT_IOTYPES; iotype++)
if (iotypestrtable[iotype] != NULL &&
strcasecmp(iotypestrtable[iotype], arg) == 0)
return (iotype);
return (ZINJECT_IOTYPES);
}

static const char *
iotype_to_str(zinject_iotype_t iotype)
{
if (iotype >= ZINJECT_IOTYPES || iotypestrtable[iotype] == NULL)
return ("[unknown]");
return (iotypestrtable[iotype]);
}

/*
* Print usage message.
*/
Expand Down Expand Up @@ -404,38 +434,37 @@ print_data_handler(int id, const char *pool, zinject_record_t *record,

if (*count == 0) {
(void) printf("%3s %-15s %-6s %-6s %-8s %3s %-4s "
"%-15s\n", "ID", "POOL", "OBJSET", "OBJECT", "TYPE",
"LVL", "DVAs", "RANGE");
"%-15s %-6s %-15s\n", "ID", "POOL", "OBJSET", "OBJECT",
"TYPE", "LVL", "DVAs", "RANGE", "MATCH", "INJECT");
(void) printf("--- --------------- ------ "
"------ -------- --- ---- ---------------\n");
"------ -------- --- ---- --------------- "
"------ ------\n");
}

*count += 1;

(void) printf("%3d %-15s %-6llu %-6llu %-8s %-3d 0x%02x ",
id, pool, (u_longlong_t)record->zi_objset,
(u_longlong_t)record->zi_object, type_to_name(record->zi_type),
record->zi_level, record->zi_dvas);


if (record->zi_start == 0 &&
record->zi_end == -1ULL)
(void) printf("all\n");
char rangebuf[32];
if (record->zi_start == 0 && record->zi_end == -1ULL)
snprintf(rangebuf, sizeof (rangebuf), "all");
else
(void) printf("[%llu, %llu]\n", (u_longlong_t)record->zi_start,
snprintf(rangebuf, sizeof (rangebuf), "[%llu, %llu]",
(u_longlong_t)record->zi_start,
(u_longlong_t)record->zi_end);


(void) printf("%3d %-15s %-6llu %-6llu %-8s %-3d 0x%02x %-15s "
"%6lu %6lu\n", id, pool, (u_longlong_t)record->zi_objset,
(u_longlong_t)record->zi_object, type_to_name(record->zi_type),
record->zi_level, record->zi_dvas, rangebuf,
record->zi_match_count, record->zi_inject_count);

return (0);
}

static int
print_device_handler(int id, const char *pool, zinject_record_t *record,
void *data)
{
static const char *iotypestr[] = {
"null", "read", "write", "free", "claim", "flush", "trim", "all",
};

int *count = data;

if (record->zi_guid == 0 || record->zi_func[0] != '\0')
Expand All @@ -445,21 +474,25 @@ print_device_handler(int id, const char *pool, zinject_record_t *record,
return (0);

if (*count == 0) {
(void) printf("%3s %-15s %-16s %-5s %-10s %-9s\n",
"ID", "POOL", "GUID", "TYPE", "ERROR", "FREQ");
(void) printf("%3s %-15s %-16s %-5s %-10s %-9s "
"%-6s %-6s\n",
"ID", "POOL", "GUID", "TYPE", "ERROR", "FREQ",
"MATCH", "INJECT");
(void) printf(
"--- --------------- ---------------- "
"----- ---------- ---------\n");
"----- ---------- --------- "
"------ ------\n");
}

*count += 1;

double freq = record->zi_freq == 0 ? 100.0f :
(((double)record->zi_freq) / ZI_PERCENTAGE_MAX) * 100.0f;

(void) printf("%3d %-15s %llx %-5s %-10s %8.4f%%\n", id, pool,
(u_longlong_t)record->zi_guid, iotypestr[record->zi_iotype],
err_to_str(record->zi_error), freq);
(void) printf("%3d %-15s %llx %-5s %-10s %8.4f%% "
"%6lu %6lu\n", id, pool, (u_longlong_t)record->zi_guid,
iotype_to_str(record->zi_iotype), err_to_str(record->zi_error),
freq, record->zi_match_count, record->zi_inject_count);

return (0);
}
Expand All @@ -477,18 +510,25 @@ print_delay_handler(int id, const char *pool, zinject_record_t *record,
return (0);

if (*count == 0) {
(void) printf("%3s %-15s %-15s %-15s %s\n",
"ID", "POOL", "DELAY (ms)", "LANES", "GUID");
(void) printf("--- --------------- --------------- "
"--------------- ----------------\n");
(void) printf("%3s %-15s %-16s %-10s %-5s %-9s "
"%-6s %-6s\n",
"ID", "POOL", "GUID", "DELAY (ms)", "LANES", "FREQ",
"MATCH", "INJECT");
(void) printf("--- --------------- ---------------- "
"---------- ----- --------- "
"------ ------\n");
}

*count += 1;

(void) printf("%3d %-15s %-15llu %-15llu %llx\n", id, pool,
double freq = record->zi_freq == 0 ? 100.0f :
(((double)record->zi_freq) / ZI_PERCENTAGE_MAX) * 100.0f;

(void) printf("%3d %-15s %llx %10llu %5llu %8.4f%% "
"%6lu %6lu\n", id, pool, (u_longlong_t)record->zi_guid,
(u_longlong_t)NSEC2MSEC(record->zi_timer),
(u_longlong_t)record->zi_nlanes,
(u_longlong_t)record->zi_guid);
freq, record->zi_match_count, record->zi_inject_count);

return (0);
}
Expand Down Expand Up @@ -852,7 +892,7 @@ main(int argc, char **argv)
int quiet = 0;
int error = 0;
int domount = 0;
int io_type = ZIO_TYPES;
int io_type = ZINJECT_IOTYPE_ALL;
int action = VDEV_STATE_UNKNOWN;
err_type_t type = TYPE_INVAL;
err_type_t label = TYPE_INVAL;
Expand Down Expand Up @@ -1046,19 +1086,8 @@ main(int argc, char **argv)
}
break;
case 'T':
if (strcasecmp(optarg, "read") == 0) {
io_type = ZIO_TYPE_READ;
} else if (strcasecmp(optarg, "write") == 0) {
io_type = ZIO_TYPE_WRITE;
} else if (strcasecmp(optarg, "free") == 0) {
io_type = ZIO_TYPE_FREE;
} else if (strcasecmp(optarg, "claim") == 0) {
io_type = ZIO_TYPE_CLAIM;
} else if (strcasecmp(optarg, "flush") == 0) {
io_type = ZIO_TYPE_FLUSH;
} else if (strcasecmp(optarg, "all") == 0) {
io_type = ZIO_TYPES;
} else {
io_type = str_to_iotype(optarg);
if (io_type == ZINJECT_IOTYPES) {
(void) fprintf(stderr, "invalid I/O type "
"'%s': must be 'read', 'write', 'free', "
"'claim', 'flush' or 'all'\n", optarg);
Expand Down Expand Up @@ -1180,7 +1209,7 @@ main(int argc, char **argv)
}

if (error == EILSEQ &&
(record.zi_freq == 0 || io_type != ZIO_TYPE_READ)) {
(record.zi_freq == 0 || io_type != ZINJECT_IOTYPE_READ)) {
(void) fprintf(stderr, "device corrupt errors require "
"io type read and a frequency value\n");
libzfs_fini(g_zfs);
Expand All @@ -1195,9 +1224,9 @@ main(int argc, char **argv)

if (record.zi_nlanes) {
switch (io_type) {
case ZIO_TYPE_READ:
case ZIO_TYPE_WRITE:
case ZIO_TYPES:
case ZINJECT_IOTYPE_READ:
case ZINJECT_IOTYPE_WRITE:
case ZINJECT_IOTYPE_ALL:
break;
default:
(void) fprintf(stderr, "I/O type for a delay "
Expand Down
8 changes: 4 additions & 4 deletions sys/contrib/openzfs/include/sys/sa.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ typedef uint16_t sa_attr_type_t;
* Attribute to register support for.
*/
typedef struct sa_attr_reg {
const char *sa_name; /* attribute name */
uint16_t sa_length;
const char *sa_name; /* attribute name */
uint16_t sa_length;
sa_bswap_type_t sa_byteswap; /* bswap function enum */
sa_attr_type_t sa_attr; /* filled in during registration */
sa_attr_type_t sa_attr; /* filled in during registration */
} sa_attr_reg_t;


Expand All @@ -77,7 +77,7 @@ typedef struct sa_bulk_attr {
uint16_t sa_length;
sa_attr_type_t sa_attr;
/* the following are private to the sa framework */
void *sa_addr;
void *sa_addr;
uint16_t sa_buftype;
uint16_t sa_size;
} sa_bulk_attr_t;
Expand Down
23 changes: 22 additions & 1 deletion sys/contrib/openzfs/include/sys/zfs_ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Copyright (c) 2012, 2024 by Delphix. All rights reserved.
* Copyright 2016 RackTop Systems.
* Copyright (c) 2017, Intel Corporation.
* Copyright (c) 2024, Klara, Inc.
* Copyright (c) 2024-2025, Klara, Inc.
*/

#ifndef _SYS_ZFS_IOCTL_H
Expand Down Expand Up @@ -421,6 +421,8 @@ typedef struct zinject_record {
uint64_t zi_nlanes;
uint32_t zi_cmd;
uint32_t zi_dvas;
uint64_t zi_match_count; /* count of times matched */
uint64_t zi_inject_count; /* count of times injected */
} zinject_record_t;

#define ZINJECT_NULL 0x1
Expand Down Expand Up @@ -454,6 +456,25 @@ typedef enum zinject_type {
ZINJECT_DELAY_EXPORT,
} zinject_type_t;

typedef enum zinject_iotype {
/*
* Compatibility: zi_iotype used to be set to ZIO_TYPE_, so make sure
* the corresponding ZINJECT_IOTYPE_ matches. Note that existing here
* does not mean that injections are possible for all these types.
*/
ZINJECT_IOTYPE_NULL = ZIO_TYPE_NULL,
ZINJECT_IOTYPE_READ = ZIO_TYPE_READ,
ZINJECT_IOTYPE_WRITE = ZIO_TYPE_WRITE,
ZINJECT_IOTYPE_FREE = ZIO_TYPE_FREE,
ZINJECT_IOTYPE_CLAIM = ZIO_TYPE_CLAIM,
ZINJECT_IOTYPE_FLUSH = ZIO_TYPE_FLUSH,
ZINJECT_IOTYPE_TRIM = ZIO_TYPE_TRIM,
ZINJECT_IOTYPE_ALL = ZIO_TYPES,
/* Room for future expansion for ZIO_TYPE_* */
ZINJECT_IOTYPE_PROBE = 16,
ZINJECT_IOTYPES,
} zinject_iotype_t;

typedef struct zfs_share {
uint64_t z_exportdata;
uint64_t z_sharedata;
Expand Down
8 changes: 4 additions & 4 deletions sys/contrib/openzfs/man/man4/zfs.4
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ but this may negatively impact pool space efficiency.
.
.It Sy zfs_vdev_direct_write_verify Ns = Ns Sy Linux 1 | FreeBSD 0 Pq uint
If non-zero, then a Direct I/O write's checksum will be verified every
time the write is issued and before it is commited to the block pointer.
time the write is issued and before it is committed to the block pointer.
In the event the checksum is not valid then the I/O operation will return EIO.
This module parameter can be used to detect if the
contents of the users buffer have changed in the process of doing a Direct I/O
Expand All @@ -438,7 +438,7 @@ writes.
Each verify error causes a
.Sy dio_verify_wr
zevent.
Direct Write I/O checkum verify errors can be seen with
Direct Write I/O checksum verify errors can be seen with
.Nm zpool Cm status Fl d .
The default value for this is 1 on Linux, but is 0 for
.Fx
Expand Down Expand Up @@ -1612,7 +1612,7 @@ _
.
.It Sy zfs_btree_verify_intensity Ns = Ns Sy 0 Pq uint
Enables btree verification.
The following settings are culminative:
The following settings are cumulative:
.TS
box;
lbz r l l .
Expand Down Expand Up @@ -2525,7 +2525,7 @@ generate a system-dependent value close to 6 threads per taskq.
Set value only applies to pools imported/created after that.
.
.It Sy zio_taskq_write_tpq Ns = Ns Sy 16 Pq uint
Determines the minumum number of threads per write issue taskq.
Determines the minimum number of threads per write issue taskq.
Higher values improve CPU utilization on high throughput,
while lower reduce taskq locks contention on high IOPS.
Set value only applies to pools imported/created after that.
Expand Down
2 changes: 1 addition & 1 deletion sys/contrib/openzfs/man/man7/vdevprops.7
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ A text comment up to 8192 characters long
.It Sy bootsize
The amount of space to reserve for the EFI system partition
.It Sy failfast
If this device should propage BIO errors back to ZFS, used to disable
If this device should propagate BIO errors back to ZFS, used to disable
failfast.
.It Sy path
The path to the device for this vdev
Expand Down
4 changes: 2 additions & 2 deletions sys/contrib/openzfs/man/man7/zpool-features.7
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,11 @@ zpool_checkpoint
.No example# Nm cat Pa /usr/share/zfs/compatibility.d/grub2-2.06
# Features which are supported by GRUB2 versions prior to v2.12.
#
# GRUB is not able to detect ZFS pool if snaphsot of top level boot pool
# GRUB is not able to detect ZFS pool if snapshot of top level boot pool
# is created. This issue is observed with GRUB versions before v2.12 if
# extensible_dataset feature is enabled on ZFS boot pool.
#
# This file lists all read-only comaptible features except
# This file lists all read-only compatible features except
# extensible_dataset and any other feature that depends on it.
#
allocation_classes
Expand Down
2 changes: 1 addition & 1 deletion sys/contrib/openzfs/man/man8/zfs-destroy.8
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ Destroy
all snapshots with this name in descendent file systems.
.It Fl v
Print verbose information about the deleted data.
.El
.Pp
Extreme care should be taken when applying either the
.Fl r
or the
.Fl R
options, as they can destroy large portions of a pool and cause unexpected
behavior for mounted file systems in use.
.El
.It Xo
.Nm zfs
.Cm destroy
Expand Down
2 changes: 1 addition & 1 deletion sys/contrib/openzfs/man/man8/zfs.8
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ This option is provided for backwards compatibility with older ZFS versions.
.It Sy ZFS_SET_PIPE_MAX
Tells
.Nm zfs
to set the maximum pipe size for sends/recieves.
to set the maximum pipe size for sends/receives.
Disabled by default on Linux
due to an unfixed deadlock in Linux's pipe size handling code.
.
Expand Down
Loading

0 comments on commit c6767dc

Please sign in to comment.