zpool_detach_spare_throttle: check that the pool reaches its dirty limit
Fail the test if dmu_tx_dirty_over_max hasn't increased by the time the
detach starts, so that a pass means the detach really ran while the pool
was at its dirty data limit.
Reviewed by: George Wilson <gwilson at zfsmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matthew Ahrens <matt at mahrens.org>
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Closes #19871
Don't wait for a tx under the config lock to log history
`zpool detach` of the original device of an in-use hot spare, and
`zpool split`, write history records while they hold the config lock
as writer. Both get a new tx for the record, and when the pool is at
its dirty data limit (or suspended), dmu_tx_assign() waits for a txg
sync, which can't start without the config lock, so the pool hangs.
Log these records with a tx assigned to the txg that the config change
goes into, as device removal does for its sync tasks. log_internal()
now writes the record itself only in syncing context; in open context
it always queues a sync task, including for an assigned tx.
dmu_tx_assign() now also asserts that a caller that might wait doesn't
hold any spa config lock as writer, which catches this kind of bug
without needing a full dirty data limit or a suspended pool.
Attach and detach now log the same way, before they drop the config
lock, instead of copying the device paths to log them afterwards, so
[7 lines not shown]
ZTS: test that removal gives back the gaps it copies
A removal copies the free gaps between nearby segments along with
them, in one allocation on another vdev. Freeing those gaps once the
copy is written keeps them from being allocated for TXG_DEFER_SIZE
txgs, so a fast removal can run that vdev out of space (#19442). On
master, a copy that cannot be allocated even at the smallest size trips
an ASSERT in spa_vdev_copy_impl() on a debug build, and can loop there,
holding its txg open, on a release one. So the test does not go that
far: it checks that the gaps never reach the destination's space maps.
With log space maps disabled, a metaslab's space map keeps the
allocations and frees of each txg, and zdb -mmmm prints them. A special
vdev takes all metadata, so the vdev added before the removal receives
nothing but the copies. One allocator and one 16K block per txg lay the
file out block after block on the vdev being removed. Overwriting every
other block then leaves a 16K gap after each block that stays, which
the default vdev_removal_max_span lets a copy span.
[10 lines not shown]
vdev removal: unallocate unused copy gaps immediately
A remap segment may span free gaps of up to vdev_removal_max_span, so
a removal copies those gaps too, in one allocation on the destination.
The gaps were then freed with zio_free(), which keeps them from being
allocated again for TXG_DEFER_SIZE txgs. A fast removal could run the
destination out of space (#19442). The gaps are allocated in the txg
of the copy, and the copy I/O is complete when they are released, so
unallocate them with metaslab_unalloc_dva() instead.
The copy I/O completes in open context, while the syncing txg may be
condensing the destination metaslab with ms_lock dropped, and
metaslab_unalloc_dva() VERIFYs that it is not. A gap is therefore
given back through metaslab_unalloc_range(), which leaves it
allocated and returns B_FALSE while the metaslab condenses; the gap is
then freed as before. metaslab_unalloc_range() also recomputes
ms_max_size, which metaslab_should_allocate() trusts for a loaded
metaslab: a full metaslab has it at 0, and the gaps given back to it
could otherwise not be allocated again before the txg syncs.
[7 lines not shown]
[lldb] Don't crash on ELF tables whose entry size is 0 (#248507)
ObjectFileELF counts the entries of a symbol or relocation table by
dividing the table's size by its sh_entsize, which it does not check.
When a corrupt ELF file's .symtab, .dynsym or .rela.plt has an
sh_entsize of 0, lldb divides by zero as it loads the file, which kills
it with SIGFPE on x86. A debug info relocation table in an object file
does the same when lldb reads the debug info.
Ignore a table whose entry size is 0, and log why. llvm-readelf refuses
to read such a table too. This includes the symbol table that names PLT
entries: with an entry size of 0, the PLT code would read symbol 0 for
every entry.
The new test crashes lldb without this change.
Assisted-by: Claude Code
[Hexagon] Avoid a reload between HMX activation and weight instructions (#248259)
HMX requires an activation/weight pair to be in one packet. The first
merge pass (before RA) moves the instructions together and further
optimization should not insert anything in between.
However, under register pressure a reload may be inserted just before
the second instruction in a pair. If the newly allocated physical
register is one of those used by the first instruction, this reload
cannot be moved outside of the pair. This problem is likely to happen if
one of the first instruction's register is not used later.
To avoid this situation, we can artificially extend the live range of
the registers so the reload of these registers cannot happen inside the
pair. We add the registers read by the first instruction to the second
one as implicit uses.
This fix should reduce the likelihood of this problem. It does not fix
the case when one of the first instruction's own operands is spilled.
[3 lines not shown]
Propagate vdev state change on probe failure
Currently, when probe fails on some vdev, it would became
faulted, but the parent's vdev state won't be changed. So we
can have a situation, for example, when several disks in draid
vdev are faulted (domain failure), but draid vdev itself and
pool are online, which doesn't seem right.
Solution: set isopen argument to false when calling
vdev_set_state() from spa_async_fault_vdev(). It's not quite
clear why it was set to true in the first place when the code
was introduced at commit c4f2f1aa2d.
isopen argument to vdev_set_state() is normally set to true
when we are "in the process of opening children depth-first",
in which case we don't want to propagate the change of state
to the parent, but it doesn't seem to be the case here.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
[4 lines not shown]
Mark repo as non-reproducible due to inter-repo symlinks (#248732)
Symlinks between the llvm-project and llvm-raw repositories make the
llvm-project repo non-reproducible. Bazel 9 identifies this correctly
anyway, ignoring the project specification, but Bazel 8 would
incorrectly try to cache it. Also, marking it correctly saves bazel
trying updating a bunch of symlinks to be relative, only to realize it's
insufficient anyway, and bailing out.
[AMDGPU][NFC] Remove dead buffer intrinsic handling from ASan helpers (#248688)
AMDGPU::getInterestingMemoryOperands is only called by
amdgpu-sw-lower-lds, which only passes in operations on global memory or
LDS.
The buffer intrinsic handling was untested and has no path to testing
it. It's also buggy, in that it reported the type of the resource as the
element type instead of the stored/loaded type. It also didn't work
correctly on `<4 x i32>` resources.
More fundamentally, it probably didn't work correctly since it was using
the base of the resource as the interesting pointer without accounting
for the offset.
AI disclosure: Claude determined this was dead, I wrote the commit
message
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
ZTS: Lower autotrim_config's fill check for anymirror
autotrim_config fills each pool to 95% of its available space and
checks that every file vdev then holds at least a given share of its
1 GiB. On the 4-disk anymirror pools, that share is half. Once the
tile map is set aside, each vdev has room for 11 64 MiB tiles
(704 MiB), and the ~250 MiB the fill leaves free can lie mostly in
the tiles of one vdev. anymirror0 has left the fourth vdev at
512 MiB, exactly the threshold, in 3 of 9 CI runs, and at 509 MiB
in two runs that failed. anymirror2 has left one at 514 MiB.
Check for 42% instead, still above the 40% the vdevs must shrink to
once the file is removed. Also set both thresholds for each pool
type: the anymirror value was carried over to raidz2, which was
checked against 512 MiB instead of 768 MiB.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tigerblue77 <37409593+tigerblue77 at users.noreply.github.com>
Closes #20103
[lldb] Make the tests in TestModuleCacheUniversal.py use clean dir (#248731)
The build dir cannot be reused between tests for the
TestModuleCacheUniversal.py test; this should have set
SHARED_BUILD_TESTCASE to false.
rdar://194239308
[clang][Sema] Fix over-read when scanf format ends with field width (#227716)
Fixes #227616
ParseAmount advances `I` to `E` when digits run to end-of-string but
returns `NotSpecified`, so `ParseScanfSpecifier` skipped its `I == E`
incomplete-specifier check for `%*<width>` at EOS. The parser then read
`*E` out-of-bounds via `ParseLengthModifier`, the NUL test, and the
conversion switch, producing bogus invalid-conversion / contains-NUL
diagnostics and asserting in `StringLiteral::getLocationOfByte` for
concatenated literals.
Check `I == E` unconditionally after the field width, matching printf
and `ParseArgPosition` handling. `%*2` at EOS is now diagnosed as
`incomplete format specifier`.
Reproducer:
```c
[2 lines not shown]
the getopt(3) function was once specified to return EOF instead of -1;
this was changed by IEEE Std 1003.2-1992 ("POSIX.2") to decouple getopt()
from stdio.h.
OK millert@
geography/py-rtcm: Update to 1.2.2
### RELEASE 1.2.2
1. Remove Python 3.10 from build and test workflows (now End of Life).
### RELEASE 1.2.1
[no NEWSworthy items]
ZTS: mmap_ftruncate: time only the ftruncate() call
mmap_ftruncate checks that async writeback of dirty mmap()'d pages
completes as soon as the DMU has the data, so a following ftruncate()
doesn't wait for the txg sync. It timed the whole program, though:
dirtying 2G of pages, which pushes them all through zfs_putpage() as
the kernel throttles the writer. That phase is throughput-bound, and on
the alpine3-24 CI VMs it alone took 140-221 s against the 90 s limit
while ftruncate() itself stayed near-instant.
Time only the ftruncate() call in mmap_ftruncate and print it. Start
async writeback of every page explicitly first (sync_file_range() with
SYNC_FILE_RANGE_WRITE on Linux, msync(MS_ASYNC) elsewhere) rather than
relying on the kernel's dirty thresholds, which depend on RAM, and check
the dataset's nwritten kstat to confirm zfs_putpage() wrote the pages
back. With the pages written back explicitly the file can shrink from
2G to 256M.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Will Rouesnel <wrouesnel at wrouesnel.com>
Closes #20001
clarify that RFC 6052 specifies that bits 64 through 71 of the address must
be set to zero; these bits are reserved to ensure compatibility with the host
identifier format defined in the IPv6 addressing architecture (see RFC 4291)
OK sashan@
Don't decrypt the dnode when reading an indirect for a bp lookup
A raw incremental send from a redaction bookmark fails with EACCES
("dataset key must be loaded") when the snapshot's dnode block has no
decrypted copy in the ARC, e.g. after an import without the key, and
intermittently on a warm pool (#18491).
send_reader_thread() looks up the block pointers of previously
redacted blocks with dbuf_dnode_findbp(). When the block sits under
an indirect block, dbuf_findbp() reads that indirect with a decrypting
dbuf_read(), which first decrypts the dnode block. The raw send holds
the snapshot without a key mapping, so the decryption fails.
Read the indirect with DMU_READ_NO_DECRYPT, as dnode_next_offset_level()
already does. Indirect blocks are not encrypted; a decrypting read of
the block itself still decrypts and authenticates its dnode first.
This makes xdr_bookmark_raw_with_write and
xdr_resume_bookmark_raw_with_write pass.
[5 lines not shown]
ZTS: make the #18491 raw redaction-bookmark send tests deterministic
xdr_bookmark_raw_with_write and xdr_resume_bookmark_raw_with_write
fail about a third of the time (maybe-listed for #18491): the raw
incremental send from a redaction bookmark returns EACCES. Whether it
does depends on whether a decrypted copy of the snapshot's dnode block
happens to be cached in the ARC.
Export and import the pool, without loading the key, before the
incremental send. That leaves no decrypted copy, so both tests fail
every time until the send is fixed, and they now also check that a raw
send from a redaction bookmark does not need the key. Drop them from
the maybe list.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Will Rouesnel <wrouesnel at wrouesnel.com>
Closes #19998
ZTS: auto_spare_002_pos: check the errors, expect it to pass
With prefetch disabled, every read the faulted leaf serves is a demand
read and counts for the ZED. The test passed 8 of 8 runs on a VM,
where master's test failed 5 of 8, and on all 12 Linux images of a CI
run. Remove its maybe entry, so that a failure shows.
Should the read ever again give the leaf too few checksum errors, the
test would only fail 60 seconds later in wait_vdev_state, with nothing
saying why. Each checksum ereport is also counted in the leaf's
checksum_errors, so check that count right after the read: below
checksum_n (10), the ZED cannot degrade the leaf. The count is logged
in every case.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Will Rouesnel <wrouesnel at wrouesnel.com>
Signed-off-by: Tigerblue77 <37409593+tigerblue77 at users.noreply.github.com>
Closes #19989
ZTS: auto_spare_002_pos: disable prefetch on the test file system
The test waits for the ZED to degrade the file it corrupts with
zinject, which takes checksum_n (10) checksum ereports on that leaf
within checksum_t. Only demand reads post them: zio_checksum_verify()
counts and reports nothing for a ZIO_FLAG_SPECULATIVE read. The test
reads its file sequentially, so after the first accesses dmu_zfetch
prefetches the rest, and most corrupted reads of the leaf are
speculative. The leaf gets ereports only from the few demand reads
that happen to be served by it.
Which disks serve those reads depends on where the first blocks of the
file land. In the anymirror cases, where each tile is on only some of
the five disks (three for anymirror2), the test often fails at the
wait for DEGRADED, while the leaf saw over a thousand corrupted reads.
I/O errors are reported for speculative reads too, which is why
auto_spare_001_pos does not have this problem.
Create the file system with prefetch=none, as zed_slow_io.ksh does,
[6 lines not shown]