]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/nvdimm/namespace_devs.c
libnvdimm: handle locked label storage areas
[karo-tx-linux.git] / drivers / nvdimm / namespace_devs.c
index 2f2d8afc684a59c15421396c59f24db5d415232e..2f9dfbd2dbece55277df04d4462bf5460090f4af 100644 (file)
@@ -2236,14 +2236,21 @@ static int init_active_labels(struct nd_region *nd_region)
                int count, j;
 
                /*
-                * If the dimm is disabled then prevent the region from
-                * being activated if it aliases DPA.
+                * If the dimm is disabled then we may need to prevent
+                * the region from being activated.
                 */
                if (!ndd) {
-                       if (!test_bit(NDD_ALIASING, &nvdimm->flags))
+                       if (test_bit(NDD_LOCKED, &nvdimm->flags))
+                               /* fail, label data may be unreadable */;
+                       else if (test_bit(NDD_ALIASING, &nvdimm->flags))
+                               /* fail, labels needed to disambiguate dpa */;
+                       else
                                return 0;
-                       dev_dbg(&nd_region->dev, "%s: is disabled, failing probe\n",
-                                       dev_name(&nd_mapping->nvdimm->dev));
+
+                       dev_err(&nd_region->dev, "%s: is %s, failing probe\n",
+                                       dev_name(&nd_mapping->nvdimm->dev),
+                                       test_bit(NDD_LOCKED, &nvdimm->flags)
+                                       ? "locked" : "disabled");
                        return -ENXIO;
                }
                nd_mapping->ndd = ndd;