md/linear: shutup lockdep warnning
authorShaohua Li <shli@fb.com>
Tue, 21 Feb 2017 19:57:01 +0000 (11:57 -0800)
committerShaohua Li <shli@fb.com>
Thu, 23 Feb 2017 19:59:42 +0000 (11:59 -0800)
Commit 03a9e24(md linear: fix a race between linear_add() and
linear_congested()) introduces the warnning.

Acked-by: Coly Li <colyli@suse.de>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/linear.c

index 789008b..5b06b0d 100644 (file)
@@ -224,7 +224,8 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev)
         * oldconf until no one uses it anymore.
         */
        mddev_suspend(mddev);
-       oldconf = rcu_dereference(mddev->private);
+       oldconf = rcu_dereference_protected(mddev->private,
+                       lockdep_is_held(&mddev->reconfig_mutex));
        mddev->raid_disks++;
        WARN_ONCE(mddev->raid_disks != newconf->raid_disks,
                "copied raid_disks doesn't match mddev->raid_disks");