OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
	Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1] dm-ploop: do not lock the md pages of a delta read for a BAT walk
Date: Thu, 12 Nov 2026 19:06:06 +0100	[thread overview]
Message-ID: <3c370399-53da-4704-8d98-fd0351373087@virtuozzo.com> (raw)
In-Reply-To: <20261105-b4-prep-khorenko-vstor-153709-dm-ploop-drop-the-lock-of-local-md-pages-v1-1-82fed22d5591@virtuozzo.com>

a kind ping :)

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 11/5/26 20:17, Konstantin Khorenko wrote:
> notify_delta_merged() and ploop_check_delta_before_flip() walk the live
> BAT together with the BAT of a delta that ploop_read_delta_metadata()
> read into a local md tree. For each page they take the md_lock of the
> live page and then the md_lock of the local one.
> 
> Every md_lock is initialized in ploop_alloc_md_page(), so both locks
> share one lockdep class. With CONFIG_PROVE_LOCKING the first walk
> reports "possible recursive locking detected", and lockdep turns itself
> off for the rest of the boot.
> 
> Only the cmd that read the local tree can reach it, and it frees the
> tree after the walk, so its md_lock protects nothing. Stop taking it.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-153709
> 
> Fixes: 0d4b4d0a20a9 ("dm-ploop: introduce per-md page locking")
> Feature: dm-ploop: ploop target driver
> Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
> ---
> This obsoletes "[PATCH vz10 10/24] dm-ploop: annotate nested md_lock in
> ploop_check_delta_before_flip()" of the VSTOR-137234 selftests series.
> Pavel pointed out that the SINGLE_DEPTH_NESTING annotation works around
> a lock that is not needed at all, and that notify_delta_merged() has
> the same problem. This patch stops taking that lock in both walks.
> 
> Assisted-by: LLM
> ---
>  drivers/md/dm-ploop-cmd.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
> index 2d1fa449b052d..f6135e07c2737 100644
> --- a/drivers/md/dm-ploop-cmd.c
> +++ b/drivers/md/dm-ploop-cmd.c
> @@ -812,7 +812,6 @@ static void notify_delta_merged(struct ploop *ploop, u8 level,
>  		d_bat_entries = d_md->kmpage;
>  
>  		spin_lock_irqsave(&md->md_lock, flags); /* write */
> -		spin_lock(&d_md->md_lock); /* write */
>  		for (; i <= end; i++) {
>  			clu = ploop_page_clu_idx_to_bat_clu(md->id, i);
>  			if (clu == nr_be - 1)
> @@ -846,7 +845,6 @@ static void notify_delta_merged(struct ploop *ploop, u8 level,
>  				WRITE_ONCE(md->bat_levels[i], level);
>  		}
>  
> -		spin_unlock(&d_md->md_lock);
>  		spin_unlock_irqrestore(&md->md_lock, flags);
>  
>  		if (stop)
> @@ -1147,7 +1145,6 @@ static int ploop_check_delta_before_flip(struct ploop *ploop, struct file *file)
>  		d_bat_entries = d_md->kmpage;
>  
>  		spin_lock_irq(&md->md_lock); /* read */
> -		spin_lock(&d_md->md_lock);
>  		for (; i <= end; i++) {
>  			if (ploop_md_page_cluster_is_in_top_delta(ploop, md, i) &&
>  			    d_bat_entries[i] != BAT_ENTRY_NONE) {
> @@ -1156,7 +1153,6 @@ static int ploop_check_delta_before_flip(struct ploop *ploop, struct file *file)
>  				break;
>  			}
>  		}
> -		spin_unlock(&d_md->md_lock);
>  		spin_unlock_irq(&md->md_lock);
>  		if (stop)
>  			break;
> 
> ---
> base-commit: f0cff9cebdb0d481d05b02bdb7bdafe864adca1c
> change-id: 20261105-b4-prep-khorenko-vstor-153709-dm-ploop-drop-the-lock-of-local-md-pages-4f25ac778924
> 
> Best regards,
> --  
> Konstantin Khorenko,
> Virtuozzo Linux Kernel Team
> 

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-11-12 18:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 19:17 Konstantin Khorenko
2026-11-12 18:06 ` Konstantin Khorenko [this message]
2026-11-12 18:06 ` Konstantin Khorenko
2026-11-17 10:29 ` Andrey Zhadchenko
2026-11-17 14:43 ` Konstantin Khorenko

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=3c370399-53da-4704-8d98-fd0351373087@virtuozzo.com \
    --to=khorenko@virtuozzo.com \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=ptikhomirov@virtuozzo.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