[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mesos-commits
Subject:    (mesos) branch master updated: [cgroups2] Use rmdir instead of rm -rf to delete a cgroup.
From:       bmahler () apache ! org
Date:       2024-03-19 19:46:53
Message-ID: 171087761302.952401.13414053950180651815 () gitbox2-he-fi ! apache ! org
[Download RAW message or body]

This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new a507a2dc9 [cgroups2] Use rmdir instead of rm -rf to delete a cgroup.
a507a2dc9 is described below

commit a507a2dc95c9e6da6fe1947f65d245b5e3a856f0
Author: Devin Leamy <dleamy@twitter.com>
AuthorDate: Tue Mar 19 19:18:25 2024 +0000

    [cgroups2] Use rmdir instead of rm -rf to delete a cgroup.
    
    Even with `sudo` permissions, `rm -rf` fails with "Operation not
    permitted" when deleting a directory inside of `/sys/fs/cgroup`.
    On the other hand, `sudo rmdir` does not fail.
    
    `os::rmdir` uses `rm -rf` when `recursive=true` and `rmdir` when
    `recursive=false`. Hence, we set `recursive=false` so cgroups
    can be removed.
---
 src/linux/cgroups2.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/linux/cgroups2.cpp b/src/linux/cgroups2.cpp
index e5b9db817..73d484ea2 100644
--- a/src/linux/cgroups2.cpp
+++ b/src/linux/cgroups2.cpp
@@ -265,7 +265,7 @@ Try<Nothing> destroy(const string& cgroup)
     return Error("There does not exist a cgroup at '" + absolutePath + "'");
   }
 
-  Try<Nothing> rmdir = os::rmdir(absolutePath);
+  Try<Nothing> rmdir = os::rmdir(absolutePath, false);
   if (rmdir.isError()) {
     return Error("Failed to remove directory '" + absolutePath + "': "
                  + rmdir.error());

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic