md/raid5: add rcu protection to rdev accesses in raid5_status.
authorNeilBrown <neilb@suse.com>
Thu, 2 Jun 2016 06:19:52 +0000 (16:19 +1000)
committerShaohua Li <shli@fb.com>
Mon, 13 Jun 2016 18:54:20 +0000 (11:54 -0700)
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/raid5.c

index 198b2a9eef980d89648a00bea2eb657825a46c9f..c07b22e8d946b866517e445826881ac9e02c0799 100644 (file)
@@ -7069,10 +7069,12 @@ static void raid5_status(struct seq_file *seq, struct mddev *mddev)
        seq_printf(seq, " level %d, %dk chunk, algorithm %d", mddev->level,
                conf->chunk_sectors / 2, mddev->layout);
        seq_printf (seq, " [%d/%d] [", conf->raid_disks, conf->raid_disks - mddev->degraded);
-       for (i = 0; i < conf->raid_disks; i++)
-               seq_printf (seq, "%s",
-                              conf->disks[i].rdev &&
-                              test_bit(In_sync, &conf->disks[i].rdev->flags) ? "U" : "_");
+       rcu_read_lock();
+       for (i = 0; i < conf->raid_disks; i++) {
+               struct md_rdev *rdev = rcu_dereference(conf->disks[i].rdev);
+               seq_printf (seq, "%s", rdev && test_bit(In_sync, &rdev->flags) ? "U" : "_");
+       }
+       rcu_read_unlock();
        seq_printf (seq, "]");
 }
 
This page took 0.027579 seconds and 5 git commands to generate.