summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Efremov <yefremov.denis@gmail.com>2012-10-11 13:08:02 +1100
committerNeilBrown <neilb@suse.de>2012-10-11 13:08:02 +1100
commitbc78c57388e7f447f58e30d60b1505ddaaaf3a7d (patch)
tree05257b01ee452d05490de4a2d434163b0838be74
parent02f3939e1a9357b7c370a4a69717cf9c02452737 (diff)
downloadop-kernel-dev-bc78c57388e7f447f58e30d60b1505ddaaaf3a7d.zip
op-kernel-dev-bc78c57388e7f447f58e30d60b1505ddaaaf3a7d.tar.gz
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>
-rw-r--r--drivers/md/linear.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index fa211d8..92c64d1 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)
if (!newconf)
return -ENOMEM;
- oldconf = rcu_dereference(mddev->private);
+ oldconf = rcu_dereference_protected(mddev->private,
+ lockdep_is_held(
+ &mddev->reconfig_mutex));
mddev->raid_disks++;
rcu_assign_pointer(mddev->private, newconf);
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)
static int linear_stop (struct mddev *mddev)
{
- struct linear_conf *conf = mddev->private;
+ struct linear_conf *conf =
+ rcu_dereference_protected(mddev->private,
+ lockdep_is_held(
+ &mddev->reconfig_mutex));
/*
* We do not require rcu protection here since
OpenPOWER on IntegriCloud