From 99909b74fb34174b22965c397782cd1a370517ff Mon Sep 17 00:00:00 2001 From: Hao Zhang Date: Sat, 12 Sep 2026 00:07:33 +0800 Subject: [PATCH] dm thin: Remove unnecessary locking from pool_map() pool_map() takes pool->lock only while setting the bio's data device. The pool target's data_dev is initialized when the target is constructed and is not changed afterwards. The device-mapper target remains alive while its map callback is running, so pool->lock is not needed to protect data_dev. Remove the unnecessary locking. This also avoids holding pool->lock across bio_set_dev(), which may perform a blkcg lookup and acquire the request queue's queue_lock. Signed-off-by: Hao Zhang Signed-off-by: Mikulas Patocka --- drivers/md/dm-thin.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 59392de7a477..358ed77ffb2b 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -3438,14 +3438,11 @@ static int pool_ctr(struct dm_target *ti, unsigned int argc, char **argv) static int pool_map(struct dm_target *ti, struct bio *bio) { struct pool_c *pt = ti->private; - struct pool *pool = pt->pool; /* * As this is a singleton target, ti->begin is always zero. */ - spin_lock_irq(&pool->lock); bio_set_dev(bio, pt->data_dev->bdev); - spin_unlock_irq(&pool->lock); return DM_MAPIO_REMAPPED; }