From: Martin Wilck <mwilck@suse.com>
To: Hannes Reinecke <hare@suse.de>,
Christophe Varoqui <christophe.varoqui@opensvc.com>,
Benjamin Marzinski <bmarzins@redhat.com>,
Brian Bunker <brian@purestorage.com>,
dm-devel@lists.linux.dev
Cc: Xose Vazquez Perez <xose.vazquez@gmail.com>
Subject: Re: [PATCH v2 09/19] libmpathutil: runner: use shared_ptr
Date: Wed, 27 May 2026 16:11:45 +0200 [thread overview]
Message-ID: <f8ea80b80cb3e26b42e6d4dc1ec3cfedca2eb2fc.camel@suse.com> (raw)
In-Reply-To: <c03305cd-5408-4b28-bcab-a43a566ce6ef@suse.de>
On Wed, 2026-05-27 at 15:13 +0200, Hannes Reinecke wrote:
> On 5/27/26 12:11, Martin Wilck wrote:
> > On Wed, 2026-05-27 at 11:40 +0200, Hannes Reinecke wrote:
> >
> >
> > > But if the path comes back we need to reinstate the checker,
> > > which
> > > not
> > > only requires additional memory (which might need a recursion
> > > into
> > > the
> > > filesystem to get free pages) but we also might need to read the
> > > checker
> > > module from disk (again). So plenty of opportunity to deaslock
> > > waithing
> > > for the disk be become readable.
> >
> > In checker_get(), we call add_checker_class() if the class is not
> > yet
> > loaded, which will take one ref on the class, and then
> > get_shared_ptr()
> > for every path (including the one for which add_checker_class() had
> > been called), which means we have (number of paths + 1) references
> > on
> > the class, and will only drop the last ref when multipathd calls
> > cleanup_checkers() during exit.
> >
> > Therefore I don't think it's possible that we unload the shared
> > library
> > prematurely, and have to reload it later.
> >
> Hmm.
>
> Really hmmmmm.
>
> If the checkers are loaded during startup, and unloaded on shutdown,
> there really is no point in refcounting them, is there?
> Wouldn't global pointers to each check sufficient here, avoiding
> the need for refcounting altogether?
Currently checker and prioritizer DSOs aren't loaded during startup.
They are loaded when the first path that uses the given checker is
initialized.
I agree that it would be possible to simplify the code by just loading
all checkers and prioritizers in advance, in which case we wouldn't
need refcounting, like you wrote. Actually, we don't need to use shared
objects in the first place; we could simply include all the checker and
prioritizer code in libmultipath itself.
The shared object architecture dates back to multipath-tools 0.4.9
(2008). We (actually, you ;-) ) added refcounting to fix races in
323090f ("Use refcounting for checkers"). So far it hasn't occured to
me to change this architecture, which has been working well for over a
decade.
Anyway, this discussion is orthogonal to my current patch set.
Regards
Martin
next prev parent reply other threads:[~2026-05-27 14:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260522164415.846589-1-mwilck@suse.com>
[not found] ` <20260522164415.846589-10-mwilck@suse.com>
2026-05-27 9:40 ` [PATCH v2 09/19] libmpathutil: runner: use shared_ptr Hannes Reinecke
2026-05-27 10:11 ` Martin Wilck
2026-05-27 13:13 ` Hannes Reinecke
2026-05-27 14:11 ` Martin Wilck [this message]
2026-05-27 17:30 ` Hannes Reinecke
[not found] ` <20260522164415.846589-5-mwilck@suse.com>
2026-05-27 9:28 ` [PATCH v2 04/19] libmpathutil: add implementation of generic shared pointer Hannes Reinecke
2026-05-27 10:43 ` Martin Wilck
2026-05-27 23:16 ` Benjamin Marzinski
2026-05-28 7:50 ` Martin Wilck
2026-06-02 5:53 ` [PATCH v2 00/19] multipath-tools: asynchronous checker framework Benjamin Marzinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f8ea80b80cb3e26b42e6d4dc1ec3cfedca2eb2fc.camel@suse.com \
--to=mwilck@suse.com \
--cc=bmarzins@redhat.com \
--cc=brian@purestorage.com \
--cc=christophe.varoqui@opensvc.com \
--cc=dm-devel@lists.linux.dev \
--cc=hare@suse.de \
--cc=xose.vazquez@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.