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 <[email protected]> --- 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 [email protected] https://lists.openvz.org/mailman/listinfo/devel
