Re: [PATCH 1/2] md/raid0: Free r0conf memory when register integrity failed

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

 



On Fri, Dec 10, 2021 at 10:07 AM Guoqing Jiang <guoqing.jiang@xxxxxxxxx> wrote:
>
> Maybe something like this, just FYI.
>
> diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
> index 62c8b6adac70..c24bec49b36f 100644
> --- a/drivers/md/raid0.c
> +++ b/drivers/md/raid0.c
> @@ -377,6 +377,12 @@ static int raid0_run(struct mddev *mddev)
>                          return ret;
>                  mddev->private = conf;
>          }
> +
> +       if (acct_bioset_init(mddev)) {
> +               pr_err("md/raid0:%s: alloc acct bioset failed.\n",
> mdname(mddev));
> +               return -ENOMEM;
> +       }
> +
>          conf = mddev->private;
>          if (mddev->queue) {
>                  struct md_rdev *rdev;
> @@ -413,6 +419,11 @@ static int raid0_run(struct mddev *mddev)
>          dump_zones(mddev);
>
>          ret = md_integrity_register(mddev);
> +       if (ret) {
> +               raid0_free(mddev, mddev->private);
> +               mddev->private = NULL;
> +               acct_bioset_exit(mddev);
> +       }
>
>          return ret;
>   }
>
> Thanks,
> Guoqing
>

This should not work. The way to fix the original problem is that we
need to clean acct bio set of old
level raid in pers->free and create acct bio set for new level raid in
pers->run. So it doesn't need to
change any codes in level_store. So it needs to put
acct_bioset_init/acct_bioset_exit in pers->run/free.

Regards
Xiao




[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