Why does stopping mount units kill user sessions?

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

 



Hi,

after Don gave me the hint about the automounter problem
in the other mail I still didn't understand why stopping
a mount unit should kill the user's session, so I tried
that manually.

And indeed, with

<server>:/b /home/b nfs4 defaults,noauto,x-systemd.automount 0 0

in /etc/fstab, /home/b will be mounted if user biouser with
/home/b/biouser logs in via ssh.

Then, calling "systemctl stop home-b.mount" as root afterwards
will kill this ssh session of biouser.

Is that how it should be? Why? Shouldn't stopping the unit
fail because /home/b/ is busy? Just like it happens when
calling "umount /home/b" (=> "umount.nfs4: /home/b: device is busy")

journal shows this for the stop command:
May 16 22:08:03 bioserver3 systemd[1]: home-b.mount: Trying to enqueue job home-b.mount/stop/replace
May 16 22:08:03 bioserver3 systemd[1]: session-73.scope: Installed new job session-73.scope/stop as 15216
May 16 22:08:03 bioserver3 systemd[1]: home-b.mount: Installed new job home-b.mount/stop as 15215
...

So a stop job for the user session is installed and kills all
the processes of the ssh login of biouser.

This also happens when the mounting was done by someone else,
e.g. root, by "ls /home/b", so that it is already mounted when
biousers logs in with ssh. But still the ssh session is killed
when stopping the mount unit. So systemd is not killing the session
of the user who invoked the mount of /home/b, but of the user
who is currently using it.

When logging in as root and then calling "su -l biouser", then
"systemctl stop home-b.mount" returns 'Job failed. See "journalctl -xe"
for details.' and the reason is "umount.nfs4: /home/b: device is busy".
And the journal shows no tryentry about stopping a session.scope/

So, can someone explain
a)  why the ssh session of biouser is killed when stopping the mount
    unit of his home dir?
b) why the session is not killed when invoked with "su -l biouser"?

And is there a way I can change a) so that the ssh session stays
and the stop job returns "device busy" just as in b)?


Thanks a lot!

cu,
Frank

--
Dipl.-Inform. Frank Steiner   Web:  http://www.bio.ifi.lmu.de/~steiner/
Lehrstuhl f. Bioinformatik    Mail: http://www.bio.ifi.lmu.de/~steiner/m/
LMU, Amalienstr. 17           Phone: +49 89 2180-4049
80333 Muenchen, Germany       Fax:   +49 89 2180-99-4049
* Rekursion kann man erst verstehen, wenn man Rekursion verstanden hat. *



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

  Powered by Linux