|
4 | 4 | * SPDX-License-Identifier: GPL-2.0-or-later |
5 | 5 | */ |
6 | 6 |
|
| 7 | +/* |
| 8 | + * On some kernel versions (e.g. 6.14) linux/bpf.h is pulled in transitively |
| 9 | + * via metaslab.h -> spa.h -> zfs_context.h -> vfs.h -> security.h and |
| 10 | + * contains sizeof(struct bpf_wq) where bpf_wq is only forward-declared, |
| 11 | + * causing a compile error (DLPX-96701). Blocking security.h (which this BPF |
| 12 | + * program does not need) stops the chain without touching linux/bpf.h itself. |
| 13 | + */ |
| 14 | +#define __LINUX_SECURITY_H |
| 15 | + |
7 | 16 | #include <sys/metaslab.h> |
8 | 17 | #include <sys/metaslab_impl.h> |
9 | 18 | #include <sys/vdev_impl.h> |
@@ -103,6 +112,19 @@ metaslab_group_alloc_exit(struct pt_regs *ctx) |
103 | 112 | axis = success; |
104 | 113 | } |
105 | 114 |
|
| 115 | + /* |
| 116 | + * On some engine versions a kernel bug (DLPX-88427) causes vd_name to |
| 117 | + * contain raw memory bytes instead of a vdev path or type string. The |
| 118 | + * first byte of any valid name is either '/' (device path) or an ASCII |
| 119 | + * letter (vdev type like "mirror"). If it falls outside printable ASCII |
| 120 | + * (0x20–0x7e) the name is garbage; overwrite it with a safe fallback so |
| 121 | + * we never emit unparseable metric names. |
| 122 | + */ |
| 123 | + if (data->vd_name[0] < 0x20 || data->vd_name[0] > 0x7e) { |
| 124 | + char unknown[] = "unknown"; |
| 125 | + __builtin_memcpy(data->vd_name, unknown, sizeof(unknown)); |
| 126 | + } |
| 127 | + |
106 | 128 | AGGREGATE_DATA(data->vd_name, axis, |
107 | 129 | bpf_ktime_get_ns() - data->ts, data->asize); |
108 | 130 |
|
|
0 commit comments