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

Thomas Bächler thomas at archlinux.org
Sun Dec 15 03:05:19 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.

Okay, I tested a bit further: I added 'ExecStartPre=/usr/bin/sleep 10'
to user at .service and tested with both versions of the patch. My version
indeed causes problems, but the race condition I suspected does not
occur: the user manager is started and immediately stopped in case I log
out while the service is still starting up.

Sending v2 in a minute.


-------------- 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/20131215/cb9321d8/attachment-0001.pgp>


More information about the systemd-devel mailing list