Unverified Commit 86f0c3f2 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!9933 nvdimm: Backport some bugfixs

Merge Pull Request from: @ci-robot 
 
PR sync from: Zhihao Cheng <chengzhihao@huaweicloud.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/2RVXZQ6MBC2ALDFKELM2EPXXNMPENEFE/ 
Mathieu Desnoyers (2):
  nvdimm/pmem: fix leak on dax_add_host() failure
  dax: alloc_dax() return ERR_PTR(-EOPNOTSUPP) for CONFIG_DAX=n


-- 
2.31.1
 
https://gitee.com/openeuler/kernel/issues/IAD301 
 
Link:https://gitee.com/openeuler/kernel/pulls/9933

 

Reviewed-by: default avatarYu Kuai <yukuai3@huawei.com>
Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents 17af64c8 3aa0ccca
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -328,6 +328,11 @@ EXPORT_SYMBOL_GPL(dax_alive);
 * that any fault handlers or operations that might have seen
 * dax_alive(), have completed.  Any operations that start after
 * synchronize_srcu() has run will abort upon seeing !dax_alive().
 *
 * Note, because alloc_dax() returns an ERR_PTR() on error, callers
 * typically store its result into a local variable in order to check
 * the result. Therefore, care must be taken to populate the struct
 * device dax_dev field make sure the dax_dev is not leaked.
 */
void kill_dax(struct dax_device *dax_dev)
{
+1 −2
Original line number Diff line number Diff line
@@ -566,12 +566,11 @@ static int pmem_attach_disk(struct device *dev,
	set_dax_nomc(dax_dev);
	if (is_nvdimm_sync(nd_region))
		set_dax_synchronous(dax_dev);
	pmem->dax_dev = dax_dev;
	rc = dax_add_host(dax_dev, disk);
	if (rc)
		goto out_cleanup_dax;
	dax_write_cache(dax_dev, nvdimm_has_cache(nd_region));
	pmem->dax_dev = dax_dev;

	rc = device_add_disk(dev, disk, pmem_attribute_groups);
	if (rc)
		goto out_remove_host;
+1 −5
Original line number Diff line number Diff line
@@ -95,11 +95,7 @@ static inline void *dax_holder(struct dax_device *dax_dev)
static inline struct dax_device *alloc_dax(void *private,
		const struct dax_operations *ops)
{
	/*
	 * Callers should check IS_ENABLED(CONFIG_DAX) to know if this
	 * NULL is an error or expected.
	 */
	return NULL;
	return ERR_PTR(-EOPNOTSUPP);
}
static inline void put_dax(struct dax_device *dax_dev)
{