Re: After reshaping raid1 to raid0 with bitmap, then stop md panic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 7 Aug 2014 20:29:13 +1000 NeilBrown <neilb@xxxxxxx> wrote:

> On Thu, 7 Aug 2014 06:03:37 -0400 (EDT) Xiao Ni <xni@xxxxxxxxxx> wrote:
> 
> > 
> > 
> > ----- Original Message -----
> > > From: "NeilBrown" <neilb@xxxxxxx>
> > > To: "Xiao Ni" <xni@xxxxxxxxxx>
> > > Cc: linux-raid@xxxxxxxxxxxxxxx, "Jes Sorensen" <jes.sorensen@xxxxxxxxxx>
> > > Sent: Wednesday, August 6, 2014 2:37:02 PM
> > > Subject: Re: After reshaping raid1 to raid0 with bitmap, then stop md panic
> > > 
> > > On Tue, 5 Aug 2014 03:03:06 -0400 (EDT) Xiao Ni <xni@xxxxxxxxxx> wrote:
> > > 
> > > > Dear all
> > > > 
> > > > 
> > > >    I faced one problem that the system panic after reshaping raid1 to raid0
> > > >    with bitmap.
> > > > The dmesg and calltrace information is like this:
> > > > 
> > > >    You can easily reproduce this by those steps:
> > > >    1. mdadm -CR /dev/md0 -l1 -n2 /dev/loop[0-1] --bitmap=internal
> > > >    2. mdadm --wait /dev/md0
> > > >    3. mdadm --grow -l0 /dev/md0
> > > >    4. mdadm -S /dev/md0
> > > ...
> > > > 
> > > > [ 1485.646746] BUG: unable to handle kernel NULL pointer dereference at
> > > > 0000000000000038
> > > > [ 1485.654724] IP: [<ffffffff8148db2e>] bitmap_daemon_work+0x24e/0x450
> > > 
> > > Yes, RAID0 doesn't support bitmaps, so this cannot possibly work.
> > > 
> > > Following patch should turn the crash into a clean failure.
> > > 
> > > Thanks for the report,
> > > NeilBrown
> > > 
> > > 
> > > From 1bdb20e16166240a4ca3b861c48defefaf218874 Mon Sep 17 00:00:00 2001
> > > From: NeilBrown <neilb@xxxxxxx>
> > > Date: Wed, 6 Aug 2014 16:34:27 +1000
> > > Subject: [PATCH] md: check for bitmap compatability when changing raid
> > > levels.
> > > 
> > > If an array has a bitmap, then it cannot be converted to
> > > a level which does not support bitmaps.
> > > 
> > > Reported-by: Xiao Ni <xni@xxxxxxxxxx>
> > > Signed-off-by: NeilBrown <neilb@xxxxxxx>
> > > 
> > > diff --git a/drivers/md/md.c b/drivers/md/md.c
> > > index 1379b1a3b9ff..3bd13b276e45 100644
> > > --- a/drivers/md/md.c
> > > +++ b/drivers/md/md.c
> > > @@ -3500,6 +3500,12 @@ level_store(struct mddev *mddev, const char *buf,
> > > size_t len)
> > >  		       mdname(mddev), clevel);
> > >  		return -EINVAL;
> > >  	}
> > > +	if (mddev->bitmap && !pers->quiesce) {
> > > +		module_put(pers->owner);
> > > +		printk(KERN_WARNING "md: %s: %s does not support a bitmap\n",
> > > +		       mdname(mddev), clevel);
> > > +		return -EINVAL;
> > > +	}
> > >  
> > >  	rdev_for_each(rdev, mddev)
> > >  		rdev->new_raid_disk = rdev->raid_disk;
> > > 
> > 
> > Hi Neil
> > 
> >    I have tried the patch, but it can reshape to raid0 still, then stop the raid0, the system
> > panics.
> > 
> >    What does pers->quiesce mean? I'm not familiar with md code. 
> > 
> > Best Regards
> > Xiao
> 
> 
> "quiesce" is a function that makes the array "quiescent" - it stops all IO
> from happening.
> The set_bitmap_file() function has:
> 
> 	if (mddev->pers) {
> 		if (!mddev->pers->quiesce)
> 			return -EBUSY;
> 
> 
> So I thought it was safe to assume that if there was a quiesce function then
> the personality handled bitmaps.  Obviously not.
> I'll have to fix that up...

Can you confirm that this works please?
Thanks.

NeilBrown

From a8461a61c241a25afedbe493c13d98a6e0cf4246 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@xxxxxxx>
Date: Wed, 6 Aug 2014 16:34:27 +1000
Subject: [PATCH] md/raid0: check for bitmap compatability when changing raid
 levels.

If an array has a bitmap, then it cannot be converted to raid0.

Reported-by: Xiao Ni <xni@xxxxxxxxxx>
Signed-off-by: NeilBrown <neilb@xxxxxxx>

diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 407a99e46f69..cf91f5910c7c 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -685,6 +685,12 @@ static void *raid0_takeover(struct mddev *mddev)
 	 *  raid10 - assuming we have all necessary active disks
 	 *  raid1 - with (N -1) mirror drives faulty
 	 */
+
+	if (mddev->bitmap) {
+		printk(KERN_ERR "md/raid0: %s: cannot takeover array with bitmap\n",
+		       mdname(mddev));
+		return ERR_PTR(-EBUSY);
+	}
 	if (mddev->level == 4)
 		return raid0_takeover_raid45(mddev);
 


Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux