Re: Why does stopping mount units kill user sessions?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lennart Poettering, wrote:

 I think we probably should change systemd-logind to
implicitly and unconditionally keep an open fd to the home dir of a
user around as long as there's at least one session of them around,
simply to make clear that sessions keep home dirs busy. This, as side
effect would then also mean that autofs wouldn#t be tempted to
consider the home dir idle as long as there's a session.


Benjamin Godfrey's reply:

That seems like a good idea.  This can be done simply by modifying the logind_handle_homedir_umount function to:

C
static void
logind_handle_homedir_umount(struct logind_client *client,
                              const char *homedir)###  The function takes two arguments client and homedir. client points to a struct loginid_client object###  and homedir is a string that points to the users homedir.  {
    struct logind_session *session;
    bool active_sessions = false;  ###  This sets the variable to false by default

    session = logind_client_find_session_by_homedir(client, homedir);
    if (session) {
        active_sessions = true;  ### There is an active session 
    }

    if (active_sessions) {
        return;                  ###  A session is active, don't shut down.   
    }

    logind_session_kill(session); ###  Shut it down because there is no active session by default.  
}

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux