The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Max Kellermann <max.kellermann@ionos.com>
Cc: dhowells@redhat.com, Paulo Alcantara <pc@manguebit.org>,
	Christian Brauner <brauner@kernel.org>,
	netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] fs/netfs: fix reference leak
Date: Thu, 25 Sep 2025 10:32:16 +0100	[thread overview]
Message-ID: <928030.1758792736@warthog.procyon.org.uk> (raw)
In-Reply-To: <20250924185558.3395930-1-max.kellermann@ionos.com>

Hi Max,

I'm going to make the attached change to log the refcount and then post as v3
for Christian to pick up.

David
---
diff --git a/fs/netfs/objects.c b/fs/netfs/objects.c
index 39d5e13f7248..40a1c7d6f6e0 100644
--- a/fs/netfs/objects.c
+++ b/fs/netfs/objects.c
@@ -179,13 +179,15 @@ void netfs_put_request(struct netfs_io_request *rreq, enum netfs_rreq_ref_trace
  */
 void netfs_put_failed_request(struct netfs_io_request *rreq)
 {
+	int r = refcount_read(&rreq->ref);
+
 	/* new requests have two references (see
 	 * netfs_alloc_request(), and this function is only allowed on
 	 * new request objects
 	 */
-	WARN_ON_ONCE(refcount_read(&rreq->ref) != 2);
+	WARN_ON_ONCE(r != 2);
 
-	trace_netfs_rreq_ref(rreq->debug_id, 0, netfs_rreq_trace_put_failed);
+	trace_netfs_rreq_ref(rreq->debug_id, r, netfs_rreq_trace_put_failed);
 	netfs_free_request(&rreq->cleanup_work);
 }
 

      parent reply	other threads:[~2025-09-25  9:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24 18:55 [PATCH v2] fs/netfs: fix reference leak Max Kellermann
2025-09-24 19:12 ` David Howells
2025-09-25  9:32 ` David Howells [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=928030.1758792736@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=max.kellermann@ionos.com \
    --cc=netfs@lists.linux.dev \
    --cc=pc@manguebit.org \
    --cc=stable@vger.kernel.org \
    /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