Re: [PATCH 4.14 022/284] SUNRPC: avoid race between mod_timer() and del_timer_sync()

Eugeniu Rosca
2022-09-12T10:15:23Z

Hello Greg,

On So, Sep 11, 2022 at 07:41:02 +0200, gregkh@linuxfoundation.org wrote:
> On Thu, Sep 08, 2022 at 02:09:31PM +0200, Eugeniu Rosca wrote:

[..]

> > Your proposal [*] seems to resolve the issue for me.
> >
> > Any chance to get a stable patch, to which I will gladly provide
> > the Reviewed-by/Tested-by signatures?
> >
> > > >
> > > > NeilBrown
> > > >
> >
> > [*] diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
> > index e7d55d63d4f1..7f9b94acf597 100644
> > --- a/net/sunrpc/xprt.c
> > +++ b/net/sunrpc/xprt.c
> > @@ -1525,9 +1525,9 @@ static void xprt_destroy(struct rpc_xprt *xprt)
> > * is cleared. We use ->transport_lock to ensure the mod_timer()
> > * can only run *before* del_time_sync(), never after.
> > */
> > - spin_lock(&xprt->transport_lock);
> > + spin_lock_bh(&xprt->transport_lock);
> > del_timer_sync(&xprt->timer);
> > - spin_unlock(&xprt->transport_lock);
> > + spin_unlock_bh(&xprt->transport_lock);
> >
> > /*
> > * Destroy sockets etc from the system workqueue so they can
> >
>
> Can you just turn this into a proper patch that we can apply to the
> needed stable tree(s)?

It has been kindly provided by Neil Brown in
https://lore.kernel.org/lkml/166293725263.30452.1720462103844620549@noble.neil.brown.name/

Best Regards,
Eugeniu Rosca