Bug 195161 - [autofs] automounted directories not being unmounted
Summary: [autofs] automounted directories not being unmounted
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 10.1-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: Edward Tomasz Napierala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-19 05:59 UTC by T A Brown
Modified: 2014-12-21 11:35 UTC (History)
2 users (show)

See Also:
bugmeister: mfc-stable8?
bugmeister: mfc-stable9?
bugmeister: mfc-stable10?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description T A Brown 2014-11-19 05:59:45 UTC
After being successfully mounted by automountd, a smbfs directory is never unmounted by autounmountd -- even after days of inactivity.

# cat /etc/auto_master 
...
/-              /etc/auto_smbfs

# cat /etc/auto_smbfs
/home/xxx/Work -fstype=smbfs,-N,-Innn.nnn.nnn.nnn,-uxxx,-gxxx ://xxx@nnn.nnn.nnn.nnn/Work

# service automountd status
automountd is running as pid 1147.

# ps -Ostart -p 1147
 PID STARTED TT  STAT    TIME COMMAND
1147 Mon09PM  -  Is   0:00.00 /usr/sbin/automountd

# service autounmountd status
autounmountd is running as pid 1135.

# ps -Ostart -p 1135
 PID STARTED TT  STAT    TIME COMMAND
1135 Mon09PM  -  Is   0:00.06 /usr/sbin/autounmountd

# mount
...
map /etc/auto_smbfs on /usr/home/xxx/Work (autofs)
//XXX@nnn.nnn.nnn.nnn/WORK on /usr/home/xxx/Work (smbfs, automounted)

# fuser -c /usr/home/xxx/Work
/usr/home/xxx/Work:
Comment 1 Edward Tomasz Napierala freebsd_committer 2014-11-20 08:24:20 UTC
Could you try the patch below?

Index: sys/fs/smbfs/smbfs_vfsops.c
===================================================================
--- sys/fs/smbfs/smbfs_vfsops.c (revision 274743)
+++ sys/fs/smbfs/smbfs_vfsops.c (working copy)
@@ -401,8 +401,6 @@
        scred = smbfs_malloc_scred();
        smb_makescred(scred, td, td->td_ucred);
        error = smbfs_smb_statfs(ssp, sbp, scred);
-       if (error == 0)
-               sbp->f_flags = 0;       /* copy of mount exported flags */
        smbfs_free_scred(scred);
        return (error);
 }
Comment 2 T A Brown 2014-11-20 11:47:47 UTC
Yes, I'll try the patch this evening. Thanks.
Comment 3 T A Brown 2014-11-21 04:53:40 UTC
The patch worked. Thanks again. Also, my version is 10.1-RELEASE; I mistakenly entered 10.1-STABLE initially.
Comment 4 commit-hook freebsd_committer 2014-11-21 06:21:52 UTC
A commit references this bug:

Author: trasz
Date: Fri Nov 21 06:21:40 UTC 2014
New revision: 274784
URL: https://svnweb.freebsd.org/changeset/base/274784

Log:
  Fix smbfs to not zero out statfs f_flags field. Previously, this
  made getmntinfo() return empty flags for smbfs filesystems when
  called with MNT_WAIT. It's not visible with mount(8), since it uses
  MNT_NOWAIT, but broke autounmount(8) operation.

  PR:		195161
  Differential Revision:	https://reviews.freebsd.org/D1194
  Reviewed by:	kib@
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/sys/fs/smbfs/smbfs_vfsops.c
Comment 5 commit-hook freebsd_committer 2014-12-21 11:33:36 UTC
A commit references this bug:

Author: trasz
Date: Sun Dec 21 11:33:19 UTC 2014
New revision: 276002
URL: https://svnweb.freebsd.org/changeset/base/276002

Log:
  MFC r274784:

  Fix smbfs to not zero out statfs f_flags field. Previously, this
  made getmntinfo() return empty flags for smbfs filesystems when
  called with MNT_WAIT. It's not visible with mount(8), since it uses
  MNT_NOWAIT, but broke autounmount(8) operation.

  PR:		195161
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  stable/10/
  stable/10/sys/fs/smbfs/smbfs_vfsops.c