[Devel] [PATCH vz10 13/24] dm-tracking: initialize dmt->lock with spin_lock_init()

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jul 6 13:59:51 MSK 2026


struct dm_tracking is allocated with kzalloc() and its embedded
spinlock dmt->lock is taken in dmt_status()/tracking_clear()/
tracking_get_next()/dmt_cmd(), but dmt_ctr() never runs
spin_lock_init() on it (only ctl_mutex is initialized). A zero-filled
spinlock has no static lockdep key, so on the first spin_lock_irq() a
lockdep kernel prints:

  INFO: trying to register non-static key.
  ... turning off the locking correctness validator.
  _raw_spin_lock_irq <- dmt_status <- dm_ima_measure_on_table_load
    <- table_load <- ctl_ioctl

and disables lockdep for the rest of the boot. Initialize the spinlock
in the constructor next to mutex_init(&dmt->ctl_mutex).

Fixes: 51958806db7e ("dm: Add dm-tracking target")
Feature: dm-tracking: dirty blocks tracking target driver (for migration)
https://virtuozzo.atlassian.net/browse/VSTOR-137234
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 drivers/md/dm-tracking.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm-tracking.c b/drivers/md/dm-tracking.c
index ff0ba1cc5510..9b387a92f9a9 100644
--- a/drivers/md/dm-tracking.c
+++ b/drivers/md/dm-tracking.c
@@ -153,6 +153,7 @@ static int dmt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		goto err;
 
 	mutex_init(&dmt->ctl_mutex);
+	spin_lock_init(&dmt->lock);
 
 	ti->private = dmt;
 	dmt->ti = ti;
-- 
2.47.1



More information about the Devel mailing list