mirror of
https://github.com/SCST-project/scst.git
synced 2026-10-22 06:02:33 +00:00
master
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
60ff16ef4f |
scst/include/backport.h: Allow resurrection with active references
Found by manual code inspection, not by an analyzer or a runtime test.
When scst_suspend_activity() times out with commands still active,
__scst_resume_activity() revives the command and management counters.
The old wrapper calls percpu_ref_reinit(), whose zero-count requirement
is enforced by this kernel assertion:
WARN_ON_ONCE(!percpu_ref_is_zero(ref));
Upstream 3.18-4.19 and the retained EL7/UEK4/UEK5 implementations preserve
the per-CPU allocation and use long counters, but reinit still rejects
this legitimate nonzero resurrection. Restore the initial reference
additively, retain outstanding references, and restore per-CPU operation
with the kernel's bias, counter clearing and release-store ordering.
Keep explicitly forced atomic mode unchanged.
SCST serializes kill and resurrection with scst_suspend_mutex and keeps
both counters alive even when their release callbacks run. Require the
same external serialization for mode changes and exit. Concurrent gets
and puts remain allowed.
Kill confirmation can wake the caller before confirm_switch is cleared.
Drain a pending switch callback with rcu_barrier_sched() before reusing
the counters. The kernel switch waitqueue is private, and older kernels
do not export percpu_ref_switch_to_percpu(). This conditional barrier
can also wait for unrelated RCU callbacks; it is skipped once the switch
has completed. Native resurrection on 4.20+ and EL8+ remains unchanged.
Add scst-LIB-percpu-ref to scst.ko with private, real kernel counters.
Keep the backport helper available to KUnit on modern kernels, using
their counter layout and unified RCU API. Cover immediate resurrection
with active refs, resurrection after draining, forced atomic mode, and
repeated suspend cancellations with commands completing while dead.
Also fix the fake Kbuild cleaner used by the Python tooling tests.
CI reported test_cleanup_without_packaged_tooling failing with
"find: cannot delete .../isert-scst.ko: No such file or directory".
iSCSI cleans kernel/ and kernel/isert-scst/ concurrently, so one fixture
find can remove an artifact after the other has enumerated it. Use
-ignore_readdir_race to tolerate only vanished files, matching Kbuild's
idempotent rm -f behavior. Keep other find errors and the injected
FAIL_CLEAN failure fatal; retain parallel cleanup and artifact checks.
Tests, builds and VM validation were not run, as requested.
|
||
|
|
e4a191c109 |
isert-scst: Stop polling before indexing a failed CQ result
Manual review found that isert_poll_cq forms &cq->wc[err] when ib_poll_cq returns a negative errno. This pointer formation already indexes outside the completion array, even if the following loop does not dereference it. No saved analyzer diagnostic directly reports it. Stop on nonpositive results before forming the end pointer and preserve the result for the caller. Keep the loop exit next to the poll result. Add the scst-ISER-cq KUnit suite to isert-scst.ko. Call the production polling function with a private ib_device poll callback and task-local stubs for the success and error completion handlers. Cover initial -EIO and -EINVAL results, an empty queue, full and short batches, and an error after completions. Check poll termination, completion order and dispatch to the correct handler. Negative-result cases also exercise kernel UBSAN bounds checking when CONFIG_UBSAN_BOUNDS is enabled. Include iSER in the existing KUnit module inventory and build it after iscsi-scst with the RDMA compatibility probes. Propagate the common KUnit flags through ordinary iSER builds as well, so analyzer builds include the suite. Extend tooling checks for module selection, dependency order, cleanup, private headers and in-tree source export. |
||
|
|
6c51eb5b64 |
qla2x00t-32gbit: Release target command and tag resources
Manual review of the allocation path flagged by Coccinelle's null/kmerr.cocci rule found two resource leaks. No separate analyzer diagnostic is recorded for these leaks. Failed SCST target registration frees only sqa_tgt, and normal target release also leaves its command map and tag pool behind. Repeated registration failures or target recreation retain those allocations indefinitely. Move allocation and cleanup into SCST-owned resource helpers. Unwind the command map if tag initialization fails, and destroy both resources if registration fails or the target is released. Preserve the bitmap, percpu_ida and sbitmap backends selected by the existing kernel guards. Target stop phase 1 uses bounded session waits. Before dropping lport callbacks and releasing command storage, wait for the SCST session list to drain. SCST removes each session after its commands and unregistration callback have completed, so late command releases can still return tags. Keep the helpers in scst_qla2xxx.c and link the QLA KUnit suite into qla2x00tgt.ko, following the existing SCST module layout. Expose private helpers only in test builds and use task-scoped registration and allocation stubs. Cover map allocation failure, tag initialization failure, registration failure and normal resource destruction. Build and record the matching qla2xxx_scst.ko dependency for the runner, and clean both module builds together. Extend the build and cleanup fixtures to check this dependency and failure propagation. The dependency has no tests of its own. Requiring every supplied module to have a KUnit manifest made the runner abort before loading any module: Module has no KUnit label manifest; rebuild with kunit-build Accept modules without suites only when they are dependencies of supplied test owners. Keep rejecting missing or malformed test manifests and unrelated modules. Exercise native metadata parsing, label selection, dependency load order and reverse cleanup in isolated runner fixtures. The fixtures need no real target, but loading their owner still initializes the QLogic drivers. Run them in a disposable VM without an HBA; hardware session teardown requires separate integration validation. |
||
|
|
d89f53368b |
kunit: Add full test builds and label-based execution
Provide kunit-build for all test-owning modules and their dependencies, kunit-run for existing artifacts, and kunit-test for a sequential build and run even under make -j. Allow root builds and run every command with the caller's privileges. Require root for module execution. Map KUNIT_TEST and KUNIT_LOG to private Kbuild switches. Default KUNIT_LABEL to ALL and use KUNIT_ARGS for other runner options and module paths. Resolve artifacts from explicit arguments, configuration or the recorded build, preserving spaces. Group and align the Makefile help for component tests, KUnit and ordinary build targets. Read label-to-suite mappings and dependency order from module metadata, without a separate Python owner registry. Reject dependency cycles and missing SCST core artifacts. Load external kernel dependencies with modprobe before preparing KUnit; keep shared system modules loaded. Load only selected SCST owners and their dependencies from the supplied build and trigger suites through native KUnit debugfs. Support built-in and modular KUnit with autorun disabled. Load modular KUnit with known parameters when absent and release it after SCST cleanup or a clean initial load failure. Reuse an existing instance only after validating its effective parameters in sysfs; reject invalid or unreadable values without changing the module. Never unload preloaded KUnit. Check global filters before loading SCST. Capture fresh kernel records and parse suites with the upstream KTAP parser. Preserve logs and skip reasons, associating first-parameter diagnostics with their case without changing plans or results. Stop module operations on incomplete evidence, diagnostics or retained fixtures. Continue after ordinary assertion failures. Finish capturing output after command exit. Distinguish suites not started from missing results, and count each Oops as one event. Print concise errors and colored terminal statuses as suites finish. Group failure details after progress. Normalize each assertion block independently of printk messages while retaining value indentation. Follow with explicit stop reasons and a compact SCST build summary. Reserve module headings, author, license, source checksums, vermagic and other modules for verbose output. Keep full case logs, module metadata and kernel diagnostics in plain-text and JSON reports. Cover build ordering, selection, kernel setup, dependency preparation, runner lifecycle and reporting with mocked operations. Document VM setup, build, execution and extension in the KUnit guide. Add kunit-clean for test-owning component builds. Invalidate the recorded module list and clear tooling caches on ordinary and component clean paths too, including failed cleanup. Preserve reports and user settings. Check all tooling, kunit-build and cleanup in one CI job. Pin the Fedora container by digest and fetch a fixed kernel-devel package from Koji with a SHA-256 check, independently of the regression matrix. Save build evidence without building a kernel or loading modules. |