From: Weng Meiling <wengmeiling.w...@huawei.com>

When we use cgclear to unload the cgroup filesystem, we still can
see the umounted cgroup by using mount command. So fix the problem
by call system.

From: Weng Meiling <wengmeiling.w...@huawei.com>
---
 src/config.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/config.c b/src/config.c
index 06f559b..967b3f7 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1141,6 +1141,20 @@ err_mnt:
        return error;
 }

+/* umounts given mount */
+static int umount_system(char *path)
+{
+       char cmd[FILENAME_MAX + 7];
+       int err = -1;
+
+       snprintf(cmd, sizeof(cmd), "%s %s", "umount", path);
+       err = system(cmd);
+       if (err != -1 && WIFEXITED(err) && !WEXITSTATUS(err))
+               err = 0;
+       return err;
+
+}
+
 /* unmounts given mount, but only if it is empty */
 static int cgroup_config_try_unmount(struct cg_mount_table_s *mount_info)
 {
@@ -1197,7 +1211,7 @@ static int cgroup_config_try_unmount(struct 
cg_mount_table_s *mount_info)
                int err;
                cgroup_dbg("unmounting %s at %s\n", mount_info->name,
                                mount->path);
-               err = umount(mount->path);
+               err = umount_system(mount->path);

                if (err && !ret) {
                        ret = ECGOTHER;
@@ -1305,7 +1319,7 @@ static int cgroup_config_unload_controller(const struct 
cgroup_mount_point *moun
        ret = cgroup_get_subsys_mount_point_begin(mount_info->name, &handle,
                        path);
        while (ret == 0) {
-               error = umount(path);
+               error = umount_system(path);
                if (error) {
                        cgroup_warn("Warning: cannot unmount controller %s on 
%s: %s\n",
                                        mount_info->name, path,
-- 1.7.1



------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to