Re: [PATCH 2/9] nvme: fix the deadlock in nvme_update_formats

2018-02-11 Thread jianchao.wang
Hi Sagi Thanks for your kindly response and directive. That's really appreciated. On 02/11/2018 07:16 PM, Sagi Grimberg wrote: >>   mutex_lock(&ctrl->namespaces_mutex); >>   list_for_each_entry(ns, &ctrl->namespaces, list) { >> -    if (ns->disk && nvme_revalidate_disk(ns->disk)) >> -

Re: [PATCH 2/9] nvme: fix the deadlock in nvme_update_formats

2018-02-11 Thread Sagi Grimberg
mutex_lock(&ctrl->namespaces_mutex); list_for_each_entry(ns, &ctrl->namespaces, list) { - if (ns->disk && nvme_revalidate_disk(ns->disk)) - nvme_ns_remove(ns); + if (ns->disk && nvme_revalidate_disk(ns->disk)) { +

[PATCH 2/9] nvme: fix the deadlock in nvme_update_formats

2018-02-11 Thread Jianchao Wang
nvme_update_formats will invoke nvme_ns_remove under namespaces_mutext. The will cause deadlock because nvme_ns_remove will also require the namespaces_mutext. Fix it by getting the ns entries which should be removed under namespaces_mutext and invoke nvme_ns_remove out of namespaces_mutext. Signe