[systemd-devel] [PATCH] login: Don't stop a running user manager from garbage-collecting the user.

Thomas Bächler thomas at archlinux.org
Thu Dec 12 06:48:59 PST 2013


Am 12.12.2013 15:38, schrieb Lennart Poettering:
> On Wed, 11.12.13 19:56, Thomas Bächler (thomas at archlinux.org) wrote:
> 
>> With the current logic, a user will never be garbage-collected, since its
>> manager will always be around. Change the logic such that a user is
>> garbage-collected when it has no sessions and linger is disabled.
>> ---
>>  src/login/logind-user.c | 12 ------------
>>  1 file changed, 12 deletions(-)
>>
>> diff --git a/src/login/logind-user.c b/src/login/logind-user.c
>> index 6ba8d98..42a7524 100644
>> --- a/src/login/logind-user.c
>> +++ b/src/login/logind-user.c
>> @@ -612,18 +612,6 @@ bool user_check_gc(User *u, bool drop_not_started) {
>>          if (user_check_linger_file(u) > 0)
>>                  return true;
>>  
>> -        if (u->slice_job && manager_job_is_active(u->manager, u->slice_job))
>> -                return true;
>> -
>> -        if (u->service_job && manager_job_is_active(u->manager,
>> -                u->service_job))
>> -                return true;
> 
> Hmm, we probably should stay around as long as the jobs are still
> active. 
> 
>> -
>> -        if (u->slice && manager_unit_is_active(u->manager, u->slice) != 0)
>> -                return true;
>> -
>> -        if (u->service && manager_unit_is_active(u->manager, u->service) != 0)
>> -                return true;
>> -
> 
> THis part should indeed go, yo are right.
> 
> Can you check whether things work correctly for you if you only remove
> the latter two parts, but leave the former two in? I'lll merge the patch then.

That's rather hard to test. I'd have to terminate the session while the
service or slice job is still running and see what happens.

My guess is that omitting the first two checks will work most of the
time, but fail under rare circumstance: You terminate the last session
while the start job is still active, omit gc'ing the user and never add
it to the gc list again.

On the other hand I think that removing those lines is fine: Stopping
the user will queue a stob job for the service and the slice. The
corresponding start job may still be running at that time, but the
system manager should be capable of dealing with such issues (it's the
same issues that arises when running systemctl stop before a systemctl
start finished).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20131212/cc85ae4b/attachment.pgp>


More information about the systemd-devel mailing list