From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Dmitry Vyukov <dvyukov@google.com>,
linux-rdma@vger.kernel.org,
syzbot+dc3dfba010d7671e05f5@syzkaller.appspotmail.com
Subject: Re: [PATCH rc] RDMA/cma: Ensure rdma_addr_cancel() happens before issuing more requests
Date: Thu, 23 Sep 2021 17:03:58 -0300 [thread overview]
Message-ID: <20210923200358.GR964074@nvidia.com> (raw)
In-Reply-To: <YUzEUM8RPlFZSbJx@unreal>
On Thu, Sep 23, 2021 at 09:15:44PM +0300, Leon Romanovsky wrote:
> On Thu, Sep 23, 2021 at 08:45:57AM -0300, Jason Gunthorpe wrote:
> > On Thu, Sep 23, 2021 at 08:49:06AM +0300, Leon Romanovsky wrote:
> > > On Wed, Sep 22, 2021 at 11:41:19AM -0300, Jason Gunthorpe wrote:
> > > > On Wed, Sep 22, 2021 at 11:01:39AM +0300, Leon Romanovsky wrote:
> > > >
> > > > > > + /* The FSM can return back to RDMA_CM_ADDR_BOUND after
> > > > > > + * rdma_resolve_ip() is called, eg through the error
> > > > > > + * path in addr_handler. If this happens the existing
> > > > > > + * request must be canceled before issuing a new one.
> > > > > > + */
> > > > > > + if (id_priv->used_resolve_ip)
> > > > > > + rdma_addr_cancel(&id->route.addr.dev_addr);
> > > > > > + else
> > > > > > + id_priv->used_resolve_ip = 1;
> > > > >
> > > > > Why don't you never clear this field?
> > > >
> > > > The only case where it can be cleared is if we have called
> > > > rdma_addr_cancel(), and since this is the only place that does it and
> > > > immediately calls rdma_resolve_ip() again, there is no reason to ever
> > > > clear it.
> > >
> > > IMHO, it is better to clear instead to rely on "the only place" semantic.
> >
> > Then the code looks really silly:
> >
> > if (id_priv->used_resolve_ip) {
> > rdma_addr_cancel(&id->route.addr.dev_addr);
> > id_priv->used_resolve_ip = 0;
> > }
> > id_priv->used_resolve_ip = 1;
>
> So write comment why you don't need to clear used_resolve_ip, but don't
> leave it as it is now, where readers need to guess.
>
I think it is a bit wordy, but I put this:
/*
* The FSM can return back to RDMA_CM_ADDR_BOUND after
* rdma_resolve_ip() is called, eg through the error
* path in addr_handler(). If this happens the existing
* request must be canceled before issuing a new one.
* Since canceling a request is a bit slow and this
* oddball path is rare, keep track once a request has
* been issued. The track turns out to be a permanent
* state since this is the only cancel as it is
* immediately before rdma_resolve_ip().
*/
And into for-rc
Jason
next prev parent reply other threads:[~2021-09-23 20:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-16 18:34 [PATCH rc] RDMA/cma: Ensure rdma_addr_cancel() happens before issuing more requests Jason Gunthorpe
2021-09-22 8:01 ` Leon Romanovsky
2021-09-22 9:38 ` Haakon Bugge
2021-09-22 14:44 ` Jason Gunthorpe
2021-09-22 14:41 ` Jason Gunthorpe
2021-09-23 5:49 ` Leon Romanovsky
2021-09-23 11:45 ` Jason Gunthorpe
2021-09-23 18:15 ` Leon Romanovsky
2021-09-23 20:03 ` Jason Gunthorpe [this message]
2021-09-23 23:17 ` Leon Romanovsky
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=20210923200358.GR964074@nvidia.com \
--to=jgg@nvidia.com \
--cc=dvyukov@google.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=syzbot+dc3dfba010d7671e05f5@syzkaller.appspotmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).