1 Star 0 Fork 10

jinlun/dim_9

forked from src-openEuler/dim 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-fix-resource-clear-in-concurrent-scenarios.patch 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
From 3c3197390d14cc94e3e0117969ab8c70d0976dd0 Mon Sep 17 00:00:00 2001
From: jinlun <jinlun@huawei.com>
Date: Mon, 17 Jun 2024 20:28:35 +0800
Subject: [PATCH 07/14] fix resource clear in concurrent scenarios
---
src/common/dim_entry.c | 13 ++++++++++++-
src/core/dim_core_main.c | 2 +-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/common/dim_entry.c b/src/common/dim_entry.c
index a8dcae7..f2454ce 100644
--- a/src/common/dim_entry.c
+++ b/src/common/dim_entry.c
@@ -4,9 +4,12 @@
#include <linux/err.h>
#include <linux/security.h>
+#include <linux/delay.h>
#include "dim_entry.h"
+#define WAIT_TIME_MAX 1000
+
int dim_entry_create(struct dim_entry *entry, struct dentry *parent)
{
int ret = 0;
@@ -27,7 +30,15 @@ int dim_entry_create(struct dim_entry *entry, struct dentry *parent)
void dim_entry_remove(struct dim_entry *entry)
{
+ int time_ms = 0;
+
if (entry != NULL && entry->dentry != NULL) {
+ while (d_is_dir(entry->dentry) &&
+ !simple_empty(entry->dentry) &&
+ time_ms < WAIT_TIME_MAX) {
+ time_ms++;
+ msleep(1);
+ }
securityfs_remove(entry->dentry);
entry->dentry = NULL;
}
@@ -60,4 +71,4 @@ void dim_entry_remove_list(struct dim_entry **list, unsigned int len)
for (i = 0; i < len; i++)
dim_entry_remove(list[i]);
-}
\ No newline at end of file
+}
diff --git a/src/core/dim_core_main.c b/src/core/dim_core_main.c
index de18d66..d4cc870 100644
--- a/src/core/dim_core_main.c
+++ b/src/core/dim_core_main.c
@@ -91,8 +91,8 @@ err:
static void __exit dim_core_exit(void)
{
- dim_core_measure_destroy();
dim_core_destroy_fs();
+ dim_core_measure_destroy();
dim_mem_pool_destroy();
if (signature)
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jinlun123123/dim_9.git
git@gitee.com:jinlun123123/dim_9.git
jinlun123123
dim_9
dim_9
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385