From abec7dcd30acfb195bca36334cec4fe82b082b1d Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 13 May 2024 17:12:07 -0500 Subject: [PATCH] Linux: disable lockdep for a couple of locks When running a debug kernel with lockdep enabled there are several locks which report false positives. Set MUTEX_NOLOCKDEP/RW_NOLOCKDEP to disable these warnings. Reviewed-by: Brian Atkinson Signed-off-by: Brian Behlendorf Closes #16188 --- module/os/linux/spl/spl-procfs-list.c | 2 +- module/zfs/dbuf.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/module/os/linux/spl/spl-procfs-list.c b/module/os/linux/spl/spl-procfs-list.c index 5e073950d6..91840ed2ca 100644 --- a/module/os/linux/spl/spl-procfs-list.c +++ b/module/os/linux/spl/spl-procfs-list.c @@ -234,7 +234,7 @@ procfs_list_install(const char *module, modulestr = kmem_asprintf("%s/%s", module, submodule); else modulestr = kmem_asprintf("%s", module); - mutex_init(&procfs_list->pl_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&procfs_list->pl_lock, NULL, MUTEX_NOLOCKDEP, NULL); list_create(&procfs_list->pl_list, procfs_list_node_off + sizeof (procfs_list_node_t), procfs_list_node_off + offsetof(procfs_list_node_t, pln_link)); diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index bb913f5563..806ebcfc57 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -292,8 +292,8 @@ dbuf_cons(void *vdb, void *unused, int kmflag) dmu_buf_impl_t *db = vdb; memset(db, 0, sizeof (dmu_buf_impl_t)); - mutex_init(&db->db_mtx, NULL, MUTEX_DEFAULT, NULL); - rw_init(&db->db_rwlock, NULL, RW_DEFAULT, NULL); + mutex_init(&db->db_mtx, NULL, MUTEX_NOLOCKDEP, NULL); + rw_init(&db->db_rwlock, NULL, RW_NOLOCKDEP, NULL); cv_init(&db->db_changed, NULL, CV_DEFAULT, NULL); multilist_link_init(&db->db_cache_link); zfs_refcount_create(&db->db_holds); @@ -958,7 +958,7 @@ dbuf_init(void) 0, dbuf_cons, dbuf_dest, NULL, NULL, NULL, 0); for (int i = 0; i < hmsize; i++) - mutex_init(&h->hash_mutexes[i], NULL, MUTEX_DEFAULT, NULL); + mutex_init(&h->hash_mutexes[i], NULL, MUTEX_NOLOCKDEP, NULL); dbuf_stats_init(h);