AutoFS does not automatically umount SMB shares

Bug #1754506 reported by Alexander Lochmann
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
autofs (Debian)
New
Unknown
autofs (Ubuntu)
Fix Released
Low
Andreas Hasenack

Bug Description

Description: Ubuntu 17.10
Release: 17.10

autofs:
  Installed: 5.1.2-1ubuntu1
  Candidate: 5.1.2-1ubuntu1
  Version table:
 *** 5.1.2-1ubuntu1 500
        500 http://de.archive.ubuntu.com/ubuntu artful/main amd64 Packages
        100 /var/lib/dpkg/status

Kernel: self-built 4.15.6

What I expect:
I expect AutoFS to automatically unmount my samba share after the timeout. However, it does not. The share is still mounted.
I've turned the autofs debug output in the kernel module. As far as I can tell, the kernel thinks the cifs mount is still busy.

I'm using the smb automount script provided by the package: /etc/auto.smb. I've just added an additional cifs parameter(vers=2.0).
My auto.master looks as follows:
/media/smb/ program:/etc/auto.smb

Related branches

Revision history for this message
Alexander Lochmann (alexander-lochmann) wrote :
description: updated
affects: libreoffice (Ubuntu) → autofs (Ubuntu)
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Hi Alexander,
this seems to be a reoccuring issue but so far always turned out to be a config issue.
E.g. for some hints and similar cases:
https://ubuntuforums.org/showthread.php?t=1355715
https://askubuntu.com/questions/194727/mounting-samba-share-whenever-its-available-unmounting-when-its-not

The description above isn't enough to reproduce and debug, so I'll mark it incomplete for now.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

Since it seems likely to me that this is a local configuration problem, rather than a bug in Ubuntu, I'm marking this bug as Incomplete.

If indeed this is a local configuration problem, you can find pointers to get help for this sort of problem here: http://www.ubuntu.com/support/community

Or if you believe that this is really a bug, then you may find it helpful to read "How to report bugs effectively" http://www.chiark.greenend.org.uk/~sgtatham/bugs.html. We'd be grateful if you would then provide a more complete description of the problem, explain why you believe this is a bug in Ubuntu rather than a problem specific to your system, and then change the bug status back to New.

Changed in autofs (Ubuntu):
status: New → Incomplete
Revision history for this message
Alexander Lochmann (alexander-lochmann) wrote :

As far as I know, just a few steps are necessary to reproduce this issue:
1. Setup a simple smb server on machine a, like the one I've attached to this report.
2. Create a smb user on machine a: smbpasswd -a $username
3. Enable smb in auto.master on machine b (and set the timeout to something small, e.g., 30 secs):
/media/smb/ program:/etc/auto.smb
4. Save the credentials on machine b: echo "username=$username\npassword=$password" > /etc/creds/machineb
5. Try to access the home directory from machine b:
user@machineb:~$ ls -lh /media/smb/machineb/$username
6. The smb mount is still there after more than 30 seconds

Revision history for this message
Alexander Lochmann (alexander-lochmann) wrote :

Some additional information:
I enabled the debug output for autofs4 module: echo -n 'module autofs4 +p' > /sys/kernel/debug/dynamic_debug/control
According to the kernel log, the mount is reported busy: autofs4:pid:7051:autofs4_mount_busy: returning = 1

Revision history for this message
Alexander Lochmann (alexander-lochmann) wrote :

Some additional information:
By further digging into it, I've learned that for some reasons the smb is reported busy.
In autofs4_mount_busy(https://elixir.bootlin.com/linux/v4.15.6/source/fs/autofs4/expire.c#L34) the call of may_umount_tree() returns 0. This indicates that the mount is considered busy. I'll keep you posted.

Revision history for this message
Alexander Lochmann (alexander-lochmann) wrote :

Just a little update: I think I've figured out what causes autofs to stall.
Since I've tested sshfs and cifs, and reproduced it using both, I can rule out a specific target fs.
I think it has something to do with the indirekt map feature:

#/etc/auto.master
/media/auto-smb/ program:/etc/auto.smb
/media/single-smb/ /etc/auto-single.smb

#/etc/auto.smb
#Same file as shipped with the Ubuntu package.

#/etc/auto-single.smb
* -fstype=cifs,vers=1.0,credentials=/etc/creds/myhost ://myhost/&

Every mount under /media/single-smb/ will automatically disappear after $timeout. Whereas, a mount under /media/auto-smb/ will *not* disappear.

Revision history for this message
Alexander Lochmann (alexander-lochmann) wrote :

I finally solved the problem with the help of Ian Kent.
He pointed me in the right direction: https://git.kernel.org/pub/scm/linux/storage/autofs/autofs.git/commit/?id=37dd05dd1bccdedc4157902420e1da506b2bf35f

A trailing slash in the /etc/auto.master was the problem. I consider it both a config problem and a bug.
However, it has already been fixed in the upstream sources. I therefore ask you to update Ubuntu's version of autofs daemon.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks for debugging this issue down to your configuration bit that triggered it.
As well as to point out the existing upstream fix.

The issue isn't sever enough to qualify for an SRU IMHO, but it would be good to pick it up on the next merge cycle for the follow on release.

There is no 5.1.5 release yet upstream to contain that fix, but sooner or later there hoefully should be one that we can then easily pick up to fix this issue avoiding the need that users take care of trailing slashes in their config.

tags: added: merge server-next upgrade-software-version
Changed in autofs (Ubuntu):
status: Incomplete → Triaged
Changed in autofs (Ubuntu):
importance: Undecided → Low
Changed in autofs (Ubuntu):
assignee: nobody → Andreas Hasenack (ahasenack)
status: Triaged → In Progress
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Fix confirmed with the patch from comment #8

Changed in autofs (Debian):
status: Unknown → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package autofs - 5.1.2-3ubuntu1

---------------
autofs (5.1.2-3ubuntu1) cosmic; urgency=medium

  * Merge with Debian unstable (LP: #1775232). Remaining changes:
    - d/p/16group_buffer_size.patch
    - d/rules: Add LDFLAGS to avoid issues with accessing global variables in
      shared libraries (LP #1470687, LP #1472115).
      [Updated to use DEB_LDFLAGS_MAINT_STRIP instead of sed]
    - d/p/fix-lookup-ldap-crash.patch: fix crash on startup due to uninitialized
      config. (LP #1503034)
      [Updated DEP3 header with why this patch is still needed]
  * Dropped:
    - debian/rules: build with sssldir path
      [Adopted by Debian in 5.1.2-2]
    - d/p/fix-ssslib-search.patch - parts replaced by fix-sssldir.patch
      [Adopted by Debian in 5.1.2-2]
  * Added:
    - debian/patches/autofs-5.1.4-dont-allow-trailing-slash-in-master-map-
      mount-points.patch: Don't allow trailing slash in master map mount
      points. Thanks to: Ian Kent <email address hidden>. Closes LP: #1754506.

autofs (5.1.2-3) unstable; urgency=medium

  * QA upload.

  [ Laurent Bigonville ]
  * debian/control: Switch all the packages to Arch:linux-any

  [ Andreas Henriksson ]
  * Add e2fsprogs to build-dep and recommends (Closes: #887284)
  * Drop incorrect depends on lsb-base
  * Drop incorrect *build*-dep on lsb-base

autofs (5.1.2-2) unstable; urgency=medium

  * QA upload.
  [ Laurent Bigonville ]
  * Orphan the package, see #849148
  * debian/watch: Update the URL now that kernel.org ftp has been shutdown
    (Closes: #864849)
  * debian/control: Add dependency against lsb-base (Closes: #864852)
  * debian/autofs.postrm: Remove /etc/autofs.conf on purge (Closes: #788129)
  * debian/autofs.dirs: Install empty /etc/auto.master.d directory (Closes:
    #884233)
  * debian/rules: Don't strip the binaries during the build so the dbgsym
    packages actually contain the debugging symbols
  * debian/control: Bump Standards-Version to 4.1.2 and bump the packages
    priority from extra to optional, the former is now deprecated
  * debian/control: Drop dh-systemd build-dependency and bump debhelper to (>=
    9.20160709)
  * debian/rules: Really enable the force shutdown signal handler as intended
    (Closes: #743654)
  * d/p/fix-autofsconf-manpage-section.patch: Fix manpage section
  * d/p/fix-autofs-manpage-whatis.patch: Fix whatis entry for autofs.8
    manpage (Closes: #864853)
  * Move autofs.conf.5 manpage from autofs-ldap to the main autofs package
    (Closes: #870653)
  * debian/rules: Set --enable-sloppy-mount instead of modifying the
    include/config.h file manually
  * debian/control: Drop autofs5 transitional packages (Closes: #878205)

  [ Timo Aaltonen ]
  * Replace fix-ssldir.patch with fix-ssslib-search.patch, which is more
    upstreamable. Preseed sssldir in rules.

 -- Andreas Hasenack <email address hidden> Tue, 05 Jun 2018 14:42:35 -0300

Changed in autofs (Ubuntu):
status: In Progress → Fix Released
Robie Basak (racb)
tags: removed: server-next
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.