All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zqiang" <qiang.zhang@linux.dev>
To: "Alexander Aring" <aahringo@redhat.com>
Cc: teigland@redhat.com, gfs2@lists.linux.dev,
	linux-kernel@vger.kernel.org, rcu@vger.kernel.org
Subject: Re: [PATCH] dlm: wait for outstanding SRCU callbacks to complete in exit paths
Date: Wed, 02 Sep 2026 14:49:14 +0000	[thread overview]
Message-ID: <2ff0e6ca8e1e05078a69dbd2b2ccd1e62fc4650f@linux.dev> (raw)
In-Reply-To: <CAK-6q+gET5NPczHYexcGXgptGTVnynYuVWzdbDkpsuvnbrymLA@mail.gmail.com>

> 
> Hi,
> 
> On Wed, Sep 2, 2026 at 10:30 AM Zqiang <qiang.zhang@linux.dev> wrote:
> 
> > 
> > >
> >  > Hi,
> >  >
> >  > On Tue, Sep 1, 2026 at 5:19 AM Zqiang <qiang.zhang@linux.dev> wrote:
> >  >
> >  >
> >  > The dlm_lowcomms_exit() and dlm_midcomms_exit() iterate over the
> >  > srcu protected connection and node hash tables and hand each
> >  > element to call_srcu() for deferred freeing (connection_release()
> >  > and midcomms_node_release()). call_srcu() is asynchronous: the
> >  > callbacks are invoked only after an SRCU grace period, which may
> >  > happen after the exit function has already returned.
> >  >
> >  > These exit functions are reached from exit_dlm() on module unload.
> >  > Once they return, module teardown continues and the module text
> >  > may be unloaded while call_srcu() callbacks are still pending. When
> >  > such a callback finally runs, it executes freed module code and
> >  > touches the static SRCU domains that are being torn down, resulting
> >  > in a use-after-free.
> > 
> >  I should rephrase it:
> > 
> >  Due to missed call to the srcu_barrier(), when invoke cleanup_srcu_struct()
> > 
> Then there need to be a MUST call of srcu_barrier() before
> cleanup_srcu_struct() every time.

If there are some call_srcu() call, the srcu_barrier() should be called before cleanup_srcu_struct().
usually, when the cleanup_srcu_struct() run, we should ensure that there are no pending SRCU callbacks
or ongoing SRCU grace periods at this time.

there are another reason:

The midcomms_node_release() srcu callback can call call_rcu(), we must wait the all
call_rcu() to complete, because rcu_barrier() which in dlm_memory_exit() is required
to successfully intercept these RCU callbacks.

Thanks
Zqiang

> 
> I am confused here.
> 
> - Alex
>

  reply	other threads:[~2026-09-02 14:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  9:18 [PATCH] dlm: wait for outstanding SRCU callbacks to complete in exit paths Zqiang
2026-09-01 17:12 ` Alexander Aring
2026-09-02 13:21 ` Alexander Aring
2026-09-02 14:15   ` Zqiang
2026-09-02 14:29     ` Zqiang
2026-09-02 14:36       ` Alexander Aring
2026-09-02 14:49         ` Zqiang [this message]
2026-09-02 15:02           ` Alexander Aring
2026-09-02 14:30     ` Alexander Aring
2026-09-02 14:48       ` Alexander Aring
2026-09-02 16:44       ` Paul E. McKenney
2026-09-02 17:13         ` Alexander Aring
2026-09-02 20:05           ` Paul E. McKenney

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=2ff0e6ca8e1e05078a69dbd2b2ccd1e62fc4650f@linux.dev \
    --to=qiang.zhang@linux.dev \
    --cc=aahringo@redhat.com \
    --cc=gfs2@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=teigland@redhat.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.