linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Song Liu <song@kernel.org>
To: Xiao Ni <xni@redhat.com>
Cc: Guoqing Jiang <guoqing.jiang@linux.dev>,
	Nigel Croxon <ncroxon@redhat.com>,
	linux-raid <linux-raid@vger.kernel.org>
Subject: Re: [PATCH 1/2] md/raid0: Free r0conf memory when register integrity failed
Date: Thu, 9 Dec 2021 18:29:17 -0800	[thread overview]
Message-ID: <CAPhsuW46cotj7a=VKfd84v0cdbVLV5ErgCC5rTBy945nY4WCvg@mail.gmail.com> (raw)
In-Reply-To: <CALTww293ewiXD8s0b-sLbdFZgnxMZh=5e4Fj=WMB+ifoJcNP7g@mail.gmail.com>

On Thu, Dec 9, 2021 at 5:34 PM Xiao Ni <xni@redhat.com> wrote:
>
> On Fri, Dec 10, 2021 at 9:22 AM Guoqing Jiang <guoqing.jiang@linux.dev> wrote:
> >
> >
> >
> > On 12/10/21 2:02 AM, Song Liu wrote:
> > > On Wed, Dec 8, 2021 at 9:55 PM Xiao Ni<xni@redhat.com>  wrote:
> > >> It doesn't free memory when register integrity failed. And move
> > >> free conf codes into a single function.
> > >>
> > >> Signed-off-by: Xiao Ni<xni@redhat.com>
> > >> ---
> > >>   drivers/md/raid0.c | 18 +++++++++++++++---
> > >>   1 file changed, 15 insertions(+), 3 deletions(-)
> > >>
> > >> diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
> > >> index 62c8b6adac70..3fa47df1c60e 100644
> > >> --- a/drivers/md/raid0.c
> > >> +++ b/drivers/md/raid0.c
> > >> @@ -356,6 +356,7 @@ static sector_t raid0_size(struct mddev *mddev, sector_t sectors, int raid_disks
> > >>          return array_sectors;
> > >>   }
> > >>
> > >> +static void free_conf(struct r0conf *conf);
> > >>   static void raid0_free(struct mddev *mddev, void *priv);
> > >>
> > >>   static int raid0_run(struct mddev *mddev)
> > >> @@ -413,19 +414,30 @@ static int raid0_run(struct mddev *mddev)
> > >>          dump_zones(mddev);
> > >>
> > >>          ret = md_integrity_register(mddev);
> > >> +       if (ret)
> > >> +               goto free;
> > >>
> > >>          return ret;
> > >> +
> > >> +free:
> > >> +       free_conf(conf);
> > > Can we just use raid0_free() here? Also, after freeing conf,
> > > we should set mddev->private to NULL.
> >
> > Agree, like what raid1_run did. And we might need to check the
> > return value of pers->run in level_store as well.
>
> Yes. It needs to check the return value and try to reback to the original
> state. I planed to fix this in the following days not this patch. This patch
> only fix the NULL reference problem after reshape.
>
> In fact, no only we need to check pers->run in level_store, we also need
> to check integrity during reshape. Now integrity only supports
> raid0/raid1/raid10,
> so it needs to do some jobs related with integrity (unregister/register)
>
> I plan to fix these two problems in the next patches. Is it OK?

Yes, that works. We don't have to fix all the issues in one set. :)

Song

  parent reply	other threads:[~2021-12-10  2:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09  5:55 [PATCH 0/2] md: it panic after reshape from raid1 to raid5 Xiao Ni
2021-12-09  5:55 ` [PATCH 1/2] md/raid0: Free r0conf memory when register integrity failed Xiao Ni
2021-12-09 18:02   ` Song Liu
2021-12-10  1:18     ` Xiao Ni
2021-12-10  2:07       ` Guoqing Jiang
2021-12-10  2:17         ` Xiao Ni
2021-12-10  2:27       ` Song Liu
2021-12-10  1:22     ` Guoqing Jiang
2021-12-10  1:34       ` Xiao Ni
2021-12-10  1:43         ` Guoqing Jiang
2021-12-10  2:29         ` Song Liu [this message]
2021-12-10  1:51       ` Xiao Ni
2021-12-09  5:55 ` [PATCH 2/2] md: Move alloc/free acct bioset in to personality Xiao Ni
2021-12-10  1:30   ` Guoqing Jiang

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='CAPhsuW46cotj7a=VKfd84v0cdbVLV5ErgCC5rTBy945nY4WCvg@mail.gmail.com' \
    --to=song@kernel.org \
    --cc=guoqing.jiang@linux.dev \
    --cc=linux-raid@vger.kernel.org \
    --cc=ncroxon@redhat.com \
    --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).