Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d34cb808 authored by Dan Williams's avatar Dan Williams
Browse files

libnvdimm, dimm: clear 'locked' status on successful DIMM enable



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: 9d62ed96 ("libnvdimm: handle locked label storage areas")
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent e19b205b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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)
+7 −0
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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 {