Motivated by the recent submission of an ALUA checker for multipath-tools by Brian Bunker, I am proposing a generic framework for asynchronous checker threads in multipath-tools.
The first patch is a small fix I came up with while testing this. 2/4 is the actual implementation, 3/4 test code, and 4/4 modifies the TUR checker to the new library code. This makes the logic of the TUR checker easier to understand, and should make it easier for Brian to implement the ALUA checker based on the same framework. Further improvements on top of this are possible. The new TUR code, except for the tur_check() function itself, is pretty generic and would allow abstracting an "async checker" model with just a few changes. This would make it possible to switch also the legacy checkers to an asynchronous mode of operation. Comments and reviews welcome. Martin Martin Wilck (4): multipathd: get_new_state: map PATH_TIMEOUT to PATH_DOWN libmpathutil: add generic implementation for checker thread runners multipath-tools tests: add test program for thread runners libmultipath: TUR checker: use runner threads libmpathutil/Makefile | 2 +- libmpathutil/libmpathutil.version | 6 +- libmpathutil/runner.c | 205 ++++++++++++ libmpathutil/runner.h | 84 +++++ libmultipath/checkers/tur.c | 341 ++++++------------- multipathd/main.c | 4 +- tests/Makefile | 15 +- tests/runner-test.sh | 37 +++ tests/runner-test.supp | 15 + tests/runner.c | 530 ++++++++++++++++++++++++++++++ 10 files changed, 994 insertions(+), 245 deletions(-) create mode 100644 libmpathutil/runner.c create mode 100644 libmpathutil/runner.h create mode 100755 tests/runner-test.sh create mode 100644 tests/runner-test.supp create mode 100644 tests/runner.c -- 2.53.0
