Summary:
Currently logind will not clear sessions on logout. The bug is confirmed
for getty and ssh logins. This series is preparation for next patches to
address that bug, it does not fix it.

However, this series also fixe real races on user and session states.
This ensures that user_save() and session_save() functions will write the
correct user and session state to the state files.


The logind bug was already discussed here:
http://lists.freedesktop.org/archives/systemd-devel/2014-January/015968.html

Patches were proposed, but they failed to address the bug since there
are other problems related to user and session states:
http://lists.freedesktop.org/archives/systemd-devel/2014-January/016372.html

A first version to fix these race conditions on user and sessions
states was proposed:
http://lists.freedesktop.org/archives/systemd-devel/2014-January/016373.html


This series is a v2, it will close all the discovered races on user and
session states. The commit logs will tell you the story of each case.


Now as noted above, this series fix real races and in the same time it
is needed to fix the logind bug where sessions are not cleaned after
logouts.

Proposed plan to clean logind closed sessions:
1) Make the user and session states stable (this series fix it).

2) Improve session_check_gc() and user_check_gc() to check if:
   the state is closing and the cgroup is empty.

3) Push session and user into the gc during logout, in pam_systemd
   method_release_session() 

Now I've a patch that implements 2) and 3) on top of 1), sometimes it
will work and successfully clean closed sessions, and sometimes it will
not. This is due to a race when we close the session and try to
terminate session processes and in the same time we are trying to see if
the cgroup is empty... which is another problem on its own.


So here are the patches, please consider this series since it will fix
real races and it will make sure that user_save() and session_save()
will write the correct state to the state files.


Patches 1,6,7 are code cleanup.

Patches 2,3,4,5 close races on user and session states.


Djalal Harouni (7):
0001 logind: add function session_jobs_reply() to unify the create reply
  unify shared code in a single function.

0002 logind: close races on user and session states during login
0003 logind: close races on session state at logout
0004 logind: close races on user state at logout
  close race conditions on user and session states.

0005 logind: just call session_get_state() to get the session state
  make user_get_state() consistent with session_get_state()

0006 logind: add user_is_opening() and session_is_opening()
0007 logind: do not call session_jobs_reply() on CLOSING
  make sure to not call session_send_create_reply() when jobs finish
  during closing state.

 src/login/logind-dbus.c         | 87  
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
 src/login/logind-session-dbus.c | 11 ++++++++---
 src/login/logind-session.c      | 10 +++++++++-
 src/login/logind-session.h      |  4 +++-
 src/login/logind-user.c         | 20 +++++++++++++++++---
 src/login/logind-user.h         |  3 +++
 6 files changed, 99 insertions(+), 36 deletions(-)

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to