Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm fix from Dan Williams: "We expanded the device-dax fs type in 4.12 to be a generic provider of a struct dax_device with an embedded inode. However, Sasha found some basic negative testing was not run to verify that this fs cleanly handles being mounted directly. Note that the fresh rebase was done to remove an unnecessary Cc: <stable> tag, but this commit otherwise had a build success notification from the 0day robot." * 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: device-dax: fix 'dax' device filesystem inode destruction crash
This commit is contained in:
commit
8f56821d1d
|
@ -210,9 +210,12 @@ EXPORT_SYMBOL_GPL(kill_dax);
|
|||
static struct inode *dax_alloc_inode(struct super_block *sb)
|
||||
{
|
||||
struct dax_device *dax_dev;
|
||||
struct inode *inode;
|
||||
|
||||
dax_dev = kmem_cache_alloc(dax_cache, GFP_KERNEL);
|
||||
return &dax_dev->inode;
|
||||
inode = &dax_dev->inode;
|
||||
inode->i_rdev = 0;
|
||||
return inode;
|
||||
}
|
||||
|
||||
static struct dax_device *to_dax_dev(struct inode *inode)
|
||||
|
@ -227,7 +230,8 @@ static void dax_i_callback(struct rcu_head *head)
|
|||
|
||||
kfree(dax_dev->host);
|
||||
dax_dev->host = NULL;
|
||||
ida_simple_remove(&dax_minor_ida, MINOR(inode->i_rdev));
|
||||
if (inode->i_rdev)
|
||||
ida_simple_remove(&dax_minor_ida, MINOR(inode->i_rdev));
|
||||
kmem_cache_free(dax_cache, dax_dev);
|
||||
}
|
||||
|
||||
|
@ -423,6 +427,7 @@ static void init_once(void *_dax_dev)
|
|||
struct dax_device *dax_dev = _dax_dev;
|
||||
struct inode *inode = &dax_dev->inode;
|
||||
|
||||
memset(dax_dev, 0, sizeof(*dax_dev));
|
||||
inode_init_once(inode);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue