Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automount timeout doesn't notice service still using the mount when PrivateDevices=yes #3410

Closed
1 task done
argv-minus-one opened this issue Jun 1, 2016 · 5 comments
Closed
1 task done
Labels

Comments

@argv-minus-one
Copy link

argv-minus-one commented Jun 1, 2016

Submission type

  • Bug report

systemd version the issue has been seen with

230

Used distribution

Debian sid

In case of bug report: Expected behaviour you didn't see

An automount unit with a TimeoutIdleSec shouldn't time out and unmount if a service is still using the mount point, even if the service has PrivateDevices=yes.

In case of bug report: Unexpected behaviour you saw

The automount timed out and was unmounted while still in use. Specifically, it was in use by a service with PrivateDevices=yes. If the service was configured with a dependency on the mount unit, then the service was abruptly stopped; otherwise, umount failed, and any process attempting to access the mount point after that would hang.

In case of bug report: Steps to reproduce the problem

  1. Configure a mount unit.
  2. Configure a corresponding automount unit, with TimeoutIdleSec=10s (or something similarly short).
  3. Configure a service unit that uses the mount unit for a long time (in my case, a backup tool). Set PrivateDevices=yes on this unit.
  4. Start the automount unit, then the service unit.
  5. Wait until TimeoutIdleSec expires.

At this point, one of two things will have happened:

  1. The service has been abruptly stopped. This happens if the service has a dependency on the mount unit. The automount point still functions normally.
  2. systemd has tried and failed to unmount the automount point, and has made some journal entries saying so. At this point, any process attempting to access the automount point will hang.

If you reconfigure the service unit with PrivateDevices=no and then start the service again, everything works correctly: the mount stays mounted until the service is finished.

@poettering
Copy link
Member

Hmm, this suggests that autofs gets confused by fs namespaces, which would be a kernel bug really.

@poettering poettering added the pid1 label Jun 3, 2016
@crashmaster1
Copy link

crashmaster1 commented Jun 6, 2016

I have similar problems with automount (Archlinux, systemd 230, Kernel 4.6.1).
I didn't configure "PrivateDependencies" so it should be "no" by default.
Nevertheless i get these 'hangups' of processes from time to time only (sporadic). It is no file opened which uses the automount. Assuming i have a mountpoint "/mymnt' then f.e. a simple 'ls /' suddenly keeps hanging forever. Logging into another shell and restarting the automount unit helps in most cases - the hanging process continues.

I made this experience with remote filesystems like 'sshfs' and 'squashfs' but also with my local and permanently connected usb hdd on the same machine (ext4fs).

Shortly said: Automount works several times correct (also with unmounts between) but suddenly it has this behaviour. Journal and log don't show anything which could help.

I agree with argv-minus-one's remark: everything works fine with a process currently using the automount (opened files, 'PrivateDependencies=no').
In previous systemd versions i had no problems.

EDIT:
Just had a hangup again, now a 'daemon-reload' (never tried before) helped to let the process continue.

@crashmaster1
Copy link

RaspberryPi with ArchlinuxARM and older Kernel 4.4.12 : same problem. 'daemon-reload' helped again.

@crashmaster1
Copy link

Just installed kernel 4.6.2 and now it works fine for my needs. Not testing "PrivateDependencies=yes" but it seems the now fixed lock/unlock kernel bug could also have been the reason. Whatever, for me it's solved. :)

@poettering
Copy link
Member

OK, closing then. Thanks for reporting back!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants