libnvme, python: pass global context to registry public APIs and fix python test issue#3460
Conversation
|
btw, about the |
Make struct libnvme_global_ctx the first argument of every public libnvmf_registry_* function. Most do not use it yet, but threading it in now lets a future version log via libnvme_msg() or reach per-context state without breaking the ABI again. Each public function rejects a NULL context with -EINVAL; the internal *_instance helpers only forward it and do not re-validate. Also forward-declare the struct in registry.h so the public header is self-contained. While here, fix disconnect_all_match() in fabrics.c to take the caller's context instead of creating one per controller. It also returned -ENOMEM from a function declared bool, which coerces to true and would have disconnected controllers on an allocation failure. Signed-off-by: Martin Belanger <martin.belanger@dell.com>
The python-registry parallel-writes test only passed under the "fork"
multiprocessing start method. Python 3.14 makes "forkserver" the default
on Linux, where the test failed two ways:
- Each child re-imports the test module, which unconditionally created
a fresh NVME_REGISTRY_DIR. The children then wrote to a directory the
parent never reads, so the final value came back as the parent's
initial write.
- The libnvme context was passed as a Process argument. A SwigPyObject
cannot be pickled for spawn/forkserver, and a context is not meant to
be shared across processes anyway.
Reuse an inherited /tmp registry directory instead of always creating a
new one, and have each writer process create its own GlobalCtx. Verified
under fork, forkserver and spawn.
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
b009fee to
fb26991
Compare
|
@igaw - I've pulled the CI workflow out of this PR so it doesn't hold up the rest. I'll bring it back as its own PR once we've settled the |
|
Thanks a lot! |
@igaw - Per our discussion. I decided to bundle two commits into this PR.
the python bindings (it relied on fork semantics, which broke under the
spawn/forkserver default in Python 3.14).
I will wait on your decision for the
fedora:latestCI workflow to catch python regressions early.