linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] md/raid5: cast chunk_sectors to sector_t value
@ 2020-12-16  1:26 Guoqing Jiang
  2020-12-16  4:26 ` Song Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Guoqing Jiang @ 2020-12-16  1:26 UTC (permalink / raw)
  To: linux-raid; +Cc: song, Guoqing Jiang

Currently, raid5 calculates dev_sectors from chunk_sectors without
proper cast, which is problematic.

Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
---
I think the recently report about raid5 issue could be related with
the setting of dev_sectors.

Could someone test it with a large raid5 array? Thanks.

 drivers/md/raid5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 3934347..ca0b29a 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -7662,7 +7662,7 @@ static int raid5_run(struct mddev *mddev)
 	}
 
 	/* device size must be a multiple of chunk size */
-	mddev->dev_sectors &= ~(mddev->chunk_sectors - 1);
+	mddev->dev_sectors &= ~((sector_t)mddev->chunk_sectors - 1);
 	mddev->resync_max_sectors = mddev->dev_sectors;
 
 	if (mddev->degraded > dirty_parity_disks &&
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] md/raid5: cast chunk_sectors to sector_t value
  2020-12-16  1:26 [PATCH] md/raid5: cast chunk_sectors to sector_t value Guoqing Jiang
@ 2020-12-16  4:26 ` Song Liu
  2021-01-25 13:57   ` Jack Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Song Liu @ 2020-12-16  4:26 UTC (permalink / raw)
  To: Guoqing Jiang; +Cc: linux-raid

On Tue, Dec 15, 2020 at 5:26 PM Guoqing Jiang
<guoqing.jiang@cloud.ionos.com> wrote:
>
> Currently, raid5 calculates dev_sectors from chunk_sectors without
> proper cast, which is problematic.
>
> Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
> ---
> I think the recently report about raid5 issue could be related with
> the setting of dev_sectors.
>
> Could someone test it with a large raid5 array? Thanks.

Yes, this was the exact problem. I will apply this to md-next. (probably
after the merge window).

Thanks,
Song

>
>  drivers/md/raid5.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 3934347..ca0b29a 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -7662,7 +7662,7 @@ static int raid5_run(struct mddev *mddev)
>         }
>
>         /* device size must be a multiple of chunk size */
> -       mddev->dev_sectors &= ~(mddev->chunk_sectors - 1);
> +       mddev->dev_sectors &= ~((sector_t)mddev->chunk_sectors - 1);
>         mddev->resync_max_sectors = mddev->dev_sectors;
>
>         if (mddev->degraded > dirty_parity_disks &&
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] md/raid5: cast chunk_sectors to sector_t value
  2020-12-16  4:26 ` Song Liu
@ 2021-01-25 13:57   ` Jack Wang
  2021-01-26 18:50     ` Song Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Jack Wang @ 2021-01-25 13:57 UTC (permalink / raw)
  To: Song Liu; +Cc: Guoqing Jiang, linux-raid

Song Liu <song@kernel.org> 于2020年12月16日周三 上午5:29写道:
>
> On Tue, Dec 15, 2020 at 5:26 PM Guoqing Jiang
> <guoqing.jiang@cloud.ionos.com> wrote:
> >
> > Currently, raid5 calculates dev_sectors from chunk_sectors without
> > proper cast, which is problematic.
> >
> > Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
> > ---
> > I think the recently report about raid5 issue could be related with
> > the setting of dev_sectors.
> >
> > Could someone test it with a large raid5 array? Thanks.
>
> Yes, this was the exact problem. I will apply this to md-next. (probably
> after the merge window).
>
> Thanks,
> Song
>
> >
> >  drivers/md/raid5.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> > index 3934347..ca0b29a 100644
> > --- a/drivers/md/raid5.c
> > +++ b/drivers/md/raid5.c
> > @@ -7662,7 +7662,7 @@ static int raid5_run(struct mddev *mddev)
> >         }
> >
> >         /* device size must be a multiple of chunk size */
> > -       mddev->dev_sectors &= ~(mddev->chunk_sectors - 1);
> > +       mddev->dev_sectors &= ~((sector_t)mddev->chunk_sectors - 1);
> >         mddev->resync_max_sectors = mddev->dev_sectors;
> >
> >         if (mddev->degraded > dirty_parity_disks &&
> > --
> > 2.7.4
> >
ping, I cant find it in latest mainline, is it forgotten?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] md/raid5: cast chunk_sectors to sector_t value
  2021-01-25 13:57   ` Jack Wang
@ 2021-01-26 18:50     ` Song Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Song Liu @ 2021-01-26 18:50 UTC (permalink / raw)
  To: Jack Wang; +Cc: Guoqing Jiang, linux-raid

On Mon, Jan 25, 2021 at 5:57 AM Jack Wang <jack.wang.usish@gmail.com> wrote:
>
> Song Liu <song@kernel.org> 于2020年12月16日周三 上午5:29写道:
> >
> > On Tue, Dec 15, 2020 at 5:26 PM Guoqing Jiang
> > <guoqing.jiang@cloud.ionos.com> wrote:
> > >
> > > Currently, raid5 calculates dev_sectors from chunk_sectors without
> > > proper cast, which is problematic.
> > >
> > > Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
> > > ---
> > > I think the recently report about raid5 issue could be related with
> > > the setting of dev_sectors.
> > >
> > > Could someone test it with a large raid5 array? Thanks.
> >
> > Yes, this was the exact problem. I will apply this to md-next. (probably
> > after the merge window).
> >
> > Thanks,
> > Song
> >
> > >
> > >  drivers/md/raid5.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> > > index 3934347..ca0b29a 100644
> > > --- a/drivers/md/raid5.c
> > > +++ b/drivers/md/raid5.c
> > > @@ -7662,7 +7662,7 @@ static int raid5_run(struct mddev *mddev)
> > >         }
> > >
> > >         /* device size must be a multiple of chunk size */
> > > -       mddev->dev_sectors &= ~(mddev->chunk_sectors - 1);
> > > +       mddev->dev_sectors &= ~((sector_t)mddev->chunk_sectors - 1);
> > >         mddev->resync_max_sectors = mddev->dev_sectors;
> > >
> > >         if (mddev->degraded > dirty_parity_disks &&
> > > --
> > > 2.7.4
> > >
> ping, I cant find it in latest mainline, is it forgotten?

Applied to md-next. Thanks.

Song

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-27  4:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16  1:26 [PATCH] md/raid5: cast chunk_sectors to sector_t value Guoqing Jiang
2020-12-16  4:26 ` Song Liu
2021-01-25 13:57   ` Jack Wang
2021-01-26 18:50     ` Song Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).