stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Yufen Yu <yuyufen@huawei.com>
Cc: songliubraving@fb.com, linux-raid@vger.kernel.org, neilb@suse.de,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] md: no longer compare spare disk superblock events in super_load
Date: Wed, 25 Sep 2019 07:40:51 +0200	[thread overview]
Message-ID: <20190925054051.GA1436542@kroah.com> (raw)
In-Reply-To: <20190925055449.30091-1-yuyufen@huawei.com>

On Wed, Sep 25, 2019 at 01:54:49PM +0800, Yufen Yu wrote:
> We have a test case as follow:
> 
>   mdadm -CR /dev/md1 -l 1 -n 4 /dev/sd[a-d] --assume-clean --bitmap=internal
>   mdadm -S /dev/md1
>   mdadm -A /dev/md1 /dev/sd[b-c] --run --force
> 
>   mdadm --zero /dev/sda
>   mdadm /dev/md1 -a /dev/sda
> 
>   echo offline > /sys/block/sdc/device/state
>   echo offline > /sys/block/sdb/device/state
>   sleep 5
>   mdadm -S /dev/md1
> 
>   echo running > /sys/block/sdb/device/state
>   echo running > /sys/block/sdc/device/state
>   mdadm -A /dev/md1 /dev/sd[a-c] --run --force
> 
> When we readd /dev/sda to the array, it started to do recovery.
> After offline the other two disks in md1, the recovery have
> been interrupted and superblock update info cannot be written
> to the offline disks. While the spare disk (/dev/sda) can continue
> to update superblock info.
> 
> After stopping the array and assemble it, we found the array
> run fail, with the follow kernel message:
> 
> [  172.986064] md: kicking non-fresh sdb from array!
> [  173.004210] md: kicking non-fresh sdc from array!
> [  173.022383] md/raid1:md1: active with 0 out of 4 mirrors
> [  173.022406] md1: failed to create bitmap (-5)
> [  173.023466] md: md1 stopped.
> 
> Since both sdb and sdc have the value of 'sb->events' smaller than
> that in sda, they have been kicked from the array. However, the only
> remained disk sda is in 'spare' state before stop and it cannot be
> added to conf->mirrors[] array. In the end, raid array assemble and run fail.
> 
> In fact, we can use the older disk sdb or sdc to assemble the array.
> That means we should not choose the 'spare' disk as the fresh disk in
> analyze_sbs().
> 
> To fix the problem, we do not compare superblock events when it is
> a spare disk, as same as validate_super.
> 
> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
> 
> v1->v2:
>   fix wrong return value in super_90_load
> ---
>  drivers/md/md.c | 44 ++++++++++++++++++++++++--------------------
>  1 file changed, 24 insertions(+), 20 deletions(-)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

  reply	other threads:[~2019-09-25  5:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25  5:54 [PATCH v2] md: no longer compare spare disk superblock events in super_load Yufen Yu
2019-09-25  5:40 ` Greg KH [this message]
2019-10-12  1:25 ` Yufen Yu
2019-10-15  0:31   ` Song Liu
2019-10-15  2:35     ` Yufen Yu

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=20190925054051.GA1436542@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=songliubraving@fb.com \
    --cc=stable@vger.kernel.org \
    --cc=yuyufen@huawei.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).