netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Vosburgh <jv@jvosburgh.net>
To: Jianbo Liu <jianbol@nvidia.com>
Cc: "liuhangbin@gmail.com" <liuhangbin@gmail.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	Leon Romanovsky <leonro@nvidia.com>,
	Gal Pressman <gal@nvidia.com>,
	"andy@greyhouse.net" <andy@greyhouse.net>,
	Tariq Toukan <tariqt@nvidia.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"edumazet@google.com" <edumazet@google.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	"kuba@kernel.org" <kuba@kernel.org>
Subject: Re: [PATCH net V5 3/3] bonding: change ipsec_lock from spin lock to mutex
Date: Thu, 22 Aug 2024 17:17:57 -0700	[thread overview]
Message-ID: <165730.1724372277@famine> (raw)
In-Reply-To: <02d8277b-e6fc-44d4-8c88-2eb42813cd22@nvidia.com>

Jianbo Liu <jianbol@nvidia.com> wrote:

[...]
>I think it's good solution.
>So I need to add the dev_hold/dev_put as following, for example, for
>bond_ipsec_del_sa, right?
>
>@@ -526,6 +534,7 @@ static void bond_ipsec_del_sa(struct xfrm_state *xs)
>        bond = netdev_priv(bond_dev);
>        slave = rcu_dereference(bond->curr_active_slave);
>        real_dev = slave ? slave->dev : NULL;
>+       dev_hold(real_dev);
>        rcu_read_unlock();
>
>        if (!slave)
>@@ -545,6 +554,7 @@ static void bond_ipsec_del_sa(struct xfrm_state *xs)
>
>        real_dev->xfrmdev_ops->xdo_dev_state_delete(xs);
> out:
>+       dev_put(real_dev);
>        mutex_lock(&bond->ipsec_lock);
>        list_for_each_entry(ipsec, &bond->ipsec_list, list) {
>                if (ipsec->xs == xs) {
>
>If you are ok with that, I will add the same for
>bond_ipsec_add_sa/bond_ipsec_free_sa, and send new version.

	Yes, I think that will work, but please use netdev_hold() as
Jakub requested.

	-J

---
	-Jay Vosburgh, jv@jvosburgh.net

      parent reply	other threads:[~2024-08-23  0:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21  9:04 [PATCH net V5 0/3] Fixes for IPsec over bonding Jianbo Liu
2024-08-21  9:04 ` [PATCH net V5 1/3] bonding: implement xdo_dev_state_free and call it after deletion Jianbo Liu
2024-08-21  9:04 ` [PATCH net V5 2/3] bonding: extract the use of real_device into local variable Jianbo Liu
2024-08-21  9:04 ` [PATCH net V5 3/3] bonding: change ipsec_lock from spin lock to mutex Jianbo Liu
2024-08-21 16:00   ` Jay Vosburgh
2024-08-22  0:11     ` Jakub Kicinski
2024-08-22  2:07       ` Jianbo Liu
2024-08-22  1:53     ` Jianbo Liu
2024-08-22  6:05       ` Jay Vosburgh
2024-08-22 11:15         ` Jianbo Liu
2024-08-22 23:19           ` Jakub Kicinski
2024-08-23  0:17           ` Jay Vosburgh [this message]

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=165730.1724372277@famine \
    --to=jv@jvosburgh.net \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=jianbol@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.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).