Re: [PATCH 1/2 cgroup/for-6.1] cgroup: Improve cftype add/rm error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 06, 2022 at 07:25:08AM -1000, Tejun Heo <tj@xxxxxxxxxx> wrote:
> I prefer having it as a separate flag because it's explicit and can be
> tested together with other flags. It's a weak preference tho and I can go
> either way if it bothers you much.

No trouble, please proceed with the new flag.

BTW, while I was just looking over the patch I noticed that in

@@ -1717,14 +1722,22 @@ static int css_populate_dir(struct cgrou
                return 0;

        if (!css->ss) {
-               if (cgroup_on_dfl(cgrp))
-                       cfts = cgroup_base_files;
-               else
-                       cfts = cgroup1_base_files;
-
-               ret = cgroup_addrm_files(&cgrp->self, cgrp, cfts, true);
-               if (ret < 0)
-                       return ret;
+               if (cgroup_on_dfl(cgrp)) {
+                       ret = cgroup_addrm_files(&cgrp->self, cgrp,
+                                                cgroup_base_files, true);
+                       if (ret < 0)
+                               return ret;
+
+                       if (cgroup_psi_enabled()) {
+                               ret = cgroup_addrm_files(&cgrp->self, cgrp,
+                                                        cgroup_psi_files, true);
+                               if (ret < 0)
+                                       return ret;

Before the return here, the function should revert the base files first (or
silence the return value to 0 if such a partial population is acceptable).

(Actually, it looks like the revert in the subsys branch is unnecessary as
callers of css_populate_dir() would issue css_clear_dir() upon failure
eventually.)


Thanks,
Michal

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux