diff options
author | NeilBrown <neilb@suse.com> | 2017-03-15 06:05:14 +0300 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-03-23 05:18:05 +0300 |
commit | 84dd97a69092cef858483b775f1900d743d796a4 (patch) | |
tree | 9c51fa4a0af72be76d07d86fa2c4d19e1313e1c7 /drivers/md/raid5.c | |
parent | 37011e3afb0fdc462307dc006246358bddf61e92 (diff) | |
download | linux-84dd97a69092cef858483b775f1900d743d796a4.tar.xz |
md/raid5: don't test ->writes_pending in raid5_remove_disk
This test on ->writes_pending cannot be safe as the counter
can be incremented at any moment and cannot be locked against.
Change it to test conf->active_stripes, which at least
can be locked against. More changes are still needed.
A future patch will change ->writes_pending, and testing it here will
be very inconvenient.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 00a34faabcdf..0b1a4339a437 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -7532,9 +7532,12 @@ static int raid5_remove_disk(struct mddev *mddev, struct md_rdev *rdev) /* * we can't wait pending write here, as this is called in * raid5d, wait will deadlock. + * neilb: there is no locking about new writes here, + * so this cannot be safe. */ - if (atomic_read(&mddev->writes_pending)) + if (atomic_read(&conf->active_stripes)) { return -EBUSY; + } log_exit(conf); return 0; } |