linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Xiao Ni <xni@redhat.com>
Cc: linux-raid@vger.kernel.org, Jes Sorensen <jes.sorensen@redhat.com>
Subject: Re: After reshaping raid1 to raid0 with bitmap, then stop md panic
Date: Thu, 7 Aug 2014 20:29:13 +1000	[thread overview]
Message-ID: <20140807202913.570be307@notabene.brown> (raw)
In-Reply-To: <1783178354.19231525.1407405817606.JavaMail.zimbra@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3037 bytes --]

On Thu, 7 Aug 2014 06:03:37 -0400 (EDT) Xiao Ni <xni@redhat.com> wrote:

> 
> 
> ----- Original Message -----
> > From: "NeilBrown" <neilb@suse.de>
> > To: "Xiao Ni" <xni@redhat.com>
> > Cc: linux-raid@vger.kernel.org, "Jes Sorensen" <jes.sorensen@redhat.com>
> > 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@redhat.com> 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@suse.de>
> > 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@redhat.com>
> > Signed-off-by: NeilBrown <neilb@suse.de>
> > 
> > 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...

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2014-08-07 10:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <324320204.17911195.1407221719669.JavaMail.zimbra@redhat.com>
2014-08-05  7:03 ` After reshaping raid1 to raid0 with bitmap, then stop md panic Xiao Ni
2014-08-06  6:37   ` NeilBrown
2014-08-07 10:03     ` Xiao Ni
2014-08-07 10:29       ` NeilBrown [this message]
2014-08-08  5:45         ` NeilBrown
2014-08-08  7:34           ` Xiao Ni

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=20140807202913.570be307@notabene.brown \
    --to=neilb@suse.de \
    --cc=jes.sorensen@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=xni@redhat.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 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).