Skip to content

libmultipath: improve cleanup on exit

[email protected] dm-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest28 of 29 patches 9 repliesIn review
  2. v229 patches 21 repliesSuperseded
  3. v123 patches 13 repliesSuperseded

28 of 29 patches are in this archive. The cover letter announces 29.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/29multipathd: uxlsnr: avoid deadlock on exitmultipathd/uxlsnr.c+14 -100 replies
2/29multipathd: Fix liburcu memory leakmultipathd/main.c+44 -11 reply
3/29multipathd: move handling of io_err_stat_attr into libmultipathlibmultipath/io_err_stat.c libmultipath/libmultipath.version multipathd/main.c+13 -190 replies
4/29multipathd: move vecs desctruction into cleanup functionmultipathd/main.c+40 -240 replies
5/29multipathd: make some globals staticmultipathd/main.c+7 -70 replies
6/29multipathd: move threads destruction into separate functionmultipathd/main.c+51 -250 replies
7/29multipathd: move conf destruction into separate functionmultipathd/main.c+11 -90 replies
8/29multipathd: move pid destruction into separate functionmultipathd/main.c+7 -30 replies
9/29multipathd: close pidfile on exitmultipathd/main.c+3 -10 replies
11/29multipathd: child(): call cleanups in failure case, toomultipathd/main.c+4 -60 replies
12/29multipathd: unwatch_all_dmevents: check if waiter is initializedmultipathd/dmevents.c+2 -00 replies
13/29multipathd: print error message if config can't be loadedmultipathd/main.c+3 -10 replies
14/29libmultipath: add libmp_dm_exit()libmultipath/config.c libmultipath/config.h libmultipath/devmapper.c +1 more+19 -00 replies
15/29multipathd: fixup libdm deinitializationmultipathd/main.c+3 -20 replies
16/29libmultipath: log_thread_stop(): check if logarea is initializedlibmultipath/log_pthread.c+3 -00 replies
17/29multipathd: add cleanup_child() exit handlermultipathd/main.c+25 -200 replies
18/29libmultipath: fix log_thread startup and teardownlibmultipath/log_pthread.c+45 -171 reply
19/29multipathd: move cleanup_{prio, checkers, foreign} to libmultipath_exitlibmpathpersist/mpath_persist.c libmultipath/config.c libmultipath/libmultipath.version +1 more+5 -90 replies
20/29multipath: use atexit() for cleanup handlersmultipath/main.c+16 -211 reply
21/29mpathpersist: use atexit() for cleanup handlersmpathpersist/main.c+2 -30 replies
22/29multipath: fix leaks in check_path_valid()multipath/main.c+19 -102 replies
23/29multipath-tools: mpath-tools.supp: file with valgrind suppressionsthird-party/valgrind/mpath-tools.supp+32 -00 replies
24/29libmultipath: use libmp_verbosity to track verbositylibmpathpersist/mpath_persist.c libmultipath/config.c libmultipath/configure.c +8 more+53 -641 reply
25/29libmultipath: introduce symbolic values for logsinklibmultipath/debug.c libmultipath/debug.h libmultipath/devmapper.c +4 more+23 -171 reply
26/29libmultipath: simplify dlog()libmultipath/debug.c libmultipath/debug.h libmultipath/devmapper.c +2 more+36 -250 replies
27/29multipathd: common code for "-k" and command argsmultipathd/main.c+19 -180 replies
28/29multipathd: sanitize uxsock_listen()multipathd/uxlsnr.c+43 -270 replies
29/29libmultipath: fix race between log_safe and log_thread_stop()libmultipath/log_pthread.c+26 -221 reply

Reviews trailers per patch

27 of 28 patches have a Reviewed-by or Acked-by.

PatchBenjamin Marzinski
1/29R-b
2/29R-b
3/29R-b
4/29R-b
5/29R-b
6/29R-b
7/29R-b
8/29R-b
9/29R-b
11/29R-b
12/29R-b
13/29R-b
14/29R-b
15/29R-b
16/29R-b
17/29R-b
18/29R-b
19/29R-b
20/29R-b
21/29R-b
22/29
23/29R-b
24/29R-b
25/29R-b
26/29R-b
27/29R-b
28/29R-b
29/29R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [dm-devel] [PATCH v3 00/29] libmultipath: improve cleanup on exit

From: Martin Wilck <[email protected]>

Hi Christophe, hi Ben, hi lixiaokeng,

this series was inspired by lixiaokeng's recent posting "[QUESTION] memory leak in main (multipath)". It implements my first idea, registering cleanup handlers with atexit(). However it turned out to be quite complex. In particular multipathd has a lot of things to clean up.

This series is based on the previous series "multipath-tools: shutdown, libdevmapper races, globals" (v3).

While the bulk of the series is the cleanup handling, it also contains some bug fixes for issues that I found while working on this.

Changes v2 -> v3:

Removed on_exit() calls, which break build on Alpine Linux (musl libc).

02/29 "multipathd: Fix liburcu memory leak":
use atexit() rather than on_exit()
18/29 "libmultipath: fix log_thread startup and teardown"
fixed rebase error pointed out by Ben
19/29 "multipath: use atexit() for cleanup handlers"
use atexit() rather than on_exit()
21/29 "multipath: fix leaks in check_path_valid()"
revert the on_exit() part of the previous version of this patch. As argued in a separate mail, avoiding this corner-case "memory leak" on an irregular exit isn't worth the ugliness of being non-reentrant and using file-scope static variables for things that would naturally be automatic variables.
24/29 "libmultipath: use libmp_verbosity to track verbosity":

         Removed additional uses of conf->verbosity (Ben)

25/29 "libmultipath: introduce symbolic values for logsink":
removed blank line at end of libmultipath/debug.h (Ben)
28/29 "multipathd: sanitize uxsock_listen()"
unchanged, but modified commit message such that it doesn't suggest memory was allocated in pages (Ben)
29/29 "libmultipath: fix race between log_safe and log_thread_stop()":
Ben had accepted the previous version after some discussion. I moved the call to flush_logqueue() in log_thread_stop() after the pthread_join() call.

Changes v1 -> v2:

Patches 24..29 have been added; they are logging cleanups, 24/29 and 29/29 are fixes to issues Ben had mentioned during his review.

01/29 "multipathd: uxlsnr: avoid deadlock on exit"
Fix invalid array element reference (Ben)
07/29 "multipathd: move conf destruction into separate function"
Don't reset logink when the log thread is stopped (Ben) Logging via logsink after shutting down the log thread is racy (no worse than before); the race will be fixed in 29/29.
14/29 "libmultipath: add libmp_dm_exit()": Fixed the skip_libmp_dm_init()

      case (Ben).

18/29 "libmultipath: fix log_thread startup and teardown"
No need to wait before joining the log thread in log_thread_stop() (Ben) -> "libmultipath: fix race between log_safe and log_thread_stop()"
23/29: "multipath-tools: mpath-tools.supp: file with valgrind suppressions"
Remove empty line at end of file (Ben)
24/29 "libmultipath: use libmp_verbosity to track verbosity"
This fixes 13/21 "libmultipath: provide defaults for {get,put}_multipath_config" (from the previous patch series "multipath-tools: shutdown, libdevmapper races, globals"; control of verbosity during config file loading)
29/29 "libmultipath: fix race between log_safe and log_thread_stop()"

      (see 18/29)

Regards
Martin

Martin Wilck (29):
multipathd: uxlsnr: avoid deadlock on exit
multipathd: Fix liburcu memory leak
multipathd: move handling of io_err_stat_attr into libmultipath
multipathd: move vecs desctruction into cleanup function
multipathd: make some globals static
multipathd: move threads destruction into separate function
multipathd: move conf destruction into separate function
multipathd: move pid destruction into separate function
multipathd: close pidfile on exit
multipathd: add helper for systemd notification at exit
multipathd: child(): call cleanups in failure case, too
multipathd: unwatch_all_dmevents: check if waiter is initialized
multipathd: print error message if config can't be loaded
libmultipath: add libmp_dm_exit()
multipathd: fixup libdm deinitialization
libmultipath: log_thread_stop(): check if logarea is initialized
multipathd: add cleanup_child() exit handler
libmultipath: fix log_thread startup and teardown
multipathd: move cleanup_{prio,checkers,foreign} to libmultipath_exit
multipath: use atexit() for cleanup handlers
mpathpersist: use atexit() for cleanup handlers
multipath: fix leaks in check_path_valid()
multipath-tools: mpath-tools.supp: file with valgrind suppressions
libmultipath: use libmp_verbosity to track verbosity
libmultipath: introduce symbolic values for logsink
libmultipath: simplify dlog()
multipathd: common code for "-k" and command args
multipathd: sanitize uxsock_listen()
libmultipath: fix race between log_safe and log_thread_stop()

 libmpathpersist/mpath_persist.c       |   7 +-
 libmultipath/config.c                 |  14 +-
 libmultipath/config.h                 |   2 +
 libmultipath/configure.c              |  16 +-
 libmultipath/debug.c                  |  38 +--
 libmultipath/debug.h                  |  27 +-
 libmultipath/devmapper.c              |  30 +-
 libmultipath/devmapper.h              |   1 +
 libmultipath/io_err_stat.c            |   7 +-
 libmultipath/libmultipath.version     |  31 +-
 libmultipath/log_pthread.c            | 111 +++++---
 mpathpersist/main.c                   |   5 +-
 multipath/main.c                      |  91 +++---
 multipathd/dmevents.c                 |   2 +
 multipathd/main.c                     | 394 ++++++++++++++++----------
 multipathd/uxlsnr.c                   |  80 ++++--
 tests/alias.c                         |   1 +
 tests/blacklist.c                     |   2 +
 tests/globals.c                       |   3 +-
 tests/hwtable.c                       |   2 +-
 tests/test-log.c                      |   4 +-
 tests/test-log.h                      |   3 +-
 third-party/valgrind/mpath-tools.supp |  32 +++
 23 files changed, 557 insertions(+), 346 deletions(-)
 create mode 100644 third-party/valgrind/mpath-tools.supp
Signature · 7 lines
2.29.0


--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel