diff options
author | NeilBrown <neilb@suse.de> | 2011-02-15 21:58:38 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-02-15 21:58:38 -0500 |
commit | cbe6ef1d2622e08e272600b3cb6040bed60f0450 (patch) | |
tree | 03d1ae0fe73404a3bd7850d89c415f3412977693 /drivers/md/md.c | |
parent | f7bee80945155ad0326916486dabc38428c6cdef (diff) |
md: don't set_capacity before array is active.
If the desired size of an array is set (via sysfs) before the array is
active (which is the normal sequence), we currrently call set_capacity
immediately.
This means that a subsequent 'open' (as can be caused by some
udev-triggers program) will notice the new size and try to probe for
partitions. However as the array isn't quite ready yet the read will
fail. Then when the array is read, as the size doesn't change again
we don't try to re-probe.
So when setting array size via sysfs, only call set_capacity if the
array is already active.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 0cc30ecda4c1..6818ff4aa8d6 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -4138,10 +4138,10 @@ array_size_store(mddev_t *mddev, const char *buf, size_t len) | |||
4138 | } | 4138 | } |
4139 | 4139 | ||
4140 | mddev->array_sectors = sectors; | 4140 | mddev->array_sectors = sectors; |
4141 | set_capacity(mddev->gendisk, mddev->array_sectors); | 4141 | if (mddev->pers) { |
4142 | if (mddev->pers) | 4142 | set_capacity(mddev->gendisk, mddev->array_sectors); |
4143 | revalidate_disk(mddev->gendisk); | 4143 | revalidate_disk(mddev->gendisk); |
4144 | 4144 | } | |
4145 | return len; | 4145 | return len; |
4146 | } | 4146 | } |
4147 | 4147 | ||