aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorPranith Kumar <bobby.prani@gmail.com>2014-10-28 18:09:56 -0400
committerMike Snitzer <snitzer@redhat.com>2014-11-10 15:25:29 -0500
commit33423974bfc1c61193df765078f0466fece7021e (patch)
tree7be12b81b13b978cda2f483a875c39a4def34dab /drivers/md
parent42d6a8ce3c3f70bf77a40ace385f59e1b5b9918f (diff)
dm: Use rcu_dereference() for accessing rcu pointer
The map field in 'struct mapped_device' is an rcu pointer. Use rcu_dereference() while accessing it. Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 0fee0e54d36f..c5e14eee8c76 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2332,7 +2332,7 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
2332 2332
2333 merge_is_optional = dm_table_merge_is_optional(t); 2333 merge_is_optional = dm_table_merge_is_optional(t);
2334 2334
2335 old_map = md->map; 2335 old_map = rcu_dereference(md->map);
2336 rcu_assign_pointer(md->map, t); 2336 rcu_assign_pointer(md->map, t);
2337 md->immutable_target_type = dm_table_get_immutable_target_type(t); 2337 md->immutable_target_type = dm_table_get_immutable_target_type(t);
2338 2338
@@ -2351,7 +2351,7 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
2351 */ 2351 */
2352static struct dm_table *__unbind(struct mapped_device *md) 2352static struct dm_table *__unbind(struct mapped_device *md)
2353{ 2353{
2354 struct dm_table *map = md->map; 2354 struct dm_table *map = rcu_dereference(md->map);
2355 2355
2356 if (!map) 2356 if (!map)
2357 return NULL; 2357 return NULL;
@@ -2745,7 +2745,7 @@ int dm_suspend(struct mapped_device *md, unsigned suspend_flags)
2745 goto out_unlock; 2745 goto out_unlock;
2746 } 2746 }
2747 2747
2748 map = md->map; 2748 map = rcu_dereference(md->map);
2749 2749
2750 /* 2750 /*
2751 * DMF_NOFLUSH_SUSPENDING must be set before presuspend. 2751 * DMF_NOFLUSH_SUSPENDING must be set before presuspend.
@@ -2839,7 +2839,7 @@ int dm_resume(struct mapped_device *md)
2839 if (!dm_suspended_md(md)) 2839 if (!dm_suspended_md(md))
2840 goto out; 2840 goto out;
2841 2841
2842 map = md->map; 2842 map = rcu_dereference(md->map);
2843 if (!map || !dm_table_get_size(map)) 2843 if (!map || !dm_table_get_size(map))
2844 goto out; 2844 goto out;
2845 2845