[Devel] [PATCH RHEL7 COMMIT] ploop: silence lockdep warning in setting discard_granularity via sysfs

Konstantin Khorenko khorenko at virtuozzo.com
Tue Sep 5 19:07:21 MSK 2023


The commit is pushed to "branch-rh7-3.10.0-1160.99.1.vz7.211.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.99.1.vz7.211.1
------>
commit 8c4e10404a5959f22e588379e5440f07e3261b9c
Author: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
Date:   Wed Aug 30 20:08:05 2023 +0300

    ploop: silence lockdep warning in setting discard_granularity via sysfs
    
    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
    discard_granularity.
    
    https://jira.vzint.dev/browse/PSBM-149698
    Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 drivers/block/ploop/sysfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/block/ploop/sysfs.c b/drivers/block/ploop/sysfs.c
index c3cc707ec323..f42c3471fa08 100644
--- a/drivers/block/ploop/sysfs.c
+++ b/drivers/block/ploop/sysfs.c
@@ -380,6 +380,7 @@ static int store_discard_granularity(struct ploop_device *plo, u32 val)
 	struct inode *inode;
 	int ret = 0;
 
+	lockdep_off();
 	mutex_lock(&plo->ctl_mutex);
 	if (test_bit(PLOOP_S_RUNNING, &plo->state)) {
 		ret = -EBUSY;
@@ -454,6 +455,7 @@ static int store_discard_granularity(struct ploop_device *plo, u32 val)
 
 unlock:
 	mutex_unlock(&plo->ctl_mutex);
+	lockdep_on();
 	return ret;
 }
 


More information about the Devel mailing list