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

!2927 dm ioctl: add DMINFO() to track dm device create/remove

Merge Pull Request from: @zhengzengkai 
 
Add DMIINFO() to help tracking device creation/removal success, in case failure occurs without debug information. 
 
Link:https://gitee.com/openeuler/kernel/pulls/2927

 

Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
parents ee470722 a2d40404
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -327,6 +327,9 @@ static struct dm_table *__hash_remove(struct hash_cell *hc)
	table = NULL;
	table = NULL;
	if (hc->new_map)
	if (hc->new_map)
		table = hc->new_map;
		table = hc->new_map;

	DMINFO("%s[%i]: %s (%s) is removed successfully",
		current->comm, current->pid, hc->md->disk->disk_name, hc->name);
	dm_put(hc->md);
	dm_put(hc->md);
	free_cell(hc);
	free_cell(hc);


@@ -880,6 +883,7 @@ static int dev_create(struct file *filp, struct dm_ioctl *param, size_t param_si
{
{
	int r, m = DM_ANY_MINOR;
	int r, m = DM_ANY_MINOR;
	struct mapped_device *md;
	struct mapped_device *md;
	struct hash_cell *hc;


	r = check_name(param->name);
	r = check_name(param->name);
	if (r)
	if (r)
@@ -903,6 +907,13 @@ static int dev_create(struct file *filp, struct dm_ioctl *param, size_t param_si


	__dev_status(md, param);
	__dev_status(md, param);


	mutex_lock(&dm_hash_cells_mutex);
	hc = dm_get_mdptr(md);
	if (hc)
		DMINFO("%s[%i]: %s (%s) is created successfully",
			current->comm, current->pid, md->disk->disk_name, hc->name);

	mutex_unlock(&dm_hash_cells_mutex);
	dm_put(md);
	dm_put(md);


	return 0;
	return 0;