All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: ghuicao@163.com
Cc: yukuai@fygo.io, linux-raid@vger.kernel.org
Subject: Re: [PATCH v2 3/3] md-cluster: fix ack_lockres leak in __sendmsg error path
Date: Thu, 27 Aug 2026 06:24:33 +0000	[thread overview]
Message-ID: <20260827062433.D2E551F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827061200.79753-3-ghuicao@163.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [High] The newly added error recovery logic silently fails if the original error was a timeout, leaving the lock leaked in EX state and defeating the patch's purpose.

Pre-existing issues:
- [High] An infinite loop and CPU soft lockup occur in the `failed_ack` cleanup path if a previous DLM lock operation timed out.
--

commit aed4dde7a766dd41cf7dc88c61e2ae9c8fd7a612
Author: Cao Guanghui <caoguanghui@kylinos.cn>
    md-cluster: fix ack_lockres leak in __sendmsg error path

In __sendmsg(), if the down-conversion of ack_lockres from EX to CR fails, the
original code jumps to failed_ack and leaves ack_lockres in the EX state. This
commit attempts to fix this by adding a conversion of ack_lockres to CR in the
failed_ack path.

> diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
> index bc4118d8c5a9f..7c6aa759d0c23 100644
> --- a/drivers/md/md-cluster.c
> +++ b/drivers/md/md-cluster.c
> @@ -801,6 +801,8 @@ static int __sendmsg(struct md_cluster_info *cinfo, struct cluster_msg *cmsg)
>  	}
>  
>  failed_ack:
> +	if (error)
> +		dlm_lock_sync(cinfo->ack_lockres, DLM_LOCK_CR);

[Severity: High]
Will this error recovery logic silently fail if the original error was a
timeout?

If dlm_lock_sync() times out when acquiring DLM_LOCK_EX for ack_lockres
earlier in the function, it leaves a pending DLM lock request in the
background. Because of the uncancelled pending request, calling
dlm_lock_sync(cinfo->ack_lockres, DLM_LOCK_CR) here immediately fails with
-EBUSY and its return value is ignored.

When the background EX request eventually completes, the lock is left in the EX
state, which could still lead to a cluster-wide deadlock.

>  	while ((unlock_error = dlm_unlock_sync(cinfo->message_lockres)))
>  		pr_err("md-cluster: failed convert to NL on MESSAGE(%d)\n",
>  			unlock_error);

[Severity: High]
This is a pre-existing issue, but does this create an infinite loop and CPU
soft lockup if a previous DLM lock operation timed out?

If a timeout occurs during dlm_lock_sync(cinfo->message_lockres, DLM_LOCK_CW)
earlier in __sendmsg(), it leaves a pending lock conversion request in the DLM
lockspace. 

Because of the pending request, dlm_unlock_sync() will immediately return
-EBUSY without blocking, causing this to become an infinite loop that floods
the kernel log and soft lockups the CPU core.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260827061200.79753-1-ghuicao@163.com?part=3

  reply	other threads:[~2026-08-27  6:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27  2:52 [PATCH] md-cluster: check pers->resize() return value in update_size() ghuicao
2026-08-27  3:07 ` sashiko-bot
2026-08-27  6:11 ` [PATCH v2 1/3] md-cluster: fix error handling and superblock update in update_size revert ghuicao
2026-08-27  6:11   ` [PATCH v2 2/3] md-cluster: propagate update_size() errors to callers ghuicao
2026-08-27  6:23     ` sashiko-bot
2026-08-27  6:12   ` [PATCH v2 3/3] md-cluster: fix ack_lockres leak in __sendmsg error path ghuicao
2026-08-27  6:24     ` sashiko-bot [this message]
2026-08-27  6:24   ` [PATCH v2 1/3] md-cluster: fix error handling and superblock update in update_size revert sashiko-bot
2026-08-27  8:44   ` [PATCH v3 1/3] md-cluster: fix lock_comm leak and __sendmsg error path ghuicao
2026-08-27  8:44     ` [PATCH v3 2/3] md-cluster: fix error handling and superblock consistency in update_size ghuicao
2026-08-27  8:58       ` sashiko-bot
2026-08-27  8:44     ` [PATCH v3 3/3] md-cluster: revert local resize and propagate cluster errors ghuicao
2026-08-27  9:04       ` sashiko-bot
2026-08-27  8:58     ` [PATCH v3 1/3] md-cluster: fix lock_comm leak and __sendmsg error path sashiko-bot

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=20260827062433.D2E551F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ghuicao@163.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yukuai@fygo.io \
    /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.