From: Xie XiuQi <xiexiuqi(a)huawei.com>
commit fd75045e8bab0f8e66f146e2418e0d5ae693cb40 openEuler-1.0
hulk inclusion
category: feature
bugzilla: 5510
CVE: NA
root@(none)$ ls
cpus cpus_list ctrlmon mon_data mon_groups schemata tasks
root@(none)$ cd ../
root@(none)$ rmdir p2
rmdir: 'p2': Operation not permitted
Signed-off-by: Xie XiuQi <xiexiuqi(a)huawei.com>
Reviewed-by: Hanjun Guo <guohanjun(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
Signed-off-by: Xin Hao <haoxing990(a)gmail.com>
---
fs/resctrlfs.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/fs/resctrlfs.c b/fs/resctrlfs.c
index 6f5c5f112717..87167893009f 100644
--- a/fs/resctrlfs.c
+++ b/fs/resctrlfs.c
@@ -207,7 +207,7 @@ static int resctrl_group_create_info_dir(struct kernfs_node
*parent_kn)
}
/*
- * This extra ref will be put in kernfs_remove() and guarantees
+ m This extra ref will be put in kernfs_remove() and guarantees
* that @rdtgrp->kn is always accessible.
*/
kernfs_get(kn_info);
@@ -330,6 +330,7 @@ static struct dentry *resctrl_mount(struct file_system_type *fs_type,
}
kernfs_get(kn_mongrp);
+#ifndef CONFIG_ARM64 /* [FIXME] arch specific code */
ret = mkdir_mondata_all(resctrl_group_default.kn,
&resctrl_group_default, &kn_mondata);
if (ret) {
@@ -338,6 +339,7 @@ static struct dentry *resctrl_mount(struct file_system_type *fs_type,
}
kernfs_get(kn_mondata);
resctrl_group_default.mon.mon_data_kn = kn_mondata;
+#endif
}
dentry = kernfs_mount(fs_type, flags, resctrl_root,
@@ -350,8 +352,10 @@ static struct dentry *resctrl_mount(struct file_system_type
*fs_type,
goto out;
out_mondata:
+#ifndef CONFIG_ARM64 /* [FIXME] arch specific code */
if (resctrl_mon_capable)
kernfs_remove(kn_mondata);
+#endif
out_mongrp:
if (resctrl_mon_capable)
kernfs_remove(kn_mongrp);
@@ -810,6 +814,11 @@ static void resctrl_group_rm_ctrl(struct resctrl_group *rdtgrp,
cpumask_var_t tm
static int resctrl_group_rmdir_ctrl(struct kernfs_node *kn, struct resctrl_group
*rdtgrp,
cpumask_var_t tmpmask)
{
+#ifdef CONFIG_ARM64 /* [FIXME] arch specific code */
+ if (rdtgrp->flags & RDT_CTRLMON)
+ return -EPERM;
+#endif
+
resctrl_group_rm_ctrl(rdtgrp, tmpmask);
/*
--
2.31.0