From: Keith Busch <kbusch@kernel.org>
To: Geliang Tang <geliang@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>,
Roy Shterman <roys@lightbitslabs.com>,
Solganik Alexander <sashas@lightbitslabs.com>,
Hannes Reinecke <hare@suse.de>,
Geliang Tang <tanggeliang@kylinos.cn>,
linux-nvme@lists.infradead.org
Subject: Re: [PATCH v2] nvmet-tcp: fix page fragment cache leak in error path
Date: Wed, 27 May 2026 08:17:46 -0600 [thread overview]
Message-ID: <ahb9ClPIBPRTy3CO@kbusch-mbp> (raw)
In-Reply-To: <e4df8752611dc5914f849b1d17f5512434b954cb.1779787061.git.tanggeliang@kylinos.cn>
On Tue, May 26, 2026 at 05:22:22PM +0800, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> In nvmet_tcp_alloc_queue(), when a connection is closed during the
> allocation process (e.g., nvmet_tcp_set_queue_sock() returns -ENOTCONN),
> the error handling jumps to out_destroy_sq and then to out_ida_remove
> without draining the page fragment cache.
>
> Although nvmet_tcp_free_cmd() is called in some error paths to release
> individual page fragments, the underlying page cache reference held by
> queue->pf_cache is never released. The first allocation using pf_cache
> is the call to nvmet_tcp_alloc_cmd() for queue->connect, which happens
> after ida_alloc() returns successfully. This results in a page leak each
> time a connection fails during allocation, which could lead to memory
> exhaustion over time if connections are repeatedly opened and closed.
>
> Fix this by calling page_frag_cache_drain() before freeing the queue
> structure in the out_ida_remove label.
Thanks, applied to nvme-7.2 with the fixed up comment style suggestion.
prev parent reply other threads:[~2026-05-27 14:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 9:22 [PATCH v2] nvmet-tcp: fix page fragment cache leak in error path Geliang Tang
2026-05-27 13:44 ` Christoph Hellwig
2026-05-27 14:17 ` Keith Busch [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=ahb9ClPIBPRTy3CO@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=geliang@kernel.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kch@nvidia.com \
--cc=linux-nvme@lists.infradead.org \
--cc=roys@lightbitslabs.com \
--cc=sagi@grimberg.me \
--cc=sashas@lightbitslabs.com \
--cc=tanggeliang@kylinos.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.