401 Star 1.4K Fork 1.3K

GVPopenEuler / kernel

 / 详情

【openEuler-21.09】极限场景下(dentry缓存压力过大)systemctl daemon-reload导致inotify操作耗时过长

已完成
缺陷
创建于  
2021-11-26 10:45

可以用如下方式提高复现概率再结合systemctl daemon-reload:

diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index 30d422b8c0fc..c78ff2651702 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -10,6 +10,7 @@
 #include <linux/module.h>
 #include <linux/mount.h>
 #include <linux/srcu.h>
+#include <linux/delay.h>

 #include <linux/fsnotify_backend.h>
 #include "fsnotify.h"
@@ -127,6 +128,7 @@ void __fsnotify_update_child_dentry_flags(struct inode *inode)
                 * original inode) */
                spin_lock(&alias->d_lock);
                list_for_each_entry(child, &alias->d_subdirs, d_child) {
+                       mdelay(10);
                        if (!child->d_inode)
                                continue;
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<time.h>


int main()
{
    const char *forname="_dOeSnotExist_.db";
    int i;
    char filename[100]="";
    struct timespec time1 = {0, 0};
    for(;;)
    {
        clock_gettime(CLOCK_REALTIME, &time1);
        for(i=0; i < 10000; i++) {

sprintf(filename,"/%d%d%d%s",time1.tv_sec,time1.tv_nsec,i,forname);
            access(filename,0);
            memset(filename,'\0',100);
        }
    }
    return 0;


}

评论 (2)

Yang Erkun 创建了缺陷
openeuler-ci-bot 添加了
 
sig/Kernel
标签
展开全部操作日志

Hi yang-erkun, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at
https://gitee.com/openeuler/community/blob/master/en/sig-infrastructure/command.md.
If you have any questions, please contact the SIG: Kernel, and any of the maintainers: @Xie XiuQi, @YangYingliang, @成坚 (CHENG Jian).

诚邀Issue的创建人,负责人,协作人以及评论人对此次Issue解决过程给予评价:

   0   1   2   3   4   5   6   7   8   9   10  

 不满意                        非常满意

Wei Li 修改了描述

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(3)
5329419 openeuler ci bot 1632792936 9968373 openeuler survey bot 1637036855
C
1
https://gitee.com/openeuler/kernel.git
git@gitee.com:openeuler/kernel.git
openeuler
kernel
kernel

搜索帮助