On Fri, 2020-01-31 at 19:29 +0800, Ian Kent wrote:
> On Fri, 2020-01-31 at 19:16 +0800, Ian Kent wrote:
> > On Fri, 2020-01-31 at 07:55 +0100, Marc Lehmann wrote:
> > > > > Sounds like I have enough information to duplicate the
> > > > > problem
> > > > > so
> > > > > I'll have a look see.
> > > > 
> > > > Oh, as usual, what's the autofs source version of your package
> > > > please,
> > > > since I'll be using the current development source to work on
> > > > it.
> > > 
> > > It's the one mentioned in my original report (that you probably
> > > didn't
> > > get): 5.1.2-4
> > 
> > I grabbed the Debian source package and unpacked it on an old
> > Ubuntu
> > VM I have.
> > 
> > It looks like this package has the change that adds handling of
> > symlinks to umount_multi() so this should not be calling umount()
> > at all.
> 
> Ahh, Haa, I see the problem in the Debian package source.
> 
> As you say, there is a call to is_mounted() (which calls that ioctl)
> at the top of umount_multi():
> 
>        if (is_mounted(_PATH_MOUNTED, path, MNTS_ALL))
>                 goto real_mount;
> 
> and that branches to the real mount umount code, this is now gone
> in the current source.
> 
> I'll have a look at the change history and see if I can locate
> the patch (or patches) that removed it.

There it is, and it looks independent of other changes ...

autofs-5.1.3 - fix symlink false negative in umount_multi()

From: Ian Kent <ra...@themaw.net>

Using is_mounted() on a symlink will give a false negative for MNTS_ALL
since the kernel will return mounted true for a dentry within an autofs
mount point.

Just remove the check and rely on lstat().

Signed-off-by: Ian Kent <ra...@themaw.net>
---
 CHANGELOG          |    1 +
 daemon/automount.c |    5 -----
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index d6016984..df87df49 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -45,6 +45,7 @@ xx/xx/2017 autofs-5.1.4
 - improve debug logging of lookup key.
 - fix typo in amd_parse.c.
 - add missing MODPREFIX to logging in amd parser.
+- fix symlink false negative in umount_multi().
 
 24/05/2017 autofs-5.1.3
 =======================
diff --git a/daemon/automount.c b/daemon/automount.c
index 5c1481c4..3ff4f778 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -633,10 +633,6 @@ int umount_multi(struct autofs_point *ap, const char 
*path, int incl)
 
        debug(ap->logopt, "path %s incl %d", path, incl);
 
-       /* If path is a mount it can't be a symlink */
-       if (is_mounted(_PATH_MOUNTED, path, MNTS_ALL))
-               goto real_mount;
-
        if (lstat(path, &st)) {
                warn(ap->logopt,
                     "failed to stat directory or symlink %s", path);
@@ -681,7 +677,6 @@ int umount_multi(struct autofs_point *ap, const char *path, 
int incl)
                return 0;
        }
 
-real_mount:
        is_autofs_fs = 0;
        if (master_find_submount(ap, path))
                is_autofs_fs = 1;

Reply via email to