Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1283651

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

From Wenwei Tao <ww.tao0320@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH RFC 3/3] lightnvm: fix media mgr registration
Date 2015-12-04 09:50 +0100
Message-ID <qBUdY-kv-9@gated-at.bofh.it> (permalink)
References <qBey6-72N-25@gated-at.bofh.it> <qBey6-72N-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


2015-12-02 20:16 GMT+08:00 Matias Bjørling <m@bjorling.me>:
> 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@bjorling.me>
> ---
>  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@gmail.com>

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-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH RFC 3/3] lightnvm: fix media mgr registration Matias Bjørling <m@bjorling.me> - 2015-12-02 13:20 +0100
  Re: [PATCH RFC 3/3] lightnvm: fix media mgr registration Wenwei Tao <ww.tao0320@gmail.com> - 2015-12-04 09:50 +0100
    Re: [PATCH RFC 3/3] lightnvm: fix media mgr registration Matias Bjørling <m@bjorling.me> - 2015-12-04 11:50 +0100

csiph-web