libnvdimm, dimm: clear 'locked' status on successful DIMM enable
authorDan Williams <dan.j.williams@intel.com>
Mon, 25 Sep 2017 18:01:31 +0000 (11:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Nov 2017 08:40:54 +0000 (08:40 +0000)
commit d34cb808402898e53b9a9bcbbedd01667a78723b upstream.

If we successfully enable a DIMM then it must not be locked and we can
clear the label-read failure condition. Otherwise, we need to reload the
entire bus provider driver to achieve the same effect, and that can
disrupt unrelated DIMMs and namespaces.

Fixes: 9d62ed965118 ("libnvdimm: handle locked label storage areas")
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvdimm/dimm.c
drivers/nvdimm/dimm_devs.c
drivers/nvdimm/nd.h

index e0f0e3ce1a32ec284317a22c1ff172c7205a185d..98466d762c8fac4f624b2fe4583a81251abad6c9 100644 (file)
@@ -68,6 +68,7 @@ static int nvdimm_probe(struct device *dev)
        rc = nd_label_reserve_dpa(ndd);
        if (ndd->ns_current >= 0)
                nvdimm_set_aliasing(dev);
+       nvdimm_clear_locked(dev);
        nvdimm_bus_unlock(dev);
 
        if (rc)
index f0d1b7e5de01d180b0244102223d7fb594bf6d7f..5f1385b96b1315d0132ffd80ff0466045a391601 100644 (file)
@@ -200,6 +200,13 @@ void nvdimm_set_locked(struct device *dev)
        set_bit(NDD_LOCKED, &nvdimm->flags);
 }
 
+void nvdimm_clear_locked(struct device *dev)
+{
+       struct nvdimm *nvdimm = to_nvdimm(dev);
+
+       clear_bit(NDD_LOCKED, &nvdimm->flags);
+}
+
 static void nvdimm_release(struct device *dev)
 {
        struct nvdimm *nvdimm = to_nvdimm(dev);
index 9c758a91372bbf6c72f9ca9a9af99615ec965426..156be00e1f760afa23258c6f70ff21ac76d72592 100644 (file)
@@ -254,6 +254,7 @@ long nvdimm_clear_poison(struct device *dev, phys_addr_t phys,
                unsigned int len);
 void nvdimm_set_aliasing(struct device *dev);
 void nvdimm_set_locked(struct device *dev);
+void nvdimm_clear_locked(struct device *dev);
 struct nd_btt *to_nd_btt(struct device *dev);
 
 struct nd_gen_sb {