netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: luoxuanqiang <xuanqiang.luo@linux.dev>
To: Eric Dumazet <edumazet@google.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	Kuniyuki Iwashima <kuniyu@google.com>
Subject: Re: [PATCH net-next] net: remove obsolete WARN_ON(refcount_read(&sk->sk_refcnt) == 1)
Date: Wed, 15 Oct 2025 14:03:55 +0800	[thread overview]
Message-ID: <9e7530fc-c546-4420-9ca7-0e3d0a7b63e5@linux.dev> (raw)
In-Reply-To: <20251014140605.2982703-1-edumazet@google.com>


在 2025/10/14 22:06, Eric Dumazet 写道:
> sk->sk_refcnt has been converted to refcount_t in 2017.
>
> __sock_put(sk) being refcount_dec(&sk->sk_refcnt), it will complain
> loudly if the current refcnt is 1 (or less) in a non racy way.
>
> We can remove four WARN_ON() in favor of the generic refcount_dec()
> check.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Reviewed-by: Xuanqiang Luo<luoxuanqiang@kylinos.cn>

Dear Eric,

Following your line of thought, I found there's also a point in btrfs that
needs modification.

Would you like to modify it together? Though it has nothing to do with
socket, or shall I modify it separately later?

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 89ae0c7a610a..485bef0ba419 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -138,7 +138,6 @@ static const unsigned int btrfs_blocked_trans_types[TRANS_STATE_MAX] = {
  void btrfs_put_transaction(struct btrfs_transaction *transaction)
  {
-       WARN_ON(refcount_read(&transaction->use_count) == 0);
         if (refcount_dec_and_test(&transaction->use_count)) {
                 BUG_ON(!list_empty(&transaction->list));
                 WARN_ON(!xa_empty(&transaction->delayed_refs.head_refs));

Thanks!


  parent reply	other threads:[~2025-10-15  6:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14 14:06 [PATCH net-next] net: remove obsolete WARN_ON(refcount_read(&sk->sk_refcnt) == 1) Eric Dumazet
2025-10-15  2:06 ` Kuniyuki Iwashima
2025-10-15  6:03 ` luoxuanqiang [this message]
2025-10-15  6:44   ` Eric Dumazet
2025-10-16  0:40 ` patchwork-bot+netdevbpf

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=9e7530fc-c546-4420-9ca7-0e3d0a7b63e5@linux.dev \
    --to=xuanqiang.luo@linux.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@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 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).