Message ID | 1442409887.6868.1.camel@ingics.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 4be9c1fc3df9 |
Headers | show |
On Wed, Sep 16, 2015 at 6:24 AM, Axel Lin <axel.lin@ingics.com> wrote: > Always take device_lock() before nvdimm_bus_lock() to prevent deadlock. > > Signed-off-by: Axel Lin <axel.lin@ingics.com> > --- > drivers/nvdimm/btt_devs.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c > index 59ad54a6..cb47751 100644 > --- a/drivers/nvdimm/btt_devs.c > +++ b/drivers/nvdimm/btt_devs.c > @@ -128,13 +128,13 @@ static ssize_t namespace_store(struct device *dev, > struct nd_btt *nd_btt = to_nd_btt(dev); > ssize_t rc; > > - nvdimm_bus_lock(dev); > device_lock(dev); > + nvdimm_bus_lock(dev); > rc = nd_namespace_store(dev, &nd_btt->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; > } Thanks Axel! I'll also tag these for -stable.
diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c index 59ad54a6..cb47751 100644 --- a/drivers/nvdimm/btt_devs.c +++ b/drivers/nvdimm/btt_devs.c @@ -128,13 +128,13 @@ static ssize_t namespace_store(struct device *dev, struct nd_btt *nd_btt = to_nd_btt(dev); ssize_t rc; - nvdimm_bus_lock(dev); device_lock(dev); + nvdimm_bus_lock(dev); rc = nd_namespace_store(dev, &nd_btt->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; }
Always take device_lock() before nvdimm_bus_lock() to prevent deadlock. Signed-off-by: Axel Lin <axel.lin@ingics.com> --- drivers/nvdimm/btt_devs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)