From: Jeff Layton <jlayton@kernel.org>
To: Wentao Liang <vulab@iscas.ac.cn>, Dai.Ngo@oracle.com
Cc: anna@kernel.org, chuck.lever@oracle.com,
linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org,
neil@brown.name, okorniev@redhat.com, tom@talpey.com,
trondmy@kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] lockd: Fix host reference leak in nlmclnt_recovery()
Date: Wed, 16 Sep 2026 07:07:32 -0400 [thread overview]
Message-ID: <b7c68b4602e750b3689b5fa0140ce19cfe8ce77b.camel@kernel.org> (raw)
In-Reply-To: <20260916074034.1972173-1-vulab@iscas.ac.cn>
On Wed, 2026-09-16 at 07:40 +0000, Wentao Liang wrote:
> In nlmclnt_recovery(), nlm_get_host(host) is called to take a reference
> on the host before spawning the reclaimer thread via kthread_run(). If
> kthread_run() fails, the reference is never released, and
> host->h_reclaiming remains incremented, preventing subsequent reclaim
> attempts.
>
> Fix this by releasing the host reference with nlmclnt_release_host(host)
> and resetting host->h_reclaiming to 0 on kthread_run() error.
>
> Fixes: df94f000c46c ("lockd: convert reclaimer thread to kthread interface")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> fs/lockd/clntlock.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
> index 8fa30c42c92a..aba37847356c 100644
> --- a/fs/lockd/clntlock.c
> +++ b/fs/lockd/clntlock.c
> @@ -216,10 +216,13 @@ nlmclnt_recovery(struct nlm_host *host)
> if (!host->h_reclaiming++) {
> nlm_get_host(host);
> task = kthread_run(reclaimer, host, "%s-reclaim", host->h_name);
> - if (IS_ERR(task))
> + if (IS_ERR(task)) {
> printk(KERN_ERR "lockd: unable to spawn reclaimer "
> "thread. Locks for %s won't be reclaimed! "
> "(%ld)\n", host->h_name, PTR_ERR(task));
> + host->h_reclaiming = 0;
> + nlmclnt_release_host(host);
> + }
> }
> }
>
Good catch!
Reviewed-by: Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2026-09-16 11:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 7:40 Wentao Liang
2026-09-16 11:07 ` Jeff Layton [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=b7c68b4602e750b3689b5fa0140ce19cfe8ce77b.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=anna@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tom@talpey.com \
--cc=trondmy@kernel.org \
--cc=vulab@iscas.ac.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®