Re: [PATCH -mmotm 1/8] cgroup: introduce cancel_attach()

Li Zefan
2009-11-09T07:19:16Z

>> @@ -1553,8 +1553,16 @@ int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk)
>> for_each_subsys(root, ss) {
>> if (ss->can_attach) {
>> retval = ss->can_attach(ss, cgrp, tsk, false);
>> - if (retval)
>> - return retval;
>> + if (retval) {
>> + /*
>> + * Remember at which subsystem we've failed in
>> + * can_attach() to call cancel_attach() only
>> + * against subsystems whose attach() have
>> + * succeeded(see below).
>> + */
>> + failed_ss = ss;
>
> failed_ss is global? Is it a marker into an array of subsystems? Don't
> we need more than one failed_ss for each failed subsystem? Or do we
> find the first failed subsystem, cancel_attach and fail all
> migrations?
>

The latter.

We record the first subsys that failed can_attach(), and break out
the for loop, and call cancel_attach() on those subsystems that
has succeeded in can_attach().

>> + goto out;
>> + }
>> }
>> }