diff options
author | Denis Efremov <yefremov.denis@gmail.com> | 2012-10-10 22:08:02 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-10-10 22:08:02 -0400 |
commit | bc78c57388e7f447f58e30d60b1505ddaaaf3a7d (patch) | |
tree | 05257b01ee452d05490de4a2d434163b0838be74 /drivers/md/linear.c | |
parent | 02f3939e1a9357b7c370a4a69717cf9c02452737 (diff) |
md/linear: rcu_dereference outside read-lock section
According to the comment in linear_stop function
rcu_dereference in linear_start and linear_stop functions
occurs under reconfig_mutex. The patch represents this
agreement in code and prevents lockdep complaint.
Found by Linux Driver Verification project (linuxtesting.org)
Signed-off-by: Denis Efremov <yefremov.denis@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/linear.c')
-rw-r--r-- | drivers/md/linear.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index fa211d80fc0a..92c64d162a92 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -244,7 +244,9 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev) | |||
244 | if (!newconf) | 244 | if (!newconf) |
245 | return -ENOMEM; | 245 | return -ENOMEM; |
246 | 246 | ||
247 | oldconf = rcu_dereference(mddev->private); | 247 | oldconf = rcu_dereference_protected(mddev->private, |
248 | lockdep_is_held( | ||
249 | &mddev->reconfig_mutex)); | ||
248 | mddev->raid_disks++; | 250 | mddev->raid_disks++; |
249 | rcu_assign_pointer(mddev->private, newconf); | 251 | rcu_assign_pointer(mddev->private, newconf); |
250 | md_set_array_sectors(mddev, linear_size(mddev, 0, 0)); | 252 | md_set_array_sectors(mddev, linear_size(mddev, 0, 0)); |
@@ -256,7 +258,10 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev) | |||
256 | 258 | ||
257 | static int linear_stop (struct mddev *mddev) | 259 | static int linear_stop (struct mddev *mddev) |
258 | { | 260 | { |
259 | struct linear_conf *conf = mddev->private; | 261 | struct linear_conf *conf = |
262 | rcu_dereference_protected(mddev->private, | ||
263 | lockdep_is_held( | ||
264 | &mddev->reconfig_mutex)); | ||
260 | 265 | ||
261 | /* | 266 | /* |
262 | * We do not require rcu protection here since | 267 | * We do not require rcu protection here since |