[PATCH] md: fix return value of rdev_size_change()

[PATCH] md: fix return value of rdev_size_change()

am 11.11.2010 21:25:17 von Justin Maggard

When trying to grow an array by enlarging component devices, rdev_size_store()
expects the return value of rdev_size_change() to be in sectors, but the actual
value is returned in KBs.

Signed-off-by: Justin Maggard
---
drivers/md/md.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 4e957f3..a0615af 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1337,7 +1337,7 @@ super_90_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors)
md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size,
rdev->sb_page);
md_super_wait(rdev->mddev);
- return num_sectors / 2; /* kB for sysfs */
+ return num_sectors;
}


@@ -1704,7 +1704,7 @@ super_1_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors)
md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size,
rdev->sb_page);
md_super_wait(rdev->mddev);
- return num_sectors / 2; /* kB for sysfs */
+ return num_sectors;
}

static struct super_type super_types[] = {
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] md: fix return value of rdev_size_change()

am 11.11.2010 22:01:14 von Justin Maggard

On Thu, Nov 11, 2010 at 12:51 PM, Mathias Bur=E9n com> wrote:
> On 11 November 2010 20:25, Justin Maggard wrot=
e:
>> When trying to grow an array by enlarging component devices, rdev_si=
ze_store()
>> expects the return value of rdev_size_change() to be in sectors, but=
the actual
>> value is returned in KBs.
>>
>> Signed-off-by: Justin Maggard
>> ---
>> =A0drivers/md/md.c | =A0 =A04 ++--
>> =A01 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/md/md.c b/drivers/md/md.c
>> index 4e957f3..a0615af 100644
>> --- a/drivers/md/md.c
>> +++ b/drivers/md/md.c
>> @@ -1337,7 +1337,7 @@ super_90_rdev_size_change(mdk_rdev_t *rdev, se=
ctor_t num_sectors)
>> =A0 =A0 =A0 =A0md_super_write(rdev->mddev, rdev, rdev->sb_start, rde=
v->sb_size,
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 rdev->sb_page);
>> =A0 =A0 =A0 =A0md_super_wait(rdev->mddev);
>> - =A0 =A0 =A0 return num_sectors / 2; /* kB for sysfs */
>> + =A0 =A0 =A0 return num_sectors;
>> =A0}
>>
>>
>> @@ -1704,7 +1704,7 @@ super_1_rdev_size_change(mdk_rdev_t *rdev, sec=
tor_t num_sectors)
>> =A0 =A0 =A0 =A0md_super_write(rdev->mddev, rdev, rdev->sb_start, rde=
v->sb_size,
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 rdev->sb_page);
>> =A0 =A0 =A0 =A0md_super_wait(rdev->mddev);
>> - =A0 =A0 =A0 return num_sectors / 2; /* kB for sysfs */
>> + =A0 =A0 =A0 return num_sectors;
>> =A0}
>>
>> =A0static struct super_type super_types[] =3D {
>> --
>> 1.7.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-raid=
" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
>>
>
> Hi,
>
> What is the effect of this bug?
>
> // Mathias
>

mdadm -G fails with enlarged component devices.

-Justin
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" i=
n
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] md: fix return value of rdev_size_change()

am 15.11.2010 02:00:57 von NeilBrown

On Thu, 11 Nov 2010 20:25:17 +0000
Justin Maggard wrote:

> When trying to grow an array by enlarging component devices, rdev_size_store()
> expects the return value of rdev_size_change() to be in sectors, but the actual
> value is returned in KBs.

Thanks.
This was broken by commit dd8ac336c13fd8afdb082ebacb1cddd5cf727889
so is broken in all kernels since 2.6.30.
I've queued of the patch for my next pull request to Linus.

Thanks for the report and the patch.

NeilBrown


>
> Signed-off-by: Justin Maggard
> ---
> drivers/md/md.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 4e957f3..a0615af 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -1337,7 +1337,7 @@ super_90_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors)
> md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size,
> rdev->sb_page);
> md_super_wait(rdev->mddev);
> - return num_sectors / 2; /* kB for sysfs */
> + return num_sectors;
> }
>
>
> @@ -1704,7 +1704,7 @@ super_1_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors)
> md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size,
> rdev->sb_page);
> md_super_wait(rdev->mddev);
> - return num_sectors / 2; /* kB for sysfs */
> + return num_sectors;
> }
>
> static struct super_type super_types[] = {

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html