Skip to content

Commit

Permalink
libnvdimm: pfn_devs: Fix locking in namespace_store
Browse files Browse the repository at this point in the history
Always take device_lock() before nvdimm_bus_lock() to prevent deadlock.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
  • Loading branch information
Axel Lin authored and Dan Williams committed Sep 17, 2015
1 parent 4be9c1f commit 4ca8b57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/nvdimm/pfn_devs.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ static ssize_t namespace_store(struct device *dev,
struct nd_pfn *nd_pfn = to_nd_pfn(dev);
ssize_t rc;

nvdimm_bus_lock(dev);
device_lock(dev);
nvdimm_bus_lock(dev);
rc = nd_namespace_store(dev, &nd_pfn->ndns, buf, len);
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
device_unlock(dev);
nvdimm_bus_unlock(dev);
device_unlock(dev);

return rc;
}
Expand Down

0 comments on commit 4ca8b57

Please sign in to comment.