lkml.org 
[lkml]   [2011]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/6] cgroup_freezer: fix freezer->state setting bug in freezer_change_state()
On 09/03, Tejun Heo wrote:
>
> @@ -308,24 +308,24 @@ static int freezer_change_state(struct cgroup *cgroup,
> spin_lock_irq(&freezer->lock);
>
> update_if_frozen(cgroup, freezer);
> - if (goal_state == freezer->state)
> - goto out;
> -
> - freezer->state = goal_state;
>
> switch (goal_state) {
> case CGROUP_THAWED:
> - atomic_dec(&system_freezing_cnt);
> + if (freezer->state != CGROUP_THAWED)
> + atomic_dec(&system_freezing_cnt);
> + freezer->state = CGROUP_THAWED;
> unfreeze_cgroup(cgroup, freezer);
> break;
> case CGROUP_FROZEN:
> - atomic_inc(&system_freezing_cnt);
> + if (freezer->state == CGROUP_THAWED)
> + atomic_inc(&system_freezing_cnt);
> + freezer->state = CGROUP_FREEZING;
> retval = try_to_freeze_cgroup(cgroup, freezer);

Cough. Now it doesn't look right to me ;)

If the user write "FROZEN" into the control file, we should not
turn the CGROUP_FROZEN state into CGROUP_FREEZING. Probably this
is harmless, but this looks wrong and this doesn't match the
current behaviour, user-visible change.

Oleg.



\
 
 \ /
  Last update: 2011-09-04 20:09    [W:0.085 / U:2.300 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site