All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Andre Noll <maan@systemlinux.org>
Cc: Wei Yongquan <weiyqlq@gmail.com>,
	linux-raid <linux-raid@vger.kernel.org>
Subject: Re: linear : divide error: 0000
Date: Thu, 6 Nov 2008 17:44:24 +1100	[thread overview]
Message-ID: <18706.37448.38431.286111@notabene.brown> (raw)
In-Reply-To: message from Andre Noll on Monday November 3

On Monday November 3, maan@systemlinux.org wrote:
> > This sector_div() is in linear_conf() while the call trace indicates
> > the bug happens in mddev_put(). I'll have a deeper look later today.
> 
> Indeed, this sector_div() is responsible for the bug. The following
> patch (against Neil's for-next tree) should fix this. Please give it a
> try.

Thanks Andre.  This is definitely a bug, since 2.6.14!!

I'll queue that patch for mainline and -stable.

Thanks,
NeilBrown

> 
> Andre
> 
> commit 284b3e2a37c8790d0e9315aed03d594165a85455
> Author: Andre Noll <maan@systemlinux.org>
> Date:   Mon Nov 3 19:39:22 2008 +0100
> 
>     md: linear: Fix a division by zero bug for very small arrays.
>     
>     We currently oops with a divide error on starting a linear software
>     raid array consisting of at least two very small (< 500K) devices.
>     
>     The bug is caused by the calculation of the hash table size which
>     tries to compute sector_div(sz, base) with "base" being zero due to
>     the small size of the component devices of the array.
>     
>     Fix this by requiring the hash spacing to be at least one which
>     implies that also "base" is non-zero.
>     
>     Signed-off-by: Andre Noll <maan@systemlinux.org>
> 
> diff --git a/drivers/md/linear.c b/drivers/md/linear.c
> index 190147c..3b90c5c 100644
> --- a/drivers/md/linear.c
> +++ b/drivers/md/linear.c
> @@ -148,6 +148,8 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
>  
>  	min_sectors = conf->array_sectors;
>  	sector_div(min_sectors, PAGE_SIZE/sizeof(struct dev_info *));
> +	if (min_sectors == 0)
> +		min_sectors = 1;
>  
>  	/* min_sectors is the minimum spacing that will fit the hash
>  	 * table in one PAGE.  This may be much smaller than needed.
> -- 
> The only person who always got his work done by Friday was Robinson Crusoe

      reply	other threads:[~2008-11-06  6:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-02 16:03 linear : divide error: 0000 Wei Yongquan
2008-11-03 10:32 ` Andre Noll
2008-11-03 12:37   ` Wei Yongquan
2008-11-03 14:15     ` Andre Noll
2008-11-03 14:53       ` Wei Yongquan
2008-11-03 16:43         ` Andre Noll
2008-11-03 18:28   ` Andre Noll
2008-11-06  6:44     ` Neil Brown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18706.37448.38431.286111@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=maan@systemlinux.org \
    --cc=weiyqlq@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.