md: Fix rdev_size_store with size == 0
Fix rdev_size_store with size == 0.
size == 0 means to use the largest size allowed by the
underlying device and is used when modifying an active array.
This fixes a regression introduced by
commit d7027458d6
Cc: <stable@kernel.org>
Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
fd04808830
commit
7d3c6f8717
1 changed files with 2 additions and 4 deletions
|
@ -2106,8 +2106,6 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len)
|
||||||
|
|
||||||
if (strict_strtoull(buf, 10, &size) < 0)
|
if (strict_strtoull(buf, 10, &size) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (size < my_mddev->size)
|
|
||||||
return -EINVAL;
|
|
||||||
if (my_mddev->pers && rdev->raid_disk >= 0) {
|
if (my_mddev->pers && rdev->raid_disk >= 0) {
|
||||||
if (my_mddev->persistent) {
|
if (my_mddev->persistent) {
|
||||||
size = super_types[my_mddev->major_version].
|
size = super_types[my_mddev->major_version].
|
||||||
|
@ -2118,9 +2116,9 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len)
|
||||||
size = (rdev->bdev->bd_inode->i_size >> 10);
|
size = (rdev->bdev->bd_inode->i_size >> 10);
|
||||||
size -= rdev->data_offset/2;
|
size -= rdev->data_offset/2;
|
||||||
}
|
}
|
||||||
if (size < my_mddev->size)
|
|
||||||
return -EINVAL; /* component must fit device */
|
|
||||||
}
|
}
|
||||||
|
if (size < my_mddev->size)
|
||||||
|
return -EINVAL; /* component must fit device */
|
||||||
|
|
||||||
rdev->size = size;
|
rdev->size = size;
|
||||||
if (size > oldsize && my_mddev->external) {
|
if (size > oldsize && my_mddev->external) {
|
||||||
|
|
Loading…
Reference in a new issue