[mlir] Fix ThinLTO printing failures in dylib-linked test tools (#236742)
Move MLIRAnalysisBase dependencies in the Affine and DLTI test libraries
to mlir_target_link_libraries so they use libMLIR when dylib linking is
enabled. Direct LINK_LIBS dependencies pull static MLIRIR into mlir-opt
alongside libMLIR, duplicating AsmPrinter.cpp and its private options.
ThinLTO inlines printer option registration into the dylib, while the
executable's interposed OpPrintingFlags constructor reads its separate,
uninitialized options object. Printing flags are consequently ignored.
This completes the test-library dependency corrections after #232793 and
#236359.
Assisted-by: Codex
[Bitcode] Declare command line options in TableGen (#238653)
Add BitReaderOptions and BitWriterOptions.
* BitcodeWriter(raw_ostream &) takes the flush threshold as a defaulted
parameter. WriteBitcodeToFile passes -bitcode-flush-threshold from the
module's context.
* Rename -disable-ondemand-mds-loading to -ondemand-mds-loading. The old
spelling remains an alias.
LLM-aided
zio: initialize all props of gang children
zio_write_gang_block() builds the zio_prop_t of the gang children on
the stack and sets its fields one by one, but zp_brtwrite, zp_rewrite
and zp_zpl_smallblk were added to the structure later without this
site being updated. zio_write() copies the whole structure into each
child, so those fields carry whatever was left on the stack.
zp_rewrite is read for a gang child that could not be preallocated:
it goes through zio_dva_allocate(), and once its allocation succeeds
a set zp_rewrite gives its block pointer the rewrite bit and the
logical birth of io_bp_orig, which is zero for such a child. The
gang header then holds a member with a logical birth of 0 and a
rewrite bit that is otherwise only written to datasets with the
physical_rewrite feature active.
zp_brtwrite is only read along with io_bp_override and
zp_zpl_smallblk only by spa_preferred_class(), which returns early
for gang children, so neither is read for a gang child today.
[7 lines not shown]
ztest: do not ask the kernel whether its pool is active
When a pass starts and the pool is missing from zpool.cache, ztest
imports it from a scan of its directory. This happens after a kill that
lands while the cache file is being rewritten, which leaves it empty.
The import used libzpool_config_ops, whose pool_active() opens /dev/zfs
to ask the kernel about the pool and fails when the device does not
exist. get_configs() then drops every pool it found, so on a host
without the zfs module ztest aborts with "no pools found" although the
labels are intact and zdb -e opens the pool.
The pool lives in ztest's own directory and only this process imports
it, and the cache file path never asks the kernel either. Use config
ops that report the pool as inactive and still refresh the config with
spa_tryimport(), so the import takes the same steps as before. With
--use-existing-pool the pool may be one the kernel has imported, so
libzpool_config_ops is kept there.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tigerblue77 <37409593+tigerblue77 at users.noreply.github.com>
Closes #19684
Keep other writers off S3 bucket datasets
## Problem
Middleware only refused a writer whose own path was at or inside a BUCKET bucket's dataset, and only when the writer was saved. A writable share or task on a parent dataset and several path-based writers were never checked, and renaming a dataset that held a bucket left the bucket row on the old name.
## Solution
These are best-effort guard rails against misconfiguration.
- **Writers above a bucket.** Writable shares and tasks whose writes cross into child mounts, home directories and the anonymous FTP root are refused on or above a bucket's dataset, on save and on enable. Creating or recovering a bucket where such a writer already reaches it is refused too, and rsync and cloud sync pulls re-check before each run.
- **Path-based writers.** iSCSI and NVMe-oF file extents, VM disks and container devices, `filesystem` writes, VM disk conversion, update uploads, the cloud backup cache and restore, and recursive permission changes inside a bucket outside `s3data` get the same check. Webshare has no read-only mode, so it stays refused anywhere on a bucket.
- **Rename.** `pool.dataset.rename` refuses a dataset that holds a bucket, since the running service pins the bucket's mount and the row would keep the old name.
- **`Middleware._call`** no longer drops keyword arguments for coroutine methods.
nvt_nvpair_match: when duplicates allowed, only match the exact pair
Previously, this would match any pair with the same name, which when
duplicates are allowed could allow nvt_remove_nvpair() to remove the
wrong pair, leaving the wanted one on a hashtable bucket list.
In the case of nvlist_remove_nvpair(), it would then free the pair,
leaving a dangling pointer on the hashtable.
Fix this by always matching the specific pair (by pointer) when
duplicates are allowed.
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19700
unit/nvpair: ensure nvlist_exists is correct after removal by pair
nvt_remove_nvpair() has a bug in that it doesn't remove the incoming
pair directly, but rather, removes the first pair in the hashtable that
matches the incoming pair. If the nvlist is configured to allow
duplicate keys, then the "wrong" pair may be removed and the hashtable
is left with a dangling pair pointer.
If an attempt is made to remove another instance of that name, looking
into that dangling pair may be an attempt to access invalid memory. ASan
and valgrind both rightly complain about this.
These tests attempt to exercise this by adding two pairs, removing one
at a time, checking existence in between. While the invalid memory
access is in the remove path, it was discovered when switching
nvlist_exists() to use the hashtable instead of a pair walk internally.
That change is not here, but still, the test will remain useful to
confirm that the pair list and the hashtable remain consistent via a
couple of different paths.
[5 lines not shown]
unit/nvpair: test next/prev on empty list
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19700
unit/nvpair: add iteration order tests
Pair iteration is guaranteed to return pairs in sorted order. Test this
for all three uniqueness modes, by inserting and replacing keys, then
checking they're returned in the expected order.
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19700
unit/nvpair: move lookup_nvpair ENOTSUP tests into unsupported
Partially reverts c18d722c97. The lookup_nvpair test was correct, it
just should not have been passed parameters. The unsupported variants
for non-unique and unique+name should be in the "unsupported" catchall
tests.
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19700
[Clang] Disable Dylib when building for MSVC (#238038)
When building on Windows with MSVC/clang-cl, it is not possible to get
default visibility behavior as on other platforms. As a result, the
Clang dylib does not build properly and is not usable.
The effort to build LLVM as a dylib is tracked in #109483.
The effort to build Clang as a dylib on Windows is tracked in #238871.