[Devel] [PATCH vz7] ploop: silence ignore discard_granularity vs update in use lockdep warning

Alexander Atanasov alexander.atanasov at virtuozzo.com
Mon Aug 28 16:07:43 MSK 2023


Lockdep reports circular lock dependency here
&p->lock --> &plo->ctl_mutex --> sb_writers.
this is only triggered by trinity and it did not happen
in real world for the last 10 years. fixing it at this stage is not feasible
since it could break so many things.
So take the safe route and just disable lockdep when updating the in use header.
Do this on in use update since there are other places that call sync_write and if there is
a lock issue with sync_write it would be eventually detected there.
discard_granylarity sysfs file have .ignore_lockdep set already.

https://jira.vzint.dev/browse/PSBM-149698
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 drivers/block/ploop/fmt_ploop1.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/block/ploop/fmt_ploop1.c b/drivers/block/ploop/fmt_ploop1.c
index e59a9eb50ac2..b0923c8c3659 100644
--- a/drivers/block/ploop/fmt_ploop1.c
+++ b/drivers/block/ploop/fmt_ploop1.c
@@ -313,7 +313,14 @@ ploop1_open(struct ploop_delta * delta)
 
 	if (!(delta->flags & PLOOP_FMT_RDONLY)) {
 		pvd_header_set_disk_in_use(vh);
+		/*
+		 * Lockdep reports circular lock dependency here
+		 * &p->lock --> &plo->ctl_mutex --> sb_writers
+		 * silence the warning as false positive.
+		 */
+		lockdep_off();
 		err = delta->io.ops->sync_write(&delta->io, ph->dyn_page, 4096, 0, 0);
+		lockdep_on();
 		if (err)
 			goto out_err;
 	}
-- 
2.39.3



More information about the Devel mailing list