From 00c4fc3b1f590288cb3c42f36da50f49a513cfcf Mon Sep 17 00:00:00 2001 From: Mike Snitzer Date: Tue, 27 Aug 2013 18:57:03 -0400 Subject: dm ioctl: increase granularity of type_lock when loading table Hold the mapped device's type_lock before calling populate_table() since it is where the table's type is determined based on the specified targets. There is no need to allow concurrent table loads to race to establish the table's targets or type. This eliminates the need to grab the lock in dm_table_set_type(). Also verify that the type_lock is held in both dm_set_md_type() and dm_get_md_type(). Signed-off-by: Mike Snitzer Signed-off-by: Alasdair G Kergon --- drivers/md/dm-table.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/md/dm-table.c') diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index f309477d7efe..8f8783533ac7 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -888,9 +888,7 @@ static int dm_table_set_type(struct dm_table *t) * Determine the type from the live device. * Default to bio-based if device is new. */ - dm_lock_md_type(t->md); live_md_type = dm_get_md_type(t->md); - dm_unlock_md_type(t->md); if (live_md_type == DM_TYPE_REQUEST_BASED) request_based = 1; else -- cgit v1.2.3