[PATCH 05/17] dm-snap: Add dm_exceptional_lock

From: Matthew Wilcox (Oracle)
Date: Thu Apr 08 2021 - 22:55:55 EST


Allow lockdep to track the dm-snap bit spin locks.

Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
drivers/md/dm-snap.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 8f3ad87e6117..4c2a01e433de 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -644,16 +644,18 @@ static void dm_exception_table_lock_init(struct dm_snapshot *s, chunk_t chunk,
lock->pending_slot = &pending->table[exception_hash(pending, chunk)];
}

+static DEFINE_SPLIT_LOCK(dm_exception_lock);
+
static void dm_exception_table_lock(struct dm_exception_table_lock *lock)
{
- hlist_bl_lock(lock->complete_slot);
- hlist_bl_lock(lock->pending_slot);
+ hlist_bl_lock(lock->complete_slot, &dm_exception_lock);
+ hlist_bl_lock_nested(lock->pending_slot, &dm_exception_lock, 1);
}

static void dm_exception_table_unlock(struct dm_exception_table_lock *lock)
{
- hlist_bl_unlock(lock->pending_slot);
- hlist_bl_unlock(lock->complete_slot);
+ hlist_bl_unlock(lock->pending_slot, &dm_exception_lock);
+ hlist_bl_unlock(lock->complete_slot, &dm_exception_lock);
}

static int dm_exception_table_init(struct dm_exception_table *et,
--
2.30.2