Re: [PATCH RFC 3/3] lightnvm: fix media mgr registration

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

 



2015-12-02 20:16 GMT+08:00 Matias Bjørling <m@xxxxxxxxxxx>:
> The ppa pool can be used at media manager registration.
> Therefore the ppa pool should be allocated before registering.
>
> If a media manager can't be found, this should not lead to the
> device being unallocated. A media manager can be registered later, that
> can manage a device. Only warn if a media manager fails initialization.
>
> Additionally, protect against the media managed being registered or
> deregistered while looping through available media managers. This was
> reported by Wenwei Tao.
>
> Signed-off-by: Matias Bjørling <m@xxxxxxxxxxx>
> ---
>  drivers/lightnvm/core.c | 79 ++++++++++++++++++++++++-------------------------
>  1 file changed, 39 insertions(+), 40 deletions(-)
>
> diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
> index 4601cf1..f4d5291 100644
> --- a/drivers/lightnvm/core.c
> +++ b/drivers/lightnvm/core.c
> @@ -97,15 +97,47 @@ static struct nvmm_type *nvm_find_mgr_type(const char *name)
>         return NULL;
>  }
>
> +struct nvmm_type *nvm_init_mgr(struct nvm_dev *dev)
> +{
> +       struct nvmm_type *mt;
> +       int ret;
> +
> +       lockdep_assert_held(&nvm_lock);
> +
> +       list_for_each_entry(mt, &nvm_mgrs, list) {
> +               ret = mt->register_mgr(dev);
> +               if (ret < 0) {
> +                       pr_err("nvm: media mgr failed to init (%d) on dev %s\n",
> +                                                               ret, dev->name);
> +                       return NULL; /* initialization failed */

Do we just return or continue to try next media manager ?  In my commit

commit d0a712ceb83ebaea32d520825ee7b997f59b168f

Author: Wenwei Tao <ww.tao0320@xxxxxxxxx>

Date:   Sat Nov 28 16:49:28 2015 +0100

    lightnvm: missing nvm_lock acquire

I use the second solution.


> +               } else if (ret > 0)
> +                       return mt;
> +       }
> +
> +       return NULL;
> +}
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux