aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2013-08-27 18:57:03 -0400
committerMike Snitzer <snitzer@redhat.com>2013-09-05 20:46:06 -0400
commit00c4fc3b1f590288cb3c42f36da50f49a513cfcf (patch)
treee185bc97fc6529d1299e5e13987fe5b86cf21868 /drivers/md/dm.c
parentc2b04824620f30b52bb2fdcdd14c758b8c62c70f (diff)
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 <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index ef095a96d039..7faeaa3d4835 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2235,11 +2235,13 @@ void dm_unlock_md_type(struct mapped_device *md)
2235 2235
2236void dm_set_md_type(struct mapped_device *md, unsigned type) 2236void dm_set_md_type(struct mapped_device *md, unsigned type)
2237{ 2237{
2238 BUG_ON(!mutex_is_locked(&md->type_lock));
2238 md->type = type; 2239 md->type = type;
2239} 2240}
2240 2241
2241unsigned dm_get_md_type(struct mapped_device *md) 2242unsigned dm_get_md_type(struct mapped_device *md)
2242{ 2243{
2244 BUG_ON(!mutex_is_locked(&md->type_lock));
2243 return md->type; 2245 return md->type;
2244} 2246}
2245 2247