diff options
author | NeilBrown <neilb@suse.com> | 2016-06-02 16:19:52 +1000 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2016-06-13 11:54:21 -0700 |
commit | 40cf2123c57928c3ec0626c49bef97ebdbce008e (patch) | |
tree | 0583f446c659c85f627d447f978a017a67bacf83 /drivers | |
parent | 5fd133511d5f2a9167573d100e14fddd9c621581 (diff) | |
download | linux-stable-40cf2123c57928c3ec0626c49bef97ebdbce008e.tar.gz linux-stable-40cf2123c57928c3ec0626c49bef97ebdbce008e.tar.bz2 linux-stable-40cf2123c57928c3ec0626c49bef97ebdbce008e.zip |
md/multipath: add rcu protection to rdev access in multipath_status.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/multipath.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index dd483bb2e111..69244de2036b 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c @@ -141,17 +141,19 @@ static void multipath_make_request(struct mddev *mddev, struct bio * bio) return; } -static void multipath_status (struct seq_file *seq, struct mddev *mddev) +static void multipath_status(struct seq_file *seq, struct mddev *mddev) { struct mpconf *conf = mddev->private; int i; 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->multipaths[i].rdev && - test_bit(In_sync, &conf->multipaths[i].rdev->flags) ? "U" : "_"); + rcu_read_lock(); + for (i = 0; i < conf->raid_disks; i++) { + struct md_rdev *rdev = rcu_dereference(conf->multipaths[i].rdev); + seq_printf (seq, "%s", rdev && test_bit(In_sync, &rdev->flags) ? "U" : "_"); + } + rcu_read_unlock(); seq_printf (seq, "]"); } |